Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
feat: export and import memos as a Memo Archive (#6334)
ABird019ca26bd316
diff --git a/core/README.md b/core/README.mdindex 096e67893..9e1baf310 100644--- a/core/README.md+++ b/core/README.md@@ -9,6 +9,7 @@ apply the same way.| `access/` | who may read a memo, given viewer, space membership, and share links || `notification/` | building and dispatching inbox and email notifications || `memopayload/` | rebuilding a memo's derived payload from its markdown |+| `memoarchive/` | the Memo Archive container and records used for export and import |Layering: `core` may import `store`, `provider`, `markdown`, `filter`,`proto/gen`, and `internal`. It must not import `server` or `cmd`. Newdiff --git a/core/memoarchive/doc.go b/core/memoarchive/doc.gonew file mode 100644index 000000000..b7575e073--- /dev/null+++ b/core/memoarchive/doc.go@@ -0,0 +1,9 @@+// Package memoarchive implements the Memo Archive format: a ZIP container that+// carries one user's memos and attachments between Memos instances.+//+// The package owns the container layout, the JSON records, and the reading+// and writing rules defined in docs/design/memo-archive-format.md. It has no+// opinion about how records map onto a Memos instance; transports call the+// Writer with data they have already loaded and interpret the records a+// Reader returns.+package memoarchivediff --git a/core/memoarchive/format.go b/core/memoarchive/format.gonew file mode 100644index 000000000..33b4abbd5--- /dev/null+++ b/core/memoarchive/format.go@@ -0,0 +1,158 @@+package memoarchive++import (+ "encoding/json"+ "time"+)++const (+ // Format is the value of the manifest's format member.+ Format = "memos-archive"+ // FormatVersion is the newest version this package writes.+ FormatVersion = "1.0"+ // FormatMajor is the major version this package reads.+ FormatMajor = 1+ // MediaType is the HTTP Content-Type of an export. It is deliberately not+ // stored inside the container: a leading "mimetype" entry makes macOS+ // Archive Utility treat the file as an unknown document package and+ // refuse to expand it.+ MediaType = "application/vnd.usememos.archive+zip"++ // ManifestEntry holds the archive-level record and identifies the format.+ ManifestEntry = "manifest.json"+ // MemosDir holds one record and one content file per memo.+ MemosDir = "memos/"+ // AttachmentsDir holds attachment bytes under attachments/<uid>/<name>.+ AttachmentsDir = "attachments/"++ // ScopeKindUser is the only scope kind written in 1.0.+ ScopeKindUser = "USER"++ // RelationReference is the only relation type written in 1.0.+ RelationReference = "REFERENCE"+)++// Manifest is the archive-level record stored at manifest.json.+type Manifest struct {+ Format string `json:"format"`+ FormatVersion string `json:"formatVersion"`+ Generator Generator `json:"generator"`+ ExportTime string `json:"exportTime"`+ Scope Scope `json:"scope"`+ Counts *Counts `json:"counts,omitempty"`+}++// Generator names the software that wrote the archive.+type Generator struct {+ Name string `json:"name"`+ Version string `json:"version"`+}++// Scope says whose memos the archive holds.+type Scope struct {+ Kind string `json:"kind"`+ User *ScopeUser `json:"user,omitempty"`+}++// ScopeUser identifies the exporting user.+type ScopeUser struct {+ Username string `json:"username"`+ DisplayName string `json:"displayName,omitempty"`+}++// Counts lets readers detect truncation and report progress.+type Counts struct {+ Memos int `json:"memos"`+ Attachments int `json:"attachments"`+}++// Memo is the record stored at memos/<uid>.json.+type Memo struct {+ UID string `json:"uid"`+ Creator string `json:"creator"`+ CreateTime string `json:"createTime"`+ UpdateTime string `json:"updateTime"`+ State string `json:"state"`+ Visibility string `json:"visibility"`+ Pinned bool `json:"pinned"`+ ContentPath string `json:"contentPath"`+ Tags []string `json:"tags,omitempty"`+ Location *Location `json:"location,omitempty"`+ Space *Space `json:"space,omitempty"`+ Parent string `json:"parent,omitempty"`+ Relations []Relation `json:"relations,omitempty"`+ Attachments []Attachment `json:"attachments,omitempty"`+ Reactions []Reaction `json:"reactions,omitempty"`+}++// Location mirrors the public API Location message.+type Location struct {+ Placeholder string `json:"placeholder,omitempty"`+ Latitude float64 `json:"latitude"`+ Longitude float64 `json:"longitude"`+}++// Space names the Space a memo was placed in.+type Space struct {+ UID string `json:"uid"`+ Title string `json:"title,omitempty"`+}++// Relation is an outgoing REFERENCE relation.+type Relation struct {+ Type string `json:"type"`+ Memo string `json:"memo"`+}++// Attachment is one entry of a memo record's attachments list.+type Attachment struct {+ UID string `json:"uid"`+ Filename string `json:"filename"`+ Type string `json:"type"`+ Size int64 `json:"size"`+ SHA256 string `json:"sha256,omitempty"`+ Path string `json:"path,omitempty"`+ ExternalLink string `json:"externalLink,omitempty"`+ CreateTime string `json:"createTime"`+ // MediaMetadata is the public API MediaMetadata message in its proto3+ // JSON mapping. It is carried verbatim so this package needs no proto+ // dependency.+ MediaMetadata json.RawMessage `json:"mediaMetadata,omitempty"`+}++// Reaction mirrors the public API Reaction message with a username creator.+type Reaction struct {+ ReactionType string `json:"reactionType"`+ Creator string `json:"creator"`+ CreateTime string `json:"createTime,omitempty"`+}++// FormatTime renders a Unix timestamp as the archive's RFC 3339 UTC form.+func FormatTime(unix int64) string {+ return time.Unix(unix, 0).UTC().Format(time.RFC3339)+}++// ParseTime reads an archive timestamp. It accepts fractional seconds and any+// RFC 3339 offset, and returns the instant as Unix seconds.+func ParseTime(value string) (int64, error) {+ parsed, err := time.Parse(time.RFC3339Nano, value)+ if err != nil {+ return 0, err+ }+ return parsed.Unix(), nil+}++// ContentPath is the entry name writers use for a memo's content.+func ContentPath(uid string) string {+ return MemosDir + uid + ".md"+}++// RecordPath is the entry name of a memo record.+func RecordPath(uid string) string {+ return MemosDir + uid + ".json"+}++// AttachmentPath is the entry name writers use for attachment bytes.+func AttachmentPath(uid, filename string) string {+ return AttachmentsDir + uid + "/" + SafeFilename(filename)+}diff --git a/core/memoarchive/memoarchive_test.go b/core/memoarchive/memoarchive_test.gonew file mode 100644index 000000000..a61c83818--- /dev/null+++ b/core/memoarchive/memoarchive_test.go@@ -0,0 +1,427 @@+package memoarchive++import (+ "archive/zip"+ "bytes"+ "crypto/sha256"+ "encoding/hex"+ "encoding/json"+ "flag"+ "io"+ "os"+ "path/filepath"+ "testing"+ "time"++ "github.com/stretchr/testify/require"+)++var updateGolden = flag.Bool("update", false, "rewrite the golden archives under testdata")++// goldenFixture is the content of every golden archive. Changing it changes+// the golden file, so bump it deliberately.+type goldenFixture struct {+ manifest Manifest+ memos []*Memo+ contents map[string][]byte+ attachments map[string][]byte+}++// fixtureExportTime keeps golden archives byte-stable across runs.+var fixtureExportTime = time.Date(2026, 9, 16, 8, 30, 0, 0, time.UTC)++func newGoldenFixture() goldenFixture {+ photo := []byte("not really a jpeg")+ photoDigest := sha256.Sum256(photo)+ return goldenFixture{+ manifest: Manifest{+ Generator: Generator{Name: "memos", Version: "0.31.0"},+ ExportTime: "2026-09-16T08:30:00Z",+ Scope: Scope{Kind: ScopeKindUser, User: &ScopeUser{Username: "steven", DisplayName: "Steven"}},+ Counts: &Counts{Memos: 3, Attachments: 1},+ },+ memos: []*Memo{+ {+ UID: "Xy7LmN01",+ Creator: "steven",+ CreateTime: "2026-03-01T09:00:00Z",+ UpdateTime: "2026-03-01T09:00:00Z",+ State: "NORMAL",+ Visibility: "PUBLIC",+ Pinned: false,+ Tags: []string{"work"},+ },+ {+ UID: "Ab3kZ9q2",+ Creator: "steven",+ CreateTime: "2026-03-02T14:05:11Z",+ UpdateTime: "2026-03-02T14:20:47Z",+ State: "NORMAL",+ Visibility: "SPACE",+ Pinned: true,+ Tags: []string{"work", "work/q3"},+ Location: &Location{Placeholder: "Office", Latitude: 52.52, Longitude: 13.405},+ Space: &Space{UID: "team-notes", Title: "Team Notes"},+ Relations: []Relation{{Type: RelationReference, Memo: "Xy7LmN01"}},+ Attachments: []Attachment{{+ UID: "att1c9d",+ Filename: "whiteboard photo.jpg",+ Type: "image/jpeg",+ Size: int64(len(photo)),+ SHA256: hex.EncodeToString(photoDigest[:]),+ Path: AttachmentPath("att1c9d", "whiteboard photo.jpg"),+ CreateTime: "2026-03-02T14:05:30Z",+ MediaMetadata: json.RawMessage(`{"width":4032,"height":3024}`),+ }, {+ UID: "att77e0",+ Filename: "spec.pdf",+ Type: "application/pdf",+ Size: 120400,+ ExternalLink: "https://files.example.com/spec.pdf",+ CreateTime: "2026-03-02T14:06:02Z",+ }},+ Reactions: []Reaction{{ReactionType: "👍", Creator: "alice", CreateTime: "2026-03-03T09:00:00Z"}},+ },+ {+ UID: "Cm9Rt4v7",+ Creator: "steven",+ CreateTime: "2026-02-28T08:00:00Z", // older than its parent on purpose+ UpdateTime: "2026-02-28T08:00:00Z",+ State: "ARCHIVED",+ Visibility: "PRIVATE",+ Parent: "Xy7LmN01",+ },+ },+ contents: map[string][]byte{+ "Xy7LmN01": []byte("Top-level memo #work"),+ "Ab3kZ9q2": []byte("# Whiteboard\n\nSee the photo. No trailing newline"),+ "Cm9Rt4v7": []byte("A comment"),+ },+ attachments: map[string][]byte{"att1c9d": photo},+ }+}++func writeFixture(t *testing.T, fixture goldenFixture) []byte {+ t.Helper()+ var buffer bytes.Buffer+ writer := NewWriter(&buffer, fixtureExportTime)+ require.NoError(t, writer.WriteManifest(&fixture.manifest))+ for _, memo := range fixture.memos {+ for _, attachment := range memo.Attachments {+ if attachment.Path == "" {+ continue+ }+ digest, size, err := writer.WriteAttachment(attachment.Path, bytes.NewReader(fixture.attachments[attachment.UID]))+ require.NoError(t, err)+ require.Equal(t, attachment.SHA256, digest)+ require.Equal(t, attachment.Size, size)+ }+ require.NoError(t, writer.WriteMemo(memo, fixture.contents[memo.UID]))+ }+ require.NoError(t, writer.Close())+ return buffer.Bytes()+}++func readArchive(t *testing.T, data []byte) *Archive {+ t.Helper()+ archive, err := Read(bytes.NewReader(data), int64(len(data)))+ require.NoError(t, err)+ return archive+}++func requireFixtureRoundTrip(t *testing.T, fixture goldenFixture, archive *Archive) {+ t.Helper()+ require.Equal(t, Format, archive.Manifest.Format)+ require.Equal(t, FormatVersion, archive.Manifest.FormatVersion)+ require.Equal(t, fixture.manifest.Scope, archive.Manifest.Scope)+ require.Empty(t, archive.Warnings)++ uids := make([]string, 0, len(archive.Memos))+ for _, memo := range archive.Memos {+ uids = append(uids, memo.UID)+ }+ // Cm9Rt4v7 is older than its parent Xy7LmN01 but must follow it.+ require.Equal(t, []string{"Xy7LmN01", "Cm9Rt4v7", "Ab3kZ9q2"}, uids)++ byUID := make(map[string]*Memo, len(archive.Memos))+ for _, memo := range archive.Memos {+ byUID[memo.UID] = memo+ }+ for _, want := range fixture.memos {+ got := byUID[want.UID]+ require.NotNil(t, got, want.UID)+ expected := *want+ expected.ContentPath = ContentPath(want.UID)+ require.Equal(t, &expected, got)+ content, err := archive.Content(got)+ require.NoError(t, err)+ require.Equal(t, fixture.contents[want.UID], content)+ for i := range got.Attachments {+ attachment := &got.Attachments[i]+ if attachment.Path == "" {+ continue+ }+ bytesRead, err := archive.ReadAttachment(attachment)+ require.NoError(t, err)+ require.Equal(t, fixture.attachments[attachment.UID], bytesRead)+ }+ }+}++func TestRoundTrip(t *testing.T) {+ fixture := newGoldenFixture()+ data := writeFixture(t, fixture)++ reader, err := zip.NewReader(bytes.NewReader(data), int64(len(data)))+ require.NoError(t, err)+ require.Equal(t, ManifestEntry, reader.File[0].Name)+ for _, file := range reader.File {+ // macOS Archive Utility refuses an all-zero DOS date, and treats a+ // leading "mimetype" entry as an unknown document package.+ require.NotEqual(t, "mimetype", file.Name)+ require.NotZero(t, file.ModifiedDate, file.Name)+ require.Equal(t, fixtureExportTime, file.Modified.UTC(), file.Name)+ }++ requireFixtureRoundTrip(t, fixture, readArchive(t, data))+}++// TestGoldenArchives reads every golden archive ever published. A reader+// change that breaks an older archive fails here.+func TestGoldenArchives(t *testing.T) {+ fixture := newGoldenFixture()+ goldenPath := filepath.Join("testdata", "1.0", "golden.zip")+ if *updateGolden {+ require.NoError(t, os.MkdirAll(filepath.Dir(goldenPath), 0o755))+ require.NoError(t, os.WriteFile(goldenPath, writeFixture(t, fixture), 0o644))+ }+ versions, err := filepath.Glob(filepath.Join("testdata", "*", "golden.zip"))+ require.NoError(t, err)+ require.NotEmpty(t, versions, "no golden archives found; run with -update")+ for _, path := range versions {+ t.Run(filepath.Base(filepath.Dir(path)), func(t *testing.T) {+ data, err := os.ReadFile(path)+ require.NoError(t, err)+ archive := readArchive(t, data)+ if filepath.Base(filepath.Dir(path)) == FormatVersion {+ requireFixtureRoundTrip(t, fixture, archive)+ }+ })+ }+}++func TestReaderAppliesFallbacksAndIgnoresUnknowns(t *testing.T) {+ fixture := newGoldenFixture()+ memo := fixture.memos[0]+ memo.State = "DELETED"+ memo.Visibility = "SECRET"+ memo.Relations = []Relation{{Type: "FOLLOWS", Memo: "Ab3kZ9q2"}}++ memo.ContentPath = ContentPath(memo.UID)+ var buffer bytes.Buffer+ writer := NewWriter(&buffer, fixtureExportTime)+ require.NoError(t, writer.WriteManifest(&fixture.manifest))+ // Bypass the writer's validation so the record carries the unknown values.+ raw, err := json.Marshal(struct {+ *Memo+ Future string `json:"future"`+ }{Memo: memo, Future: "from a later minor"})+ require.NoError(t, err)+ entry, err := writer.zip.Create(RecordPath(memo.UID))+ require.NoError(t, err)+ _, err = entry.Write(raw)+ require.NoError(t, err)+ entry, err = writer.zip.Create(ContentPath(memo.UID))+ require.NoError(t, err)+ _, err = entry.Write([]byte("x"))+ require.NoError(t, err)+ entry, err = writer.zip.Create("extra/ignored.txt")+ require.NoError(t, err)+ _, err = entry.Write([]byte("ignored"))+ require.NoError(t, err)+ require.NoError(t, writer.Close())++ archive := readArchive(t, buffer.Bytes())+ require.Len(t, archive.Memos, 1)+ got := archive.Memos[0]+ require.Equal(t, "NORMAL", got.State)+ require.Equal(t, "PRIVATE", got.Visibility)+ require.Empty(t, got.Relations)+ messages := make([]string, 0, len(archive.Warnings))+ for _, warning := range archive.Warnings {+ messages = append(messages, warning.Message)+ }+ require.Len(t, messages, 4) // state, visibility, relation, manifest count+ require.Contains(t, messages[0], "unknown state")+ require.Contains(t, messages[1], "unknown visibility")+ require.Contains(t, messages[2], "unknown relation type")+ require.Contains(t, messages[3], "manifest counts")+}++func TestReaderRejectsUnsafeArchives(t *testing.T) {+ fixture := newGoldenFixture()+ base := writeFixture(t, fixture)++ rewrite := func(t *testing.T, mutate func(*zip.Writer, *zip.File, []byte) bool) []byte {+ t.Helper()+ reader, err := zip.NewReader(bytes.NewReader(base), int64(len(base)))+ require.NoError(t, err)+ var buffer bytes.Buffer+ writer := zip.NewWriter(&buffer)+ for _, file := range reader.File {+ rc, err := file.Open()+ require.NoError(t, err)+ content, err := io.ReadAll(rc)+ require.NoError(t, err)+ require.NoError(t, rc.Close())+ if mutate(writer, file, content) {+ continue+ }+ entry, err := writer.CreateHeader(&zip.FileHeader{Name: file.Name, Method: file.Method})+ require.NoError(t, err)+ _, err = entry.Write(content)+ require.NoError(t, err)+ }+ require.NoError(t, writer.Close())+ return buffer.Bytes()+ }++ cases := map[string]struct {+ mutate func(*zip.Writer, *zip.File, []byte) bool+ want string+ }{+ "dot-dot entry": {+ mutate: func(w *zip.Writer, f *zip.File, _ []byte) bool {+ if f.Name == ManifestEntry {+ entry, _ := w.Create("../escape.txt")+ _, _ = entry.Write([]byte("x"))+ }+ return false+ },+ want: "dot segment",+ },+ "absolute entry": {+ mutate: func(w *zip.Writer, f *zip.File, _ []byte) bool {+ if f.Name == ManifestEntry {+ entry, _ := w.Create("/etc/passwd")+ _, _ = entry.Write([]byte("x"))+ }+ return false+ },+ want: "is absolute",+ },+ "backslash entry": {+ mutate: func(w *zip.Writer, f *zip.File, _ []byte) bool {+ if f.Name == ManifestEntry {+ entry, _ := w.Create(`memos\x.md`)+ _, _ = entry.Write([]byte("x"))+ }+ return false+ },+ want: "forbidden character",+ },+ "missing manifest": {+ mutate: func(_ *zip.Writer, f *zip.File, _ []byte) bool { return f.Name == ManifestEntry },+ want: "manifest.json is missing",+ },+ "unsupported major": {+ mutate: func(w *zip.Writer, f *zip.File, content []byte) bool {+ if f.Name != ManifestEntry {+ return false+ }+ entry, _ := w.Create(ManifestEntry)+ _, _ = entry.Write(bytes.ReplaceAll(content, []byte(`"formatVersion":"1.0"`), []byte(`"formatVersion":"2.0"`)))+ return true+ },+ want: "format version 2.0 is not supported",+ },+ "uid mismatch": {+ mutate: func(w *zip.Writer, f *zip.File, content []byte) bool {+ if f.Name != RecordPath("Cm9Rt4v7") {+ return false+ }+ entry, _ := w.Create(RecordPath("Cm9Rt4v7"))+ _, _ = entry.Write(bytes.ReplaceAll(content, []byte(`"uid":"Cm9Rt4v7"`), []byte(`"uid":"Other001"`)))+ return true+ },+ want: "does not match the file name",+ },+ "content without record": {+ mutate: func(w *zip.Writer, f *zip.File, _ []byte) bool {+ if f.Name == ManifestEntry {+ entry, _ := w.Create(ContentPath("orphan01"))+ _, _ = entry.Write([]byte("x"))+ }+ return false+ },+ want: "has no memo record",+ },+ "missing attachment entry": {+ mutate: func(_ *zip.Writer, f *zip.File, _ []byte) bool {+ return f.Name == AttachmentPath("att1c9d", "whiteboard photo.jpg")+ },+ want: "attachment entry",+ },+ }+ for name, tc := range cases {+ t.Run(name, func(t *testing.T) {+ data := rewrite(t, tc.mutate)+ _, err := Read(bytes.NewReader(data), int64(len(data)))+ require.Error(t, err)+ require.Contains(t, err.Error(), tc.want)+ })+ }+}++func TestReadAttachmentVerifiesDigest(t *testing.T) {+ fixture := newGoldenFixture()+ fixture.memos[1].Attachments[0].SHA256 = hex.EncodeToString(bytes.Repeat([]byte{0xab}, 32))+ var buffer bytes.Buffer+ writer := NewWriter(&buffer, fixtureExportTime)+ require.NoError(t, writer.WriteManifest(&fixture.manifest))+ attachment := fixture.memos[1].Attachments[0]+ _, _, err := writer.WriteAttachment(attachment.Path, bytes.NewReader(fixture.attachments[attachment.UID]))+ require.NoError(t, err)+ require.NoError(t, writer.WriteMemo(fixture.memos[1], fixture.contents["Ab3kZ9q2"]))+ require.NoError(t, writer.Close())++ archive := readArchive(t, buffer.Bytes())+ _, err = archive.ReadAttachment(&archive.Memos[0].Attachments[0])+ require.ErrorContains(t, err, "digest does not match")+}++func TestSafeFilename(t *testing.T) {+ cases := map[string]string{+ "whiteboard photo.jpg": "whiteboard photo.jpg",+ "../../etc/passwd": "_.._etc_passwd",+ "a:b\\c/d.txt": "a_b_c_d.txt",+ "CON.txt": "_CON.txt",+ "lpt9": "_lpt9",+ " .hidden. ": "hidden",+ "": "file",+ "...": "file",+ "résumé.pdf": "résumé.pdf",+ "tab\there": "tab_here",+ }+ for input, want := range cases {+ require.Equal(t, want, SafeFilename(input), input)+ }+}++func TestValidateEntryName(t *testing.T) {+ require.NoError(t, ValidateEntryName("memos/a.md"))+ require.NoError(t, ValidateEntryName("attachments/x/a..b.jpg"))+ require.NoError(t, ValidateEntryName("attachments/x/résumé.pdf"))+ for _, bad := range []string{"", "/a", "a/", "a//b", "./a", "a/./b", "../a", "a/..", `a\b`, "a:b", "a\x00b", "a\x1fb", "\xff"} {+ require.Error(t, ValidateEntryName(bad), bad)+ }+}++func TestWriterRefusesRecordBeforeAttachment(t *testing.T) {+ fixture := newGoldenFixture()+ var buffer bytes.Buffer+ writer := NewWriter(&buffer, fixtureExportTime)+ require.NoError(t, writer.WriteManifest(&fixture.manifest))+ err := writer.WriteMemo(fixture.memos[1], nil)+ require.ErrorContains(t, err, "must be written before memo")+}diff --git a/core/memoarchive/path.go b/core/memoarchive/path.gonew file mode 100644index 000000000..02599e057--- /dev/null+++ b/core/memoarchive/path.go@@ -0,0 +1,92 @@+package memoarchive++import (+ "regexp"+ "strings"+ "unicode/utf8"++ "github.com/pkg/errors"++ "github.com/usememos/memos/internal/identifier"+)++// sha256Pattern is a lowercase hexadecimal SHA-256 digest.+var sha256Pattern = regexp.MustCompile(`^[0-9a-f]{64}$`)++// mediaTypePattern is an RFC 6838 type/subtype pair without parameters.+var mediaTypePattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$`)++// reservedWindowsNames are device names that Windows refuses as filenames.+var reservedWindowsNames = map[string]struct{}{+ "CON": {}, "PRN": {}, "AUX": {}, "NUL": {},+ "COM1": {}, "COM2": {}, "COM3": {}, "COM4": {}, "COM5": {}, "COM6": {}, "COM7": {}, "COM8": {}, "COM9": {},+ "LPT1": {}, "LPT2": {}, "LPT3": {}, "LPT4": {}, "LPT5": {}, "LPT6": {}, "LPT7": {}, "LPT8": {}, "LPT9": {},+}++// ValidateEntryName applies the container rules to a ZIP entry name or a+// record path member. It never repairs a name: a violation is an error so+// that an unsafe archive is rejected whole.+func ValidateEntryName(name string) error {+ if name == "" {+ return errors.New("entry name is empty")+ }+ if !utf8.ValidString(name) {+ return errors.Errorf("entry name %q is not valid UTF-8", name)+ }+ if strings.HasPrefix(name, "/") {+ return errors.Errorf("entry name %q is absolute", name)+ }+ if strings.HasSuffix(name, "/") {+ return errors.Errorf("entry name %q is a directory", name)+ }+ for _, r := range name {+ if r < 0x20 || r == '\\' || r == ':' || r == 0x7f {+ return errors.Errorf("entry name %q contains a forbidden character", name)+ }+ }+ for segment := range strings.SplitSeq(name, "/") {+ if segment == "" {+ return errors.Errorf("entry name %q contains an empty segment", name)+ }+ if segment == "." || segment == ".." {+ return errors.Errorf("entry name %q contains a dot segment", name)+ }+ }+ return nil+}++// ValidateUID checks the public resource UID grammar shared by memos,+// attachments, and Spaces.+func ValidateUID(uid string) error {+ if !identifier.UIDMatcher.MatchString(uid) {+ return errors.Errorf("invalid uid %q", uid)+ }+ return nil+}++// SafeFilename maps an attachment's original filename onto the final path+// segment of its archive entry. The mapping is deterministic so that a+// re-export of the same attachment lands at the same entry name.+func SafeFilename(filename string) string {+ var builder strings.Builder+ for _, r := range filename {+ switch {+ case r == '/' || r == '\\' || r == ':' || r < 0x20 || r == 0x7f || r == utf8.RuneError:+ builder.WriteByte('_')+ default:+ builder.WriteRune(r)+ }+ }+ safe := strings.Trim(builder.String(), " .")+ if safe == "" {+ return "file"+ }+ stem := safe+ if index := strings.IndexByte(stem, '.'); index >= 0 {+ stem = stem[:index]+ }+ if _, reserved := reservedWindowsNames[strings.ToUpper(stem)]; reserved {+ return "_" + safe+ }+ return safe+}diff --git a/core/memoarchive/reader.go b/core/memoarchive/reader.gonew file mode 100644index 000000000..ae9217c71--- /dev/null+++ b/core/memoarchive/reader.go@@ -0,0 +1,251 @@+package memoarchive++import (+ "archive/zip"+ "bytes"+ "cmp"+ "crypto/sha256"+ "encoding/hex"+ "encoding/json"+ "fmt"+ "io"+ "maps"+ "slices"+ "strings"++ "github.com/pkg/errors"+)++const (+ // maxEntries bounds the central directory a reader is willing to walk.+ maxEntries = 1_000_000+ // maxManifestBytes bounds manifest.json.+ maxManifestBytes = 1 << 20+ // maxRecordBytes bounds one memo record.+ maxRecordBytes = 4 << 20+ // maxContentBytes bounds one memo content file. Instances enforce their+ // own, smaller content length limit on import.+ maxContentBytes = 64 << 20+)++// Archive is a validated, opened Memo Archive. Memos are ordered so that a+// parent precedes its comments, then by createTime, then by UID.+type Archive struct {+ Manifest *Manifest+ Memos []*Memo+ // Warnings lists every soft deviation the reader corrected.+ Warnings []Warning++ entries map[string]*zip.File+}++// Read validates the container and loads every memo record. It fails on the+// first hard violation without returning a partial archive.+func Read(r io.ReaderAt, size int64) (*Archive, error) {+ reader, err := zip.NewReader(r, size)+ if err != nil {+ return nil, errors.Wrap(err, "not a ZIP file")+ }+ if len(reader.File) > maxEntries {+ return nil, errors.Errorf("archive has more than %d entries", maxEntries)+ }+ archive := &Archive{entries: make(map[string]*zip.File, len(reader.File))}+ for _, file := range reader.File {+ if strings.HasSuffix(file.Name, "/") && file.UncompressedSize64 == 0 {+ // Directory entries carry no data; readers must not depend on them.+ continue+ }+ if err := ValidateEntryName(file.Name); err != nil {+ return nil, err+ }+ if file.Method != zip.Store && file.Method != zip.Deflate {+ return nil, errors.Errorf("entry %q uses unsupported compression method %d", file.Name, file.Method)+ }+ if file.Flags&0x1 != 0 {+ return nil, errors.Errorf("entry %q is encrypted", file.Name)+ }+ if _, dup := archive.entries[file.Name]; dup {+ return nil, errors.Errorf("duplicate entry %q", file.Name)+ }+ archive.entries[file.Name] = file+ }++ manifest, err := archive.readManifest()+ if err != nil {+ return nil, err+ }+ archive.Manifest = manifest+ if err := archive.readMemos(); err != nil {+ return nil, err+ }+ return archive, nil+}++// Content returns the exact bytes of a memo's content file.+func (a *Archive) Content(memo *Memo) ([]byte, error) {+ return a.readEntry(memo.ContentPath, maxContentBytes)+}++// ReadAttachment returns the bytes of an attachment entry after checking+// their length and SHA-256 digest against the attachment record.+func (a *Archive) ReadAttachment(attachment *Attachment) ([]byte, error) {+ if attachment.Path == "" {+ return nil, errors.Errorf("attachment %s has no bytes in the archive", attachment.UID)+ }+ file, ok := a.entries[attachment.Path]+ if !ok {+ return nil, errors.Errorf("attachment entry %q is missing", attachment.Path)+ }+ if file.UncompressedSize64 != uint64(attachment.Size) {+ return nil, errors.Errorf("attachment %s: entry holds %d bytes but the record says %d", attachment.UID, file.UncompressedSize64, attachment.Size)+ }+ content, err := a.readEntry(attachment.Path, attachment.Size)+ if err != nil {+ return nil, err+ }+ digest := sha256.Sum256(content)+ if hex.EncodeToString(digest[:]) != attachment.SHA256 {+ return nil, errors.Errorf("attachment %s: SHA-256 digest does not match the record", attachment.UID)+ }+ return content, nil+}++func (a *Archive) readManifest() (*Manifest, error) {+ if _, ok := a.entries[ManifestEntry]; !ok {+ return nil, errors.Errorf("%s is missing", ManifestEntry)+ }+ content, err := a.readEntry(ManifestEntry, maxManifestBytes)+ if err != nil {+ return nil, err+ }+ manifest := &Manifest{}+ if err := json.Unmarshal(content, manifest); err != nil {+ return nil, errors.Wrapf(err, "%s is not valid JSON", ManifestEntry)+ }+ if err := validateManifest(manifest); err != nil {+ return nil, errors.Wrap(err, "invalid manifest")+ }+ return manifest, nil+}++func (a *Archive) readMemos() error {+ records := make(map[string]*Memo)+ contents := make(map[string]struct{})+ names := slices.Sorted(maps.Keys(a.entries))+ for _, name := range names {+ rest, ok := strings.CutPrefix(name, MemosDir)+ if !ok || strings.Contains(rest, "/") {+ // Nested entries under memos/ are reserved for later versions.+ continue+ }+ if uid, isContent := strings.CutSuffix(rest, ".md"); isContent {+ contents[uid] = struct{}{}+ continue+ }+ uid, isRecord := strings.CutSuffix(rest, ".json")+ if !isRecord {+ continue+ }+ content, err := a.readEntry(name, maxRecordBytes)+ if err != nil {+ return err+ }+ memo := &Memo{}+ if err := json.Unmarshal(content, memo); err != nil {+ return errors.Wrapf(err, "%s is not valid JSON", name)+ }+ if memo.UID != uid {+ return errors.Errorf("%s: uid %q does not match the file name", name, memo.UID)+ }+ warnings, err := validateMemo(memo)+ if err != nil {+ return err+ }+ a.Warnings = append(a.Warnings, warnings...)+ if _, ok := a.entries[memo.ContentPath]; !ok {+ return errors.Errorf("memo %s: content entry %q is missing", memo.UID, memo.ContentPath)+ }+ for _, attachment := range memo.Attachments {+ if _, ok := a.entries[attachment.Path]; attachment.Path != "" && !ok {+ return errors.Errorf("memo %s: attachment entry %q is missing", memo.UID, attachment.Path)+ }+ }+ records[memo.UID] = memo+ }+ for uid := range contents {+ if _, ok := records[uid]; !ok {+ return errors.Errorf("%s has no memo record", ContentPath(uid))+ }+ }+ if a.Manifest.Counts != nil && a.Manifest.Counts.Memos != len(records) {+ a.Warnings = append(a.Warnings, Warning{Message: fmt.Sprintf("manifest counts %d memos but the archive holds %d", a.Manifest.Counts.Memos, len(records))})+ }+ a.Memos = orderMemos(records)+ return nil+}++// orderMemos returns records with every parent ahead of its comments, then by+// createTime, then by UID. A parent that is not in the archive, or a cycle,+// leaves the record where the time order put it.+func orderMemos(records map[string]*Memo) []*Memo {+ createTimes := make(map[string]int64, len(records))+ memos := make([]*Memo, 0, len(records))+ for _, memo := range records {+ // validateMemo already accepted the timestamp.+ createTimes[memo.UID], _ = ParseTime(memo.CreateTime)+ memos = append(memos, memo)+ }+ slices.SortFunc(memos, func(a, b *Memo) int {+ return cmp.Or(cmp.Compare(createTimes[a.UID], createTimes[b.UID]), strings.Compare(a.UID, b.UID))+ })++ ordered := make([]*Memo, 0, len(memos))+ placed := make(map[string]struct{}, len(memos))+ visiting := make(map[string]struct{})+ var place func(memo *Memo)+ place = func(memo *Memo) {+ if _, done := placed[memo.UID]; done {+ return+ }+ if _, cycle := visiting[memo.UID]; cycle {+ return+ }+ visiting[memo.UID] = struct{}{}+ if parent, ok := records[memo.Parent]; ok {+ place(parent)+ }+ delete(visiting, memo.UID)+ placed[memo.UID] = struct{}{}+ ordered = append(ordered, memo)+ }+ for _, memo := range memos {+ place(memo)+ }+ return ordered+}++func (a *Archive) readEntry(name string, limit int64) ([]byte, error) {+ file, ok := a.entries[name]+ if !ok {+ return nil, errors.Errorf("entry %q is missing", name)+ }+ if file.UncompressedSize64 > uint64(limit) {+ return nil, errors.Errorf("entry %q is larger than %d bytes", name, limit)+ }+ reader, err := file.Open()+ if err != nil {+ return nil, errors.Wrapf(err, "failed to open entry %q", name)+ }+ defer reader.Close()+ var buffer bytes.Buffer+ buffer.Grow(int(file.UncompressedSize64))+ // The central directory size is untrusted; stop one byte past the limit.+ n, err := io.Copy(&buffer, io.LimitReader(reader, limit+1))+ if err != nil {+ return nil, errors.Wrapf(err, "failed to read entry %q", name)+ }+ if n > limit {+ return nil, errors.Errorf("entry %q is larger than %d bytes", name, limit)+ }+ return buffer.Bytes(), nil+}diff --git a/core/memoarchive/testdata/1.0/golden.zip b/core/memoarchive/testdata/1.0/golden.zipnew file mode 100644index 000000000..0c6240cefBinary files /dev/null and b/core/memoarchive/testdata/1.0/golden.zip differdiff --git a/core/memoarchive/validate.go b/core/memoarchive/validate.gonew file mode 100644index 000000000..84712c23d--- /dev/null+++ b/core/memoarchive/validate.go@@ -0,0 +1,188 @@+package memoarchive++import (+ "fmt"+ "strconv"+ "strings"++ "github.com/pkg/errors"+)++// Warning records a recoverable deviation found while reading a record. The+// reader applies the documented fallback and continues.+type Warning struct {+ UID string+ Message string+}++func (w Warning) String() string {+ if w.UID == "" {+ return w.Message+ }+ return w.UID + ": " + w.Message+}++var (+ knownStates = map[string]struct{}{"NORMAL": {}, "ARCHIVED": {}}+ knownVisibilities = map[string]struct{}{"PRIVATE": {}, "PROTECTED": {}, "PUBLIC": {}, "SPACE": {}}+)++// parseFormatVersion splits MAJOR.MINOR.+func parseFormatVersion(version string) (int, int, error) {+ major, minor, ok := strings.Cut(version, ".")+ if !ok {+ return 0, 0, errors.Errorf("formatVersion %q is not MAJOR.MINOR", version)+ }+ majorNumber, err := strconv.Atoi(major)+ if err != nil || majorNumber < 0 {+ return 0, 0, errors.Errorf("formatVersion %q has an invalid major version", version)+ }+ minorNumber, err := strconv.Atoi(minor)+ if err != nil || minorNumber < 0 {+ return 0, 0, errors.Errorf("formatVersion %q has an invalid minor version", version)+ }+ return majorNumber, minorNumber, nil+}++func validateManifest(manifest *Manifest) error {+ if manifest.Format != Format {+ return errors.Errorf("format %q is not %q", manifest.Format, Format)+ }+ major, _, err := parseFormatVersion(manifest.FormatVersion)+ if err != nil {+ return err+ }+ if major != FormatMajor {+ return errors.Errorf("format version %s is not supported by this reader (supports %d.x)", manifest.FormatVersion, FormatMajor)+ }+ if manifest.Generator.Name == "" || manifest.Generator.Version == "" {+ return errors.New("generator name and version are required")+ }+ if _, err := ParseTime(manifest.ExportTime); err != nil {+ return errors.Wrap(err, "exportTime is invalid")+ }+ if manifest.Scope.Kind == "" {+ return errors.New("scope.kind is required")+ }+ if manifest.Scope.Kind == ScopeKindUser && (manifest.Scope.User == nil || manifest.Scope.User.Username == "") {+ return errors.New("scope.user.username is required for a USER archive")+ }+ if manifest.Counts != nil && (manifest.Counts.Memos < 0 || manifest.Counts.Attachments < 0) {+ return errors.New("counts must not be negative")+ }+ return nil+}++// validateMemo checks the hard rules of a memo record and applies the+// documented fallbacks for soft ones, returning a warning for each fallback.+func validateMemo(memo *Memo) ([]Warning, error) {+ if err := ValidateUID(memo.UID); err != nil {+ return nil, err+ }+ fail := func(format string, args ...any) error {+ return errors.Errorf("memo %s: %s", memo.UID, fmt.Sprintf(format, args...))+ }+ if memo.Creator == "" {+ return nil, fail("creator is required")+ }+ if _, err := ParseTime(memo.CreateTime); err != nil {+ return nil, fail("createTime is invalid: %v", err)+ }+ if _, err := ParseTime(memo.UpdateTime); err != nil {+ return nil, fail("updateTime is invalid: %v", err)+ }+ if memo.ContentPath == "" {+ return nil, fail("contentPath is required")+ }+ if err := ValidateEntryName(memo.ContentPath); err != nil {+ return nil, fail("contentPath: %v", err)+ }+ if memo.Parent != "" {+ if err := ValidateUID(memo.Parent); err != nil {+ return nil, fail("parent: %v", err)+ }+ if memo.Parent == memo.UID {+ return nil, fail("parent must not be the memo itself")+ }+ }+ if memo.Space != nil {+ if err := ValidateUID(memo.Space.UID); err != nil {+ return nil, fail("space: %v", err)+ }+ }+ if memo.Location != nil {+ if memo.Location.Latitude < -90 || memo.Location.Latitude > 90 || memo.Location.Longitude < -180 || memo.Location.Longitude > 180 {+ return nil, fail("location is out of range")+ }+ }++ var warnings []Warning+ if _, ok := knownStates[memo.State]; !ok {+ warnings = append(warnings, Warning{UID: memo.UID, Message: fmt.Sprintf("unknown state %q, using NORMAL", memo.State)})+ memo.State = "NORMAL"+ }+ if _, ok := knownVisibilities[memo.Visibility]; !ok {+ warnings = append(warnings, Warning{UID: memo.UID, Message: fmt.Sprintf("unknown visibility %q, using PRIVATE", memo.Visibility)})+ memo.Visibility = "PRIVATE"+ }++ relations := memo.Relations[:0]+ for _, relation := range memo.Relations {+ if relation.Type != RelationReference {+ warnings = append(warnings, Warning{UID: memo.UID, Message: fmt.Sprintf("unknown relation type %q, skipping relation", relation.Type)})+ continue+ }+ if err := ValidateUID(relation.Memo); err != nil {+ return nil, fail("relation: %v", err)+ }+ relations = append(relations, relation)+ }+ memo.Relations = relations++ seenAttachmentUIDs := make(map[string]struct{}, len(memo.Attachments))+ for index := range memo.Attachments {+ attachment := &memo.Attachments[index]+ if err := ValidateUID(attachment.UID); err != nil {+ return nil, fail("attachment: %v", err)+ }+ if _, dup := seenAttachmentUIDs[attachment.UID]; dup {+ return nil, fail("attachment %s is listed twice", attachment.UID)+ }+ seenAttachmentUIDs[attachment.UID] = struct{}{}+ if attachment.Filename == "" {+ return nil, fail("attachment %s: filename is required", attachment.UID)+ }+ if !mediaTypePattern.MatchString(attachment.Type) {+ return nil, fail("attachment %s: type %q is not a media type", attachment.UID, attachment.Type)+ }+ if attachment.Size < 0 {+ return nil, fail("attachment %s: size must not be negative", attachment.UID)+ }+ if _, err := ParseTime(attachment.CreateTime); err != nil {+ return nil, fail("attachment %s: createTime is invalid: %v", attachment.UID, err)+ }+ switch {+ case attachment.Path != "" && attachment.ExternalLink != "":+ return nil, fail("attachment %s: path and externalLink are mutually exclusive", attachment.UID)+ case attachment.Path != "":+ if err := ValidateEntryName(attachment.Path); err != nil {+ return nil, fail("attachment %s: path: %v", attachment.UID, err)+ }+ if !strings.HasPrefix(attachment.Path, AttachmentsDir) {+ return nil, fail("attachment %s: path must be under %s", attachment.UID, AttachmentsDir)+ }+ if !sha256Pattern.MatchString(attachment.SHA256) {+ return nil, fail("attachment %s: sha256 is required with path", attachment.UID)+ }+ case attachment.ExternalLink != "":+ default:+ return nil, fail("attachment %s: one of path or externalLink is required", attachment.UID)+ }+ }+ for _, reaction := range memo.Reactions {+ if reaction.ReactionType == "" || reaction.Creator == "" {+ return nil, fail("reaction requires reactionType and creator")+ }+ }+ return warnings, nil+}diff --git a/core/memoarchive/writer.go b/core/memoarchive/writer.gonew file mode 100644index 000000000..81a48cfe2--- /dev/null+++ b/core/memoarchive/writer.go@@ -0,0 +1,145 @@+package memoarchive++import (+ "archive/zip"+ "crypto/sha256"+ "encoding/hex"+ "encoding/json"+ "io"+ "strings"+ "time"++ "github.com/pkg/errors"+)++// Writer streams a Memo Archive to an io.Writer. Entries are written in the+// order the caller supplies them, so a caller that wants attachment digests+// in a memo record writes the attachment bytes before the record.+type Writer struct {+ zip *zip.Writer+ modified time.Time+ wroteManifest bool+ seen map[string]struct{}+}++// NewWriter starts an archive on w. Every entry is stamped with modified,+// normally the export time; the zero time means now. A real timestamp+// matters because some extractors refuse the all-zero MS-DOS date that an+// unset time produces.+func NewWriter(w io.Writer, modified time.Time) *Writer {+ if modified.IsZero() {+ modified = time.Now()+ }+ return &Writer{zip: zip.NewWriter(w), modified: modified.UTC(), seen: map[string]struct{}{}}+}++// WriteManifest writes manifest.json. It fills in the format name and+// version, and must be called exactly once.+func (w *Writer) WriteManifest(manifest *Manifest) error {+ if w.wroteManifest {+ return errors.New("manifest already written")+ }+ if manifest == nil {+ return errors.New("manifest is required")+ }+ record := *manifest+ record.Format = Format+ record.FormatVersion = FormatVersion+ if err := validateManifest(&record); err != nil {+ return err+ }+ if err := w.writeJSON(ManifestEntry, &record); err != nil {+ return err+ }+ w.wroteManifest = true+ return nil+}++// WriteMemo writes a memo record and its content file. The record's+// contentPath is set to the conventional location. Attachment entries that+// carry a path must already have been written with WriteAttachment.+func (w *Writer) WriteMemo(memo *Memo, content []byte) error {+ if memo == nil {+ return errors.New("memo record is required")+ }+ record := *memo+ record.ContentPath = ContentPath(record.UID)+ if _, err := validateMemo(&record); err != nil {+ return err+ }+ for _, attachment := range record.Attachments {+ if attachment.Path == "" {+ continue+ }+ if _, ok := w.seen[attachment.Path]; !ok {+ return errors.Errorf("attachment entry %q must be written before memo %s", attachment.Path, record.UID)+ }+ }+ if err := w.writeJSON(RecordPath(record.UID), &record); err != nil {+ return err+ }+ entry, err := w.create(record.ContentPath, zip.Deflate)+ if err != nil {+ return err+ }+ if _, err := entry.Write(content); err != nil {+ return errors.Wrapf(err, "failed to write content of memo %s", record.UID)+ }+ return nil+}++// WriteAttachment copies attachment bytes into the entry at path and returns+// the digest and length it observed, which the caller records on the+// attachment entry.+func (w *Writer) WriteAttachment(path string, content io.Reader) (string, int64, error) {+ if !strings.HasPrefix(path, AttachmentsDir) {+ return "", 0, errors.Errorf("attachment entry %q must be under %s", path, AttachmentsDir)+ }+ entry, err := w.create(path, zip.Deflate)+ if err != nil {+ return "", 0, err+ }+ digest := sha256.New()+ size, err := io.Copy(io.MultiWriter(entry, digest), content)+ if err != nil {+ return "", 0, errors.Wrapf(err, "failed to write attachment entry %q", path)+ }+ return hex.EncodeToString(digest.Sum(nil)), size, nil+}++// Close finishes the central directory. The archive is unusable until Close+// returns nil.+func (w *Writer) Close() error {+ if !w.wroteManifest {+ return errors.New("manifest was not written")+ }+ return w.zip.Close()+}++func (w *Writer) writeJSON(name string, value any) error {+ entry, err := w.create(name, zip.Deflate)+ if err != nil {+ return err+ }+ encoder := json.NewEncoder(entry)+ encoder.SetEscapeHTML(false)+ if err := encoder.Encode(value); err != nil {+ return errors.Wrapf(err, "failed to encode %s", name)+ }+ return nil+}++func (w *Writer) create(name string, method uint16) (io.Writer, error) {+ if err := ValidateEntryName(name); err != nil {+ return nil, err+ }+ if _, dup := w.seen[name]; dup {+ return nil, errors.Errorf("duplicate entry %q", name)+ }+ w.seen[name] = struct{}{}+ entry, err := w.zip.CreateHeader(&zip.FileHeader{Name: name, Method: method, Modified: w.modified})+ if err != nil {+ return nil, errors.Wrapf(err, "failed to create entry %q", name)+ }+ return entry, nil+}diff --git a/docs/design/api-abuse-controls.md b/docs/design/api-abuse-controls.mdindex 82f6c72cd..10c5708be 100644--- a/docs/design/api-abuse-controls.md+++ b/docs/design/api-abuse-controls.md@@ -115,6 +115,7 @@ A `ratelimit.Policy` is a table. Each row names a scope, the kind of key it is c| `upload_user` | user id | upload start, `CreateAttachment` | every start | 120 per minute || `transcribe_user` | user id | `Transcribe` | every call | 20 per hour || `write_user` | user id | memo, comment, reaction, share, memo-view, and webhook creation | every call | 120 per minute |+| `archive_user` | user id | `ExportMemos`, `ImportMemos` upload start | every call | 10 per hour |The two catch-all scopes are what make the table complete: a procedure nobody thought to list is still bounded. The specific scopes sit on top with tighter numbers. A request can therefore be refused by either its catch-all or its specific scope, and the first refusal wins.diff --git a/docs/design/memo-archive-format.md b/docs/design/memo-archive-format.mdnew file mode 100644index 000000000..06327aaf6--- /dev/null+++ b/docs/design/memo-archive-format.md@@ -0,0 +1,290 @@+# Memo Archive Format++Status: Proposed++Date: 2026-09-16++Existing domain language: [Memos context](../../CONTEXT.md)++Related: [Multi-Spaces Design](multi-spaces.md), [ADR 0002: Username Format and References](../adr/0002-username-format-and-references.md), [ADR 0003: Space UID Allocation and Format](../adr/0003-space-uid-allocation-and-format.md)++Normative schemas: [`memo-archive/1.0/manifest.schema.json`](memo-archive/1.0/manifest.schema.json), [`memo-archive/1.0/memo.schema.json`](memo-archive/1.0/memo.schema.json)++## Summary++A Memo Archive is a ZIP container that carries one user's memos and their attachments out of a Memos instance and back into a Memos instance running the same or a later release. It is the single format for personal export, personal import, and migration between instances or database backends.++The format is built only from published standards and the public API's own vocabulary. The container is a plain ZIP file as specified by the PKWARE APPNOTE, identified by its manifest. Records are RFC 8259 JSON documents that use the proto3 JSON mapping of the public API messages, so every field name, enum string, and timestamp form is one a client already sees on the wire. Memo content is stored as untouched bytes in a separate Markdown file. Two JSON Schema documents are the normative definition of the records; this document explains them and defines the container and the import semantics that the schemas cannot express.++## Goals++- A memo exported by any Memos release imports into that release and into every later release.+- Importing the same archive twice into the same instance yields the same state as importing it once.+- Moving memos between instances, database backends, or accounts on one instance needs nothing beyond export and import.+- Every field a memo owns through the public API round-trips: content, timestamps, state, visibility, pinned, location, Space placement, references, comment threading, and attachment bytes.+- The format is defined by this document and its schemas, not by Go types, protobuf descriptors, or database rows, so that code refactors cannot change it unintentionally.+- A general-purpose ZIP tool can open the archive and a person can read its contents without Memos.++## Non-goals++- Interoperability with other note-taking products. The archive is written by Memos and read by Memos. Content files are Markdown because memo content is Markdown, not as a portability feature.+- Instance backup. Users, settings, tokens, webhooks, identity providers, and Spaces themselves are not in the archive.+- Exporting other users' memos, comments, or reactions. Version 1.0 archives are personal. The schema reserves room for multi-author archives so that an instance-level export is an additive change.+- Preserving revision history, soft-deleted memos, or share links.+- Encryption or signing.+- A scheduled or continuous writer. The archive is produced on demand.++## Research++The design reuses established specifications rather than inventing encodings. Each choice below names the standard it follows.++| Concern | Standard | Applied as |+| --- | --- | --- |+| Container | PKWARE APPNOTE 6.3.10 (ZIP) | Methods Store (0) and Deflate (8), UTF-8 names via the language encoding flag (bit 11), ZIP64 permitted. |+| Self-identification | RFC 8259 JSON manifest | `manifest.json` carries `format` and `formatVersion`. A leading `mimetype` entry in the EPUB and OpenDocument manner was tried and rejected: macOS Archive Utility recognizes that signature, sees an unknown vendor type, and refuses to expand the file. |+| Media type | RFC 6838 §3.2 vendor tree | `application/vnd.usememos.archive+zip` for the container; attachment types are IANA media types. |+| Records | RFC 8259 (JSON), UTF-8 without byte order mark | One JSON document per memo plus one manifest. |+| Record vocabulary | Protocol Buffers proto3 JSON mapping | lowerCamelCase field names, enum names as strings, timestamps as RFC 3339 strings. |+| Timestamps | RFC 3339 §5.6 `date-time` | UTC with `Z` designator. |+| Schema | JSON Schema 2020-12 | Normative `manifest.schema.json` and `memo.schema.json`. |+| Digest | FIPS 180-4 SHA-256 | Lowercase hexadecimal, 64 characters. |+| Path safety | CWE-22 (path traversal in archive extraction, "zip slip") | Entry names are validated, never sanitized; violations reject the archive. |+| Download | RFC 6266 `Content-Disposition` | `attachment; filename*=UTF-8''memos-archive-….zip`. |++The container is deliberately an ordinary ZIP file so that every desktop extractor opens it with a double click. The record conventions come from the API the archive mirrors, so the archive needs no vocabulary of its own.++## Proposed design++### Container layout++```+memos-archive-<username>-<YYYYMMDDTHHMMSSZ>.zip+├── manifest.json first entry, archive-level record+├── memos/+│ ├── <memo-uid>.json memo record+│ ├── <memo-uid>.md memo content, byte-identical+│ └── ...+└── attachments/+ └── <attachment-uid>/<filename>+```++Container rules:++- The archive identifies itself through `manifest.json`, which writers place first. Readers locate it by name, not by position. Writers never emit an entry named `mimetype`, because extractors that implement the EPUB and OpenDocument package signature refuse a package whose media type they do not know.+- Every entry name is UTF-8, with the language encoding flag set whenever the name is not ASCII, uses `/` as the separator, and is a relative path. Names never contain a `.` or `..` segment, a leading `/`, a backslash, a colon, a NUL, or any C0 control character. Readers reject the whole archive on a violation rather than repairing it.+- Every entry name is ASCII except the final segment of an `attachments/` path, which may be any UTF-8 name that passes the rules above.+- Compression methods are Store (0) and Deflate (8). ZIP64 structures are permitted for size or entry count. Encryption, spanning, and other methods are not.+- Readers ignore entries and directories they do not recognize. Writers may add entries in later minor versions.+- A memo record and its content file share the memo UID as basename. Neither appears without the other.+- Directory entries are optional. Readers must not depend on their presence.+- Every entry carries the archive's `exportTime` as its modification time, in the MS-DOS date and time fields and in the extended timestamp extra field. An all-zero MS-DOS date is never written because some extractors, macOS Archive Utility among them, refuse it.++### Identifiers++- A memo is identified by its Memo UID, the `{memo}` segment of `memos/{memo}`, matching `^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$`. An attachment is identified by the `{attachment}` segment of `attachments/{attachment}`, which uses the same grammar. A Space is identified by its Space UID under ADR 0003 and carries its Space title for fallback matching. Database identifiers never appear.+- A user is identified by username under ADR 0002.+- References inside the archive are bare UIDs, never resource names, so the resource name patterns of the API can change without a format change.++### Records++Every record is an RFC 8259 JSON text encoded as UTF-8 without a byte order mark. Records follow the proto3 JSON mapping: field names are lowerCamelCase, enum values are their proto names as strings, timestamps are RFC 3339 `date-time` strings, and fields with default or empty values may be omitted.++Timestamps are always UTC with the `Z` designator, for example `2026-09-16T08:30:00Z`. Writers emit whole seconds. Readers accept fractional seconds.++Enum values are the public API strings: `state` is `NORMAL` or `ARCHIVED`; `visibility` is `PRIVATE`, `PROTECTED`, `PUBLIC`, or `SPACE`; relation `type` is `REFERENCE`. A reader that meets an unknown value applies the documented fallback for that field, records a warning, and continues. Fallbacks are `NORMAL` for `state`, `PRIVATE` for `visibility`, and skipping the relation for `type`.++Readers ignore unknown members in any object. This is what lets a minor version add fields.++#### manifest.json++```json+{+ "format": "memos-archive",+ "formatVersion": "1.0",+ "generator": { "name": "memos", "version": "0.31.0" },+ "exportTime": "2026-09-16T08:30:00Z",+ "scope": {+ "kind": "USER",+ "user": { "username": "steven", "displayName": "Steven" }+ },+ "counts": { "memos": 1834, "attachments": 212 }+}+```++| Field | Required | Meaning |+| --- | --- | --- |+| `format` | yes | Always `memos-archive`. Readers reject any other value. |+| `formatVersion` | yes | `MAJOR.MINOR`. See versioning. |+| `generator` | yes | The software that wrote the archive. Diagnostic only. |+| `exportTime` | yes | When the archive was written. |+| `scope.kind` | yes | `USER` in 1.0. Reserved for later minors: `INSTANCE`, `SPACE`, `SELECTION`. |+| `scope.user` | when kind is `USER` | The user whose memos the archive holds. |+| `counts` | no | Number of memo records and attachment entries. Lets readers detect truncation and report progress. |++The manifest carries no per-memo index. The `memos/` directory is the index, which keeps the manifest constant-size and lets writers and readers stream.++#### memos/{uid}.json++```json+{+ "uid": "Ab3kZ9q2",+ "creator": "steven",+ "createTime": "2026-03-02T14:05:11Z",+ "updateTime": "2026-03-02T14:20:47Z",+ "state": "NORMAL",+ "visibility": "SPACE",+ "pinned": true,+ "contentPath": "memos/Ab3kZ9q2.md",+ "tags": ["work", "work/q3"],+ "location": { "placeholder": "Office", "latitude": 52.52, "longitude": 13.405 },+ "space": { "uid": "team-notes", "title": "Team Notes" },+ "parent": "Xy7LmN01",+ "relations": [+ { "type": "REFERENCE", "memo": "Qr5TuV88" }+ ],+ "attachments": [+ {+ "uid": "att1c9d",+ "filename": "whiteboard photo.jpg",+ "type": "image/jpeg",+ "size": 482113,+ "sha256": "74a8b503a0dda2a74b87912bd7a61a9f412079a0166f07b565ee736146e67c00",+ "path": "attachments/att1c9d/whiteboard photo.jpg",+ "createTime": "2026-03-02T14:05:30Z",+ "mediaMetadata": { "width": 4032, "height": 3024 }+ },+ {+ "uid": "att77e0",+ "filename": "spec.pdf",+ "type": "application/pdf",+ "size": 120400,+ "externalLink": "https://files.example.com/spec.pdf",+ "createTime": "2026-03-02T14:06:02Z"+ }+ ],+ "reactions": [+ { "reactionType": "👍", "creator": "alice", "createTime": "2026-03-03T09:00:00Z" }+ ]+}+```++| Field | Required | Round-trips | Notes |+| --- | --- | --- | --- |+| `uid` | yes | yes | Import key. Must equal the file basename. |+| `creator` | yes | no in 1.0 | Username at export time. In a `USER` archive it equals `scope.user.username`. Present so multi-author archives are additive. |+| `createTime`, `updateTime` | yes | yes | Both are caller-settable on memo creation in the public API. |+| `state` | yes | yes | |+| `visibility` | yes | yes | `SPACE` requires a resolvable `space`; otherwise the importer falls back to `PRIVATE` with a warning. |+| `pinned` | yes | yes | |+| `contentPath` | yes | yes | Archive path of the content file. Writers use `memos/<uid>.md`. Readers follow the field, never the convention, so a minor version can move the layout. |+| `tags` | no | derived | Informational. Tags are derived from content on import; readers never write them. |+| `location` | no | yes | Mirrors the API `Location` message. `latitude` and `longitude` are WGS 84 decimal degrees. |+| `space` | no | best effort | Matched by `uid`, then by `title` among Spaces the importer is a member of, else the memo is imported Unassigned. |+| `parent` | no | yes | UID of the memo this one comments on. A record with `parent` is a comment. This is the archive's representation of the API's immutable `COMMENT` relation. |+| `relations` | no | yes | Outgoing `REFERENCE` relations only. |+| `attachments` | no | yes | Presentation order. See the attachment entry below. |+| `reactions` | no | no in 1.0 | Informational. Mirrors the API `Reaction` message with `creator` as a username. |++#### memos/{uid}.md++The exact bytes of the memo `content` field: UTF-8, no byte order mark, no added trailing newline, no front matter, no rewriting of links or attachment references. Byte identity is what lets a re-import reproduce the memo exactly, and it means a future change to how Memos parses content never invalidates an old archive: the importer stores the bytes and the current parser derives tags and properties from them, exactly as for a memo created through the API.++#### Attachment entry++| Field | Required | Notes |+| --- | --- | --- |+| `uid` | yes | Attachment UID. |+| `filename` | yes | Original filename, authoritative. The archive path may differ after the safe-name mapping. |+| `type` | yes | IANA media type, for example `image/jpeg`. |+| `size` | yes | Byte length of the content. |+| `sha256` | when `path` is present | Lowercase hexadecimal SHA-256 of the bytes. Used for integrity and to skip uploading bytes the instance already holds. |+| `path` | one of `path`, `externalLink` | Archive entry holding the bytes. Always `attachments/<uid>/<safe-filename>`. |+| `externalLink` | one of `path`, `externalLink` | External attachments carry no bytes. |+| `createTime` | yes | Informational in 1.0 because attachment creation time is output-only in the API. Preserved so importers can apply it once the API accepts it. |+| `mediaMetadata` | no | The API `MediaMetadata` message in its JSON mapping. Informational; the importer re-derives it from the bytes. |++The safe filename is `filename` after replacing each `/`, `\`, `:`, NUL, and C0 control character with `_`, trimming leading and trailing spaces and dots, prefixing `_` when the stem is a reserved Windows device name (`CON`, `PRN`, `AUX`, `NUL`, `COM1` to `COM9`, `LPT1` to `LPT9`), and substituting `file` when the result is empty. Writers apply the mapping; readers only validate the container rules and rely on `filename`.++An attachment belongs to exactly one memo record. Attachments not linked to any memo are not exported.++### Import semantics++The importer's behavior is part of the format. An archive only survives a release if the release still does this with it.++1. Validate. `manifest.json` exists, `format` is `memos-archive`, the major version is supported, every entry name passes the container rules, and every record validates against its schema. Any failure aborts before anything is written.+2. Load memo records. Order so that parents precede comments, then by `createTime`.+3. Resolve each UID:+ - No memo has that UID: create it with that UID.+ - A memo with that UID exists and the importing user created it: apply the conflict policy, `SKIP` (default), `REPLACE` (update content and metadata), or `DUPLICATE` (create under a fresh UID).+ - A memo with that UID exists and someone else created it: create under a fresh UID and record the mapping.+4. Create the memo with `content`, `createTime`, `updateTime`, `state`, `visibility`, `pinned`, `location`, and the resolved `space`. The importing user is the creator regardless of `creator`.+5. Attachments. Each entry is stored through the same pipeline as an upload: the media type is re-sniffed, EXIF is stripped, and the upload size limit applies. An entry keeps its UID unless an attachment with that UID already exists; an existing unlinked attachment owned by the importer with the same bytes is bound instead of copied, and any other collision gets a fresh UID. Entries with only `externalLink` become external attachments. `mediaMetadata` is applied as client-supplied metadata would be.+6. Pinned and the `ARCHIVED` state are applied in a second write after creation, as they are for a memo created through the API, with the record's `updateTime` preserved.+7. After every record exists, apply `parent` and `relations` through the UID mapping. A target that exists neither in the archive nor on the instance, or that the importer may not read, is dropped with a warning; a memo whose parent is dropped is imported as a top-level memo. `REPLACE` never changes the parent of an existing memo because comment threading is immutable.+8. Report counts of created, updated, skipped, and failed records with reasons, plus warnings.++A record fails, and the rest continue, when its content exceeds the instance limit, an attachment entry does not match its digest or exceeds the upload limit, or a managed image reference in the content names an attachment that had to change UID. Attachments created for a record that then fails are removed again.++Because step 3 keys on the UID, running the same archive twice produces the same instance state.++### Export semantics++- The exporter writes only memos the requesting user created and attachments linked to them. No administrator bypass exists.+- The response carries `Content-Type: application/vnd.usememos.archive+zip` and an RFC 6266 `Content-Disposition` with the archive filename.+- The archive filename is `memos-archive-<username>-<YYYYMMDDTHHMMSSZ>.zip`, where the timestamp is the RFC 3339 basic form of `exportTime`.+- Export and import run under the same authentication as the rest of the API and count against a dedicated rate-limit scope.++### Transport++Both operations are RPCs on `UserService`, scoped to the user whose memos they touch. Only that user may call them. They pass through the same authentication, access policy, rate limiting, and error shape as every other API method and appear in the generated clients and OpenAPI document. The `archive_user` rate-limit scope counts each export and each import start.++| RPC | Route | Behavior |+| --- | --- | --- |+| `ExportMemos` | `GET /api/v1/{name=users/*}:exportMemos` | Returns `google.api.HttpBody` whose `content_type` is the archive media type and whose `data` is the archive. Over the REST gateway the response body is the raw ZIP. |+| `ImportMemos` | `POST /api/v1/{name=users/*}:importMemos` | The chunked upload protocol shared with `UploadAttachment`: the first call carries `spec.total_size` and returns an `upload_id`, later calls carry `upload_id`, `write_offset`, and `data`. A finishing call (`finish_write`) with `validate_only` validates the staged archive and returns a `MemoImportPlan`; a finishing call without it imports with `conflict_policy` and returns a `MemoImportReport`. A finished upload keeps answering with its report. Staged archives expire after thirty minutes of inactivity and do not survive a restart. |++The plan carries the manifest's export time, exporter, and generator, the archive's memo and attachment counts, how many memos are `new`, `existing` (already the caller's), or `renamed` (UID held by another account), and the reader's warnings. The report carries `created`, `updated`, `skipped`, and `failed` counts with `warnings` and `failures`, each tied to the archive memo UID where there is one. `conflict_policy` is `SKIP` (default), `REPLACE`, or `DUPLICATE`.++The web client offers both operations under Settings, Export & Import. Import is a three-step flow: the user chooses a file, the client uploads it once and finishes with `validate_only` to show the plan, and the conflict policy is asked for only when `existing` is greater than zero. Confirming sends one more finishing call on the same upload. An expired upload returns to the file picker.++### Versioning and evolution++`formatVersion` is `MAJOR.MINOR`.++- Readers accept any minor version of a major they know. A 1.0 reader accepts a 1.7 archive; it ignores members and entries it does not understand and applies the enum fallbacks above.+- Readers refuse a major version they do not know with a message naming both versions.+- Writers emit the newest version they implement.++A change is a minor bump when it only adds optional members, adds entries, adds enum values whose documented fallback is acceptable for older readers, or adds `scope.kind` values. Everything else is a major bump: removing or renaming a member, changing a member's type or meaning, changing the container rules, making an optional member required, or adding an enum value whose fallback would silently change meaning.++Within a major version a member is never removed. A member that stops being useful is marked deprecated in the schema and writers keep emitting it.++Each version has its own schema directory, `docs/design/memo-archive/<MAJOR.MINOR>/`, and a golden archive under test data. CI validates every golden archive against its schema and imports every golden archive ever published, so a reader regression against an older version fails the build.++### Security invariants++- Container rules are validated, not sanitized, on read. An archive with one unsafe entry name is rejected whole.+- Content files are stored as Markdown text and never interpreted as HTML by the importer.+- The importer re-sniffs each attachment's media type on upload exactly as a normal upload does. The recorded `type` is a hint, not an instruction.+- The exporter includes only the requesting user's memos and their attachments.+- Record size, entry count, and total uncompressed size are bounded on import to defend against decompression bombs.++## Alternatives considered++- **Front matter inside each Markdown file.** Rejected. It changes the content bytes, needs escaping rules for content that itself begins with `---`, and creates a metadata dialect Memos would have to maintain forever.+- **One manifest holding every record.** Rejected. It cannot be streamed, a truncated archive loses everything, and a per-record layout is just as simple for a reader that iterates `memos/*.json`.+- **JSON Lines of protojson-encoded API messages.** Rejected. protojson output tracks the proto descriptors, so a renamed field or reserved number changes the format without anyone deciding to change it. The archive borrows the proto3 JSON conventions but owns its schema.+- **An existing container such as ENEX or TextBundle.** Rejected. Neither models visibility, pinning, Spaces, or comment threading, so Memos would carry its metadata in an extension block and inherit a parser it does not need.+- **A SQLite file.** Rejected. That is a database backup, tied to the schema.+- **Tar instead of ZIP.** Rejected. ZIP has random access through its central directory and universal desktop support.+- **A leading `mimetype` entry as in EPUB and OpenDocument.** Rejected after testing. macOS Archive Utility treats that signature as a document package and reports an unsupported format for any media type it does not know, so the archive could not be expanded with a double click.++## Deferred design++- `scope.kind` of `INSTANCE` and `SPACE`, carrying memos from many creators and adding a `users/` directory of creator records. The `creator` member on every record exists so this is additive.+- Applying `attachments[].createTime` on import once the API accepts a creation time on attachment creation.+- Importing reactions and other users' comments, which needs an administrator-scoped importer.+- Soft-deleted memos, which add a `DELETED` state value as a minor bump only if importers can safely treat it as `NORMAL` plus a warning, otherwise as a major.+- A `SELECTION` scope for a filtered subset, for example one Space or one tag, using the same record layout.+- Persisting a content digest on stored attachments so that import can find identical bytes anywhere in the account instead of only under the same UID.+- Firing memo webhooks and mention notifications for imported memos. An import currently publishes one live-refresh event and nothing else.diff --git a/docs/design/memo-archive/1.0/manifest.schema.json b/docs/design/memo-archive/1.0/manifest.schema.jsonnew file mode 100644index 000000000..19b7cca02--- /dev/null+++ b/docs/design/memo-archive/1.0/manifest.schema.json@@ -0,0 +1,73 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "$id": "https://usememos.com/schemas/memo-archive/1.0/manifest.schema.json",+ "title": "Memo Archive manifest",+ "description": "Archive-level record stored at manifest.json in a Memo Archive. Unknown members are permitted so that later minor versions can add fields.",+ "type": "object",+ "required": ["format", "formatVersion", "generator", "exportTime", "scope"],+ "properties": {+ "format": {+ "const": "memos-archive"+ },+ "formatVersion": {+ "type": "string",+ "pattern": "^1\\.[0-9]+$",+ "description": "MAJOR.MINOR. Readers accept any minor version of a major they know."+ },+ "generator": {+ "type": "object",+ "required": ["name", "version"],+ "properties": {+ "name": { "type": "string", "minLength": 1 },+ "version": { "type": "string", "minLength": 1 }+ }+ },+ "exportTime": {+ "$ref": "#/$defs/timestamp"+ },+ "scope": {+ "type": "object",+ "required": ["kind"],+ "properties": {+ "kind": {+ "type": "string",+ "description": "USER in 1.0. INSTANCE, SPACE, and SELECTION are reserved for later minor versions."+ },+ "user": {+ "type": "object",+ "required": ["username"],+ "properties": {+ "username": { "$ref": "#/$defs/username" },+ "displayName": { "type": "string" }+ }+ }+ },+ "if": {+ "properties": { "kind": { "const": "USER" } }+ },+ "then": {+ "required": ["user"]+ }+ },+ "counts": {+ "type": "object",+ "properties": {+ "memos": { "type": "integer", "minimum": 0 },+ "attachments": { "type": "integer", "minimum": 0 }+ }+ }+ },+ "$defs": {+ "timestamp": {+ "type": "string",+ "format": "date-time",+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?Z$",+ "description": "RFC 3339 date-time in UTC with the Z designator."+ },+ "username": {+ "type": "string",+ "minLength": 1,+ "description": "Username as defined by ADR 0002."+ }+ }+}diff --git a/docs/design/memo-archive/1.0/memo.schema.json b/docs/design/memo-archive/1.0/memo.schema.jsonnew file mode 100644index 000000000..2511a818d--- /dev/null+++ b/docs/design/memo-archive/1.0/memo.schema.json@@ -0,0 +1,147 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "$id": "https://usememos.com/schemas/memo-archive/1.0/memo.schema.json",+ "title": "Memo Archive memo record",+ "description": "One memo and its attachments, stored at memos/{uid}.json in a Memo Archive. Field names, enum strings, and timestamps follow the proto3 JSON mapping of the public API. Unknown members are permitted so that later minor versions can add fields.",+ "type": "object",+ "required": ["uid", "creator", "createTime", "updateTime", "state", "visibility", "pinned", "contentPath"],+ "properties": {+ "uid": { "$ref": "#/$defs/uid" },+ "creator": { "$ref": "#/$defs/username" },+ "createTime": { "$ref": "#/$defs/timestamp" },+ "updateTime": { "$ref": "#/$defs/timestamp" },+ "state": {+ "type": "string",+ "description": "NORMAL or ARCHIVED. Readers treat an unknown value as NORMAL and warn."+ },+ "visibility": {+ "type": "string",+ "description": "PRIVATE, PROTECTED, PUBLIC, or SPACE. Readers treat an unknown value as PRIVATE and warn."+ },+ "pinned": { "type": "boolean" },+ "contentPath": {+ "$ref": "#/$defs/entryPath",+ "description": "Archive entry holding the memo content bytes. Readers follow this member, never a naming convention."+ },+ "tags": {+ "type": "array",+ "items": { "type": "string", "minLength": 1 },+ "description": "Informational. Derived from content on import."+ },+ "location": {+ "type": "object",+ "properties": {+ "placeholder": { "type": "string" },+ "latitude": { "type": "number", "minimum": -90, "maximum": 90 },+ "longitude": { "type": "number", "minimum": -180, "maximum": 180 }+ }+ },+ "space": {+ "type": "object",+ "required": ["uid"],+ "properties": {+ "uid": { "$ref": "#/$defs/uid" },+ "title": { "type": "string" }+ }+ },+ "parent": {+ "$ref": "#/$defs/uid",+ "description": "UID of the memo this record comments on."+ },+ "relations": {+ "type": "array",+ "items": {+ "type": "object",+ "required": ["type", "memo"],+ "properties": {+ "type": {+ "type": "string",+ "description": "REFERENCE in 1.0. Readers skip a relation with an unknown type and warn."+ },+ "memo": { "$ref": "#/$defs/uid" }+ }+ }+ },+ "attachments": {+ "type": "array",+ "items": { "$ref": "#/$defs/attachment" }+ },+ "reactions": {+ "type": "array",+ "description": "Informational in 1.0.",+ "items": {+ "type": "object",+ "required": ["reactionType", "creator"],+ "properties": {+ "reactionType": { "type": "string", "minLength": 1 },+ "creator": { "$ref": "#/$defs/username" },+ "createTime": { "$ref": "#/$defs/timestamp" }+ }+ }+ }+ },+ "$defs": {+ "uid": {+ "type": "string",+ "pattern": "^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$",+ "description": "Public resource UID grammar shared by memos, attachments, and Spaces."+ },+ "username": {+ "type": "string",+ "minLength": 1,+ "description": "Username as defined by ADR 0002."+ },+ "timestamp": {+ "type": "string",+ "format": "date-time",+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?Z$",+ "description": "RFC 3339 date-time in UTC with the Z designator."+ },+ "entryPath": {+ "type": "string",+ "minLength": 1,+ "pattern": "^(?!/)(?!.*(^|/)\\.\\.?(/|$))[^\\\\:\\u0000-\\u001f]+$",+ "description": "Relative ZIP entry name with forward slashes, no dot or dot-dot segments, and no backslash, colon, NUL, or C0 control character."+ },+ "sha256": {+ "type": "string",+ "pattern": "^[0-9a-f]{64}$",+ "description": "Lowercase hexadecimal SHA-256 digest (FIPS 180-4)."+ },+ "mediaType": {+ "type": "string",+ "pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$",+ "description": "IANA media type per RFC 6838, without parameters."+ },+ "attachment": {+ "type": "object",+ "required": ["uid", "filename", "type", "size", "createTime"],+ "properties": {+ "uid": { "$ref": "#/$defs/uid" },+ "filename": { "type": "string", "minLength": 1 },+ "type": { "$ref": "#/$defs/mediaType" },+ "size": { "type": "integer", "minimum": 0 },+ "sha256": { "$ref": "#/$defs/sha256" },+ "path": { "$ref": "#/$defs/entryPath" },+ "externalLink": { "type": "string", "format": "uri" },+ "createTime": { "$ref": "#/$defs/timestamp" },+ "mediaMetadata": { "$ref": "#/$defs/mediaMetadata" }+ },+ "oneOf": [+ { "required": ["path", "sha256"], "not": { "required": ["externalLink"] } },+ { "required": ["externalLink"], "not": { "required": ["path"] } }+ ]+ },+ "mediaMetadata": {+ "type": "object",+ "description": "The public API MediaMetadata message in its proto3 JSON mapping. Informational.",+ "properties": {+ "width": { "type": "integer", "minimum": 0 },+ "height": { "type": "integer", "minimum": 0 },+ "photo": { "type": "object" },+ "video": { "type": "object" }+ },+ "not": { "required": ["photo", "video"] }+ }+ }+}diff --git a/internal/ratelimit/ratelimit.go b/internal/ratelimit/ratelimit.goindex c2b35287a..4fd145744 100644--- a/internal/ratelimit/ratelimit.go+++ b/internal/ratelimit/ratelimit.go@@ -40,6 +40,8 @@ const (ScopeTranscribeUser Scope = "transcribe_user"// ScopeWriteUser counts content creation per user.ScopeWriteUser Scope = "write_user"+ // ScopeArchiveUser counts memo archive exports and imports per user.+ ScopeArchiveUser Scope = "archive_user")// Rule is the limit for one scope: at most Limit units within Window.@@ -74,6 +76,7 @@ func DefaultPolicy() Policy {ScopeUploadUser: {Limit: 120, Window: time.Minute},ScopeTranscribeUser: {Limit: 20, Window: time.Hour},ScopeWriteUser: {Limit: 120, Window: time.Minute},+ ScopeArchiveUser: {Limit: 10, Window: time.Hour},}}diff --git a/internal/ratelimit/ratelimit_test.go b/internal/ratelimit/ratelimit_test.goindex 4ba83f007..e96c04687 100644--- a/internal/ratelimit/ratelimit_test.go+++ b/internal/ratelimit/ratelimit_test.go@@ -223,6 +223,7 @@ func TestDefaultPolicyCoversEveryScope(t *testing.T) {for _, scope := range []Scope{ScopeAnonymous, ScopeAuthenticated, ScopeSignInIP, ScopeSignInAccount, ScopeSignupIP, ScopeValidateIP,ScopePasswordResetIP, ScopePasswordResetEmail, ScopeLinkMetadata, ScopeUploadUser, ScopeTranscribeUser, ScopeWriteUser,+ ScopeArchiveUser,} {rule, ok := p.Rule(scope)require.True(t, ok, scope)diff --git a/proto/api/v1/user_service.proto b/proto/api/v1/user_service.protoindex b92018504..c30b6eb7e 100644--- a/proto/api/v1/user_service.proto+++ b/proto/api/v1/user_service.proto@@ -7,6 +7,7 @@ import "api/v1/space_service.proto";import "google/api/annotations.proto";import "google/api/client.proto";import "google/api/field_behavior.proto";+import "google/api/httpbody.proto";import "google/api/resource.proto";import "google/protobuf/empty.proto";import "google/protobuf/field_mask.proto";@@ -71,6 +72,29 @@ service UserService {option (google.api.method_signature) = "name";}+ // ExportMemos writes every memo the user created, with comments, archived+ // memos, and attachment files, as a Memo Archive (a ZIP file, see+ // docs/design/memo-archive-format.md). Only the user may export their own+ // memos. The body is the archive; content_type is its media type.+ rpc ExportMemos(ExportMemosRequest) returns (google.api.HttpBody) {+ option (google.api.http) = {get: "/api/v1/{name=users/*}:exportMemos"};+ option (google.api.method_signature) = "name";+ }++ // ImportMemos uploads a Memo Archive in bounded chunks and imports it into+ // the user's memos. The first call carries the spec and returns an+ // upload_id; later calls carry that upload_id. A finishing call with+ // validate_only returns the plan and keeps the archive staged; a finishing+ // call without it imports and returns the report. Uploads are bound to the+ // authenticated user, expire after 30 minutes of inactivity, and do not+ // survive a server restart.+ rpc ImportMemos(ImportMemosRequest) returns (ImportMemosResponse) {+ option (google.api.http) = {+ post: "/api/v1/{name=users/*}:importMemos"+ body: "*"+ };+ }+// GetUserSetting returns the user setting.rpc GetUserSetting(GetUserSettingRequest) returns (UserSetting) {option (google.api.http) = {get: "/api/v1/{name=users/*/settings/*}"};@@ -439,6 +463,148 @@ message UserStats {}}+message ExportMemosRequest {+ // Required. The user whose memos are exported. Must be the caller.+ // Format: users/{user}+ string name = 1 [+ (google.api.field_behavior) = REQUIRED,+ (google.api.resource_reference) = {type: "memos.api.v1/User"}+ ];+}++message ImportMemosRequest {+ // What the importer does with a memo whose UID the user already holds.+ enum ConflictPolicy {+ CONFLICT_POLICY_UNSPECIFIED = 0;+ // Leave the existing memo untouched. This is the default.+ SKIP = 1;+ // Update the existing memo's content and metadata from the archive.+ REPLACE = 2;+ // Keep the existing memo and create the archive version under a fresh UID.+ DUPLICATE = 3;+ }++ // Required. The user who receives the memos. Must be the caller.+ // Format: users/{user}+ string name = 1 [+ (google.api.field_behavior) = REQUIRED,+ (google.api.resource_reference) = {type: "memos.api.v1/User"}+ ];++ // Required. Start a new upload or continue an existing one.+ oneof upload {+ // Starts a new upload. The same call may also carry data and finish_write.+ ImportMemosSpec spec = 2;++ // Continues the upload identified by a previous response.+ string upload_id = 3;+ }++ // Required. Zero-based byte offset at which data is written. Must equal the+ // committed size, except when retrying the most recently accepted chunk+ // with identical bytes and offset, which is accepted without writing again.+ int64 write_offset = 4 [(google.api.field_behavior) = REQUIRED];++ // Optional. Archive bytes, at most max_chunk_size long. With no data and+ // finish_write false, the call reports progress without writing, and+ // write_offset is ignored.+ bytes data = 5 [(google.api.field_behavior) = OPTIONAL];++ // Optional. Finish the upload after writing data. The committed size must+ // then equal total_size. The archive is validated and, unless+ // validate_only is set, imported. Any later call for an imported upload+ // returns the same report.+ bool finish_write = 6 [(google.api.field_behavior) = OPTIONAL];++ // Optional. On a finishing call, validate the archive and return the plan+ // without importing. The upload stays staged so a later finishing call can+ // import it.+ bool validate_only = 7 [(google.api.field_behavior) = OPTIONAL];++ // Optional. Read on the finishing call that imports. Unspecified means SKIP.+ ConflictPolicy conflict_policy = 8 [(google.api.field_behavior) = OPTIONAL];+}++message ImportMemosSpec {+ // Optional. Total size of the archive in bytes.+ int64 total_size = 1 [(google.api.field_behavior) = OPTIONAL];+}++message ImportMemosResponse {+ // Opaque ID for subsequent calls. This is not a resource name.+ string upload_id = 1;++ // Number of archive bytes committed so far.+ int64 committed_size = 2;++ // Maximum number of data bytes accepted in one call.+ int32 max_chunk_size = 3;++ // Set once the upload has been finished.+ oneof result {+ // What the import would do. Set by a finishing call with validate_only.+ MemoImportPlan plan = 4;++ // What the import did. Set by a finishing call that imported.+ MemoImportReport report = 5;+ }+}++// MemoImportIssue is one warning or failure of an import, tied to the memo+// UID from the archive when there is one.+message MemoImportIssue {+ // The archive memo UID the issue concerns, if any.+ string memo = 1;++ string message = 2;+}++// MemoImportPlan describes what importing a staged archive would do.+message MemoImportPlan {+ // When the archive was written.+ google.protobuf.Timestamp export_time = 1;++ // Username of the user who exported the archive.+ string exporter = 2;++ // The software that wrote the archive.+ string generator = 3;++ // Number of memo records in the archive.+ int32 memos = 4;++ // Number of attachment files in the archive.+ int32 attachments = 5;++ // Memos whose UID nobody on the instance holds.+ int32 new = 6;++ // Memos the user already holds; the conflict policy applies to them.+ int32 existing = 7;++ // Memos whose UID another account holds; they are imported under fresh UIDs.+ int32 renamed = 8;++ // Deviations the archive reader corrected while validating.+ repeated MemoImportIssue warnings = 9;+}++// MemoImportReport is the outcome of an import.+message MemoImportReport {+ int32 created = 1;++ int32 updated = 2;++ int32 skipped = 3;++ int32 failed = 4;++ repeated MemoImportIssue warnings = 5;++ // One entry per failed memo, with the reason.+ repeated MemoImportIssue failures = 6;+}+message GetUserStatsRequest {// Required. The resource name of the user.// Format: users/{user}diff --git a/proto/gen/api/v1/apiv1connect/user_service.connect.go b/proto/gen/api/v1/apiv1connect/user_service.connect.goindex c80bc55b8..d7b058e9d 100644--- a/proto/gen/api/v1/apiv1connect/user_service.connect.go+++ b/proto/gen/api/v1/apiv1connect/user_service.connect.go@@ -9,6 +9,7 @@ import (context "context"errors "errors"v1 "github.com/usememos/memos/proto/gen/api/v1"+ httpbody "google.golang.org/genproto/googleapis/api/httpbody"emptypb "google.golang.org/protobuf/types/known/emptypb"http "net/http"strings "strings"@@ -53,6 +54,10 @@ const (// UserServiceGetUserStatsProcedure is the fully-qualified name of the UserService's GetUserStats// RPC.UserServiceGetUserStatsProcedure = "/memos.api.v1.UserService/GetUserStats"+ // UserServiceExportMemosProcedure is the fully-qualified name of the UserService's ExportMemos RPC.+ UserServiceExportMemosProcedure = "/memos.api.v1.UserService/ExportMemos"+ // UserServiceImportMemosProcedure is the fully-qualified name of the UserService's ImportMemos RPC.+ UserServiceImportMemosProcedure = "/memos.api.v1.UserService/ImportMemos"// UserServiceGetUserSettingProcedure is the fully-qualified name of the UserService's// GetUserSetting RPC.UserServiceGetUserSettingProcedure = "/memos.api.v1.UserService/GetUserSetting"@@ -142,6 +147,19 @@ type UserServiceClient interface {ListAllUserStats(context.Context, *connect.Request[v1.ListAllUserStatsRequest]) (*connect.Response[v1.ListAllUserStatsResponse], error)// GetUserStats returns statistics for a specific user.GetUserStats(context.Context, *connect.Request[v1.GetUserStatsRequest]) (*connect.Response[v1.UserStats], error)+ // ExportMemos writes every memo the user created, with comments, archived+ // memos, and attachment files, as a Memo Archive (a ZIP file, see+ // docs/design/memo-archive-format.md). Only the user may export their own+ // memos. The body is the archive; content_type is its media type.+ ExportMemos(context.Context, *connect.Request[v1.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error)+ // ImportMemos uploads a Memo Archive in bounded chunks and imports it into+ // the user's memos. The first call carries the spec and returns an+ // upload_id; later calls carry that upload_id. A finishing call with+ // validate_only returns the plan and keeps the archive staged; a finishing+ // call without it imports and returns the report. Uploads are bound to the+ // authenticated user, expire after 30 minutes of inactivity, and do not+ // survive a server restart.+ ImportMemos(context.Context, *connect.Request[v1.ImportMemosRequest]) (*connect.Response[v1.ImportMemosResponse], error)// GetUserSetting returns the user setting.GetUserSetting(context.Context, *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error)// UpdateUserSetting updates the user setting.@@ -255,6 +273,18 @@ func NewUserServiceClient(httpClient connect.HTTPClient, baseURL string, opts ..connect.WithSchema(userServiceMethods.ByName("GetUserStats")),connect.WithClientOptions(opts...),),+ exportMemos: connect.NewClient[v1.ExportMemosRequest, httpbody.HttpBody](+ httpClient,+ baseURL+UserServiceExportMemosProcedure,+ connect.WithSchema(userServiceMethods.ByName("ExportMemos")),+ connect.WithClientOptions(opts...),+ ),+ importMemos: connect.NewClient[v1.ImportMemosRequest, v1.ImportMemosResponse](+ httpClient,+ baseURL+UserServiceImportMemosProcedure,+ connect.WithSchema(userServiceMethods.ByName("ImportMemos")),+ connect.WithClientOptions(opts...),+ ),getUserSetting: connect.NewClient[v1.GetUserSettingRequest, v1.UserSetting](httpClient,baseURL+UserServiceGetUserSettingProcedure,@@ -406,6 +436,8 @@ type userServiceClient struct {deleteUser *connect.Client[v1.DeleteUserRequest, emptypb.Empty]listAllUserStats *connect.Client[v1.ListAllUserStatsRequest, v1.ListAllUserStatsResponse]getUserStats *connect.Client[v1.GetUserStatsRequest, v1.UserStats]+ exportMemos *connect.Client[v1.ExportMemosRequest, httpbody.HttpBody]+ importMemos *connect.Client[v1.ImportMemosRequest, v1.ImportMemosResponse]getUserSetting *connect.Client[v1.GetUserSettingRequest, v1.UserSetting]updateUserSetting *connect.Client[v1.UpdateUserSettingRequest, v1.UserSetting]listUserSettings *connect.Client[v1.ListUserSettingsRequest, v1.ListUserSettingsResponse]@@ -471,6 +503,16 @@ func (c *userServiceClient) GetUserStats(ctx context.Context, req *connect.Requereturn c.getUserStats.CallUnary(ctx, req)}+// ExportMemos calls memos.api.v1.UserService.ExportMemos.+func (c *userServiceClient) ExportMemos(ctx context.Context, req *connect.Request[v1.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error) {+ return c.exportMemos.CallUnary(ctx, req)+}++// ImportMemos calls memos.api.v1.UserService.ImportMemos.+func (c *userServiceClient) ImportMemos(ctx context.Context, req *connect.Request[v1.ImportMemosRequest]) (*connect.Response[v1.ImportMemosResponse], error) {+ return c.importMemos.CallUnary(ctx, req)+}+// GetUserSetting calls memos.api.v1.UserService.GetUserSetting.func (c *userServiceClient) GetUserSetting(ctx context.Context, req *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error) {return c.getUserSetting.CallUnary(ctx, req)@@ -605,6 +647,19 @@ type UserServiceHandler interface {ListAllUserStats(context.Context, *connect.Request[v1.ListAllUserStatsRequest]) (*connect.Response[v1.ListAllUserStatsResponse], error)// GetUserStats returns statistics for a specific user.GetUserStats(context.Context, *connect.Request[v1.GetUserStatsRequest]) (*connect.Response[v1.UserStats], error)+ // ExportMemos writes every memo the user created, with comments, archived+ // memos, and attachment files, as a Memo Archive (a ZIP file, see+ // docs/design/memo-archive-format.md). Only the user may export their own+ // memos. The body is the archive; content_type is its media type.+ ExportMemos(context.Context, *connect.Request[v1.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error)+ // ImportMemos uploads a Memo Archive in bounded chunks and imports it into+ // the user's memos. The first call carries the spec and returns an+ // upload_id; later calls carry that upload_id. A finishing call with+ // validate_only returns the plan and keeps the archive staged; a finishing+ // call without it imports and returns the report. Uploads are bound to the+ // authenticated user, expire after 30 minutes of inactivity, and do not+ // survive a server restart.+ ImportMemos(context.Context, *connect.Request[v1.ImportMemosRequest]) (*connect.Response[v1.ImportMemosResponse], error)// GetUserSetting returns the user setting.GetUserSetting(context.Context, *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error)// UpdateUserSetting updates the user setting.@@ -714,6 +769,18 @@ func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOptionconnect.WithSchema(userServiceMethods.ByName("GetUserStats")),connect.WithHandlerOptions(opts...),)+ userServiceExportMemosHandler := connect.NewUnaryHandler(+ UserServiceExportMemosProcedure,+ svc.ExportMemos,+ connect.WithSchema(userServiceMethods.ByName("ExportMemos")),+ connect.WithHandlerOptions(opts...),+ )+ userServiceImportMemosHandler := connect.NewUnaryHandler(+ UserServiceImportMemosProcedure,+ svc.ImportMemos,+ connect.WithSchema(userServiceMethods.ByName("ImportMemos")),+ connect.WithHandlerOptions(opts...),+ )userServiceGetUserSettingHandler := connect.NewUnaryHandler(UserServiceGetUserSettingProcedure,svc.GetUserSetting,@@ -870,6 +937,10 @@ func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOptionuserServiceListAllUserStatsHandler.ServeHTTP(w, r)case UserServiceGetUserStatsProcedure:userServiceGetUserStatsHandler.ServeHTTP(w, r)+ case UserServiceExportMemosProcedure:+ userServiceExportMemosHandler.ServeHTTP(w, r)+ case UserServiceImportMemosProcedure:+ userServiceImportMemosHandler.ServeHTTP(w, r)case UserServiceGetUserSettingProcedure:userServiceGetUserSettingHandler.ServeHTTP(w, r)case UserServiceUpdateUserSettingProcedure:@@ -957,6 +1028,14 @@ func (UnimplementedUserServiceHandler) GetUserStats(context.Context, *connect.Rereturn nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetUserStats is not implemented"))}+func (UnimplementedUserServiceHandler) ExportMemos(context.Context, *connect.Request[v1.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error) {+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ExportMemos is not implemented"))+}++func (UnimplementedUserServiceHandler) ImportMemos(context.Context, *connect.Request[v1.ImportMemosRequest]) (*connect.Response[v1.ImportMemosResponse], error) {+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ImportMemos is not implemented"))+}+func (UnimplementedUserServiceHandler) GetUserSetting(context.Context, *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error) {return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetUserSetting is not implemented"))}diff --git a/proto/gen/api/v1/user_service.pb.go b/proto/gen/api/v1/user_service.pb.goindex 83bda6a97..1e2686d50 100644--- a/proto/gen/api/v1/user_service.pb.go+++ b/proto/gen/api/v1/user_service.pb.go@@ -8,6 +8,7 @@ package apiv1import (_ "google.golang.org/genproto/googleapis/api/annotations"+ httpbody "google.golang.org/genproto/googleapis/api/httpbody"color "google.golang.org/genproto/googleapis/type/color"protoreflect "google.golang.org/protobuf/reflect/protoreflect"protoimpl "google.golang.org/protobuf/runtime/protoimpl"@@ -78,6 +79,62 @@ func (User_Role) EnumDescriptor() ([]byte, []int) {return file_api_v1_user_service_proto_rawDescGZIP(), []int{0, 0}}+// What the importer does with a memo whose UID the user already holds.+type ImportMemosRequest_ConflictPolicy int32++const (+ ImportMemosRequest_CONFLICT_POLICY_UNSPECIFIED ImportMemosRequest_ConflictPolicy = 0+ // Leave the existing memo untouched. This is the default.+ ImportMemosRequest_SKIP ImportMemosRequest_ConflictPolicy = 1+ // Update the existing memo's content and metadata from the archive.+ ImportMemosRequest_REPLACE ImportMemosRequest_ConflictPolicy = 2+ // Keep the existing memo and create the archive version under a fresh UID.+ ImportMemosRequest_DUPLICATE ImportMemosRequest_ConflictPolicy = 3+)++// Enum value maps for ImportMemosRequest_ConflictPolicy.+var (+ ImportMemosRequest_ConflictPolicy_name = map[int32]string{+ 0: "CONFLICT_POLICY_UNSPECIFIED",+ 1: "SKIP",+ 2: "REPLACE",+ 3: "DUPLICATE",+ }+ ImportMemosRequest_ConflictPolicy_value = map[string]int32{+ "CONFLICT_POLICY_UNSPECIFIED": 0,+ "SKIP": 1,+ "REPLACE": 2,+ "DUPLICATE": 3,+ }+)++func (x ImportMemosRequest_ConflictPolicy) Enum() *ImportMemosRequest_ConflictPolicy {+ p := new(ImportMemosRequest_ConflictPolicy)+ *p = x+ return p+}++func (x ImportMemosRequest_ConflictPolicy) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (ImportMemosRequest_ConflictPolicy) Descriptor() protoreflect.EnumDescriptor {+ return file_api_v1_user_service_proto_enumTypes[1].Descriptor()+}++func (ImportMemosRequest_ConflictPolicy) Type() protoreflect.EnumType {+ return &file_api_v1_user_service_proto_enumTypes[1]+}++func (x ImportMemosRequest_ConflictPolicy) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use ImportMemosRequest_ConflictPolicy.Descriptor instead.+func (ImportMemosRequest_ConflictPolicy) EnumDescriptor() ([]byte, []int) {+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{11, 0}+}+// Enumeration of user setting keys.type UserSetting_Key int32@@ -118,11 +175,11 @@ func (x UserSetting_Key) String() string {}func (UserSetting_Key) Descriptor() protoreflect.EnumDescriptor {- return file_api_v1_user_service_proto_enumTypes[1].Descriptor()+ return file_api_v1_user_service_proto_enumTypes[2].Descriptor()}func (UserSetting_Key) Type() protoreflect.EnumType {- return &file_api_v1_user_service_proto_enumTypes[1]+ return &file_api_v1_user_service_proto_enumTypes[2]}func (x UserSetting_Key) Number() protoreflect.EnumNumber {@@ -131,7 +188,7 @@ func (x UserSetting_Key) Number() protoreflect.EnumNumber {// Deprecated: Use UserSetting_Key.Descriptor instead.func (UserSetting_Key) EnumDescriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{13, 0}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 0}}type UserNotification_Status int32@@ -167,11 +224,11 @@ func (x UserNotification_Status) String() string {}func (UserNotification_Status) Descriptor() protoreflect.EnumDescriptor {- return file_api_v1_user_service_proto_enumTypes[2].Descriptor()+ return file_api_v1_user_service_proto_enumTypes[3].Descriptor()}func (UserNotification_Status) Type() protoreflect.EnumType {- return &file_api_v1_user_service_proto_enumTypes[2]+ return &file_api_v1_user_service_proto_enumTypes[3]}func (x UserNotification_Status) Number() protoreflect.EnumNumber {@@ -180,7 +237,7 @@ func (x UserNotification_Status) Number() protoreflect.EnumNumber {// Deprecated: Use UserNotification_Status.Descriptor instead.func (UserNotification_Status) EnumDescriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{45, 0}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 0}}type UserNotification_Type int32@@ -219,11 +276,11 @@ func (x UserNotification_Type) String() string {}func (UserNotification_Type) Descriptor() protoreflect.EnumDescriptor {- return file_api_v1_user_service_proto_enumTypes[3].Descriptor()+ return file_api_v1_user_service_proto_enumTypes[4].Descriptor()}func (UserNotification_Type) Type() protoreflect.EnumType {- return &file_api_v1_user_service_proto_enumTypes[3]+ return &file_api_v1_user_service_proto_enumTypes[4]}func (x UserNotification_Type) Number() protoreflect.EnumNumber {@@ -232,7 +289,7 @@ func (x UserNotification_Type) Number() protoreflect.EnumNumber {// Deprecated: Use UserNotification_Type.Descriptor instead.func (UserNotification_Type) EnumDescriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{45, 1}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 1}}type UserNotification_SpaceInvitationPayload_State int32@@ -270,11 +327,11 @@ func (x UserNotification_SpaceInvitationPayload_State) String() string {}func (UserNotification_SpaceInvitationPayload_State) Descriptor() protoreflect.EnumDescriptor {- return file_api_v1_user_service_proto_enumTypes[4].Descriptor()+ return file_api_v1_user_service_proto_enumTypes[5].Descriptor()}func (UserNotification_SpaceInvitationPayload_State) Type() protoreflect.EnumType {- return &file_api_v1_user_service_proto_enumTypes[4]+ return &file_api_v1_user_service_proto_enumTypes[5]}func (x UserNotification_SpaceInvitationPayload_State) Number() protoreflect.EnumNumber {@@ -283,7 +340,7 @@ func (x UserNotification_SpaceInvitationPayload_State) Number() protoreflect.Enu// Deprecated: Use UserNotification_SpaceInvitationPayload_State.Descriptor instead.func (UserNotification_SpaceInvitationPayload_State) EnumDescriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{45, 2, 0}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 2, 0}}type User struct {@@ -1010,6 +1067,619 @@ func (x *UserStats) GetAttachmentStorageBytes() int64 {return 0}+type ExportMemosRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // Required. The user whose memos are exported. Must be the caller.+ // Format: users/{user}+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ExportMemosRequest) Reset() {+ *x = ExportMemosRequest{}+ mi := &file_api_v1_user_service_proto_msgTypes[10]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ExportMemosRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ExportMemosRequest) ProtoMessage() {}++func (x *ExportMemosRequest) ProtoReflect() protoreflect.Message {+ mi := &file_api_v1_user_service_proto_msgTypes[10]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ExportMemosRequest.ProtoReflect.Descriptor instead.+func (*ExportMemosRequest) Descriptor() ([]byte, []int) {+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{10}+}++func (x *ExportMemosRequest) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++type ImportMemosRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // Required. The user who receives the memos. Must be the caller.+ // Format: users/{user}+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ // Required. Start a new upload or continue an existing one.+ //+ // Types that are valid to be assigned to Upload:+ //+ // *ImportMemosRequest_Spec+ // *ImportMemosRequest_UploadId+ Upload isImportMemosRequest_Upload `protobuf_oneof:"upload"`+ // Required. Zero-based byte offset at which data is written. Must equal the+ // committed size, except when retrying the most recently accepted chunk+ // with identical bytes and offset, which is accepted without writing again.+ WriteOffset int64 `protobuf:"varint,4,opt,name=write_offset,json=writeOffset,proto3" json:"write_offset,omitempty"`+ // Optional. Archive bytes, at most max_chunk_size long. With no data and+ // finish_write false, the call reports progress without writing, and+ // write_offset is ignored.+ Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`+ // Optional. Finish the upload after writing data. The committed size must+ // then equal total_size. The archive is validated and, unless+ // validate_only is set, imported. Any later call for an imported upload+ // returns the same report.+ FinishWrite bool `protobuf:"varint,6,opt,name=finish_write,json=finishWrite,proto3" json:"finish_write,omitempty"`+ // Optional. On a finishing call, validate the archive and return the plan+ // without importing. The upload stays staged so a later finishing call can+ // import it.+ ValidateOnly bool `protobuf:"varint,7,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"`+ // Optional. Read on the finishing call that imports. Unspecified means SKIP.+ ConflictPolicy ImportMemosRequest_ConflictPolicy `protobuf:"varint,8,opt,name=conflict_policy,json=conflictPolicy,proto3,enum=memos.api.v1.ImportMemosRequest_ConflictPolicy" json:"conflict_policy,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ImportMemosRequest) Reset() {+ *x = ImportMemosRequest{}+ mi := &file_api_v1_user_service_proto_msgTypes[11]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ImportMemosRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ImportMemosRequest) ProtoMessage() {}++func (x *ImportMemosRequest) ProtoReflect() protoreflect.Message {+ mi := &file_api_v1_user_service_proto_msgTypes[11]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ImportMemosRequest.ProtoReflect.Descriptor instead.+func (*ImportMemosRequest) Descriptor() ([]byte, []int) {+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{11}+}++func (x *ImportMemosRequest) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++func (x *ImportMemosRequest) GetUpload() isImportMemosRequest_Upload {+ if x != nil {+ return x.Upload+ }+ return nil+}++func (x *ImportMemosRequest) GetSpec() *ImportMemosSpec {+ if x != nil {+ if x, ok := x.Upload.(*ImportMemosRequest_Spec); ok {+ return x.Spec+ }+ }+ return nil+}++func (x *ImportMemosRequest) GetUploadId() string {+ if x != nil {+ if x, ok := x.Upload.(*ImportMemosRequest_UploadId); ok {+ return x.UploadId+ }+ }+ return ""+}++func (x *ImportMemosRequest) GetWriteOffset() int64 {+ if x != nil {+ return x.WriteOffset+ }+ return 0+}++func (x *ImportMemosRequest) GetData() []byte {+ if x != nil {+ return x.Data+ }+ return nil+}++func (x *ImportMemosRequest) GetFinishWrite() bool {+ if x != nil {+ return x.FinishWrite+ }+ return false+}++func (x *ImportMemosRequest) GetValidateOnly() bool {+ if x != nil {+ return x.ValidateOnly+ }+ return false+}++func (x *ImportMemosRequest) GetConflictPolicy() ImportMemosRequest_ConflictPolicy {+ if x != nil {+ return x.ConflictPolicy+ }+ return ImportMemosRequest_CONFLICT_POLICY_UNSPECIFIED+}++type isImportMemosRequest_Upload interface {+ isImportMemosRequest_Upload()+}++type ImportMemosRequest_Spec struct {+ // Starts a new upload. The same call may also carry data and finish_write.+ Spec *ImportMemosSpec `protobuf:"bytes,2,opt,name=spec,proto3,oneof"`+}++type ImportMemosRequest_UploadId struct {+ // Continues the upload identified by a previous response.+ UploadId string `protobuf:"bytes,3,opt,name=upload_id,json=uploadId,proto3,oneof"`+}++func (*ImportMemosRequest_Spec) isImportMemosRequest_Upload() {}++func (*ImportMemosRequest_UploadId) isImportMemosRequest_Upload() {}++type ImportMemosSpec struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // Optional. Total size of the archive in bytes.+ TotalSize int64 `protobuf:"varint,1,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ImportMemosSpec) Reset() {+ *x = ImportMemosSpec{}+ mi := &file_api_v1_user_service_proto_msgTypes[12]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ImportMemosSpec) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ImportMemosSpec) ProtoMessage() {}++func (x *ImportMemosSpec) ProtoReflect() protoreflect.Message {+ mi := &file_api_v1_user_service_proto_msgTypes[12]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ImportMemosSpec.ProtoReflect.Descriptor instead.+func (*ImportMemosSpec) Descriptor() ([]byte, []int) {+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{12}+}++func (x *ImportMemosSpec) GetTotalSize() int64 {+ if x != nil {+ return x.TotalSize+ }+ return 0+}++type ImportMemosResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // Opaque ID for subsequent calls. This is not a resource name.+ UploadId string `protobuf:"bytes,1,opt,name=upload_id,json=uploadId,proto3" json:"upload_id,omitempty"`+ // Number of archive bytes committed so far.+ CommittedSize int64 `protobuf:"varint,2,opt,name=committed_size,json=committedSize,proto3" json:"committed_size,omitempty"`+ // Maximum number of data bytes accepted in one call.+ MaxChunkSize int32 `protobuf:"varint,3,opt,name=max_chunk_size,json=maxChunkSize,proto3" json:"max_chunk_size,omitempty"`+ // Set once the upload has been finished.+ //+ // Types that are valid to be assigned to Result:+ //+ // *ImportMemosResponse_Plan+ // *ImportMemosResponse_Report+ Result isImportMemosResponse_Result `protobuf_oneof:"result"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ImportMemosResponse) Reset() {+ *x = ImportMemosResponse{}+ mi := &file_api_v1_user_service_proto_msgTypes[13]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ImportMemosResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ImportMemosResponse) ProtoMessage() {}++func (x *ImportMemosResponse) ProtoReflect() protoreflect.Message {+ mi := &file_api_v1_user_service_proto_msgTypes[13]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ImportMemosResponse.ProtoReflect.Descriptor instead.+func (*ImportMemosResponse) Descriptor() ([]byte, []int) {+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{13}+}++func (x *ImportMemosResponse) GetUploadId() string {+ if x != nil {+ return x.UploadId+ }+ return ""+}++func (x *ImportMemosResponse) GetCommittedSize() int64 {+ if x != nil {+ return x.CommittedSize+ }+ return 0+}++func (x *ImportMemosResponse) GetMaxChunkSize() int32 {+ if x != nil {+ return x.MaxChunkSize+ }+ return 0+}++func (x *ImportMemosResponse) GetResult() isImportMemosResponse_Result {+ if x != nil {+ return x.Result+ }+ return nil+}++func (x *ImportMemosResponse) GetPlan() *MemoImportPlan {+ if x != nil {+ if x, ok := x.Result.(*ImportMemosResponse_Plan); ok {+ return x.Plan+ }+ }+ return nil+}++func (x *ImportMemosResponse) GetReport() *MemoImportReport {+ if x != nil {+ if x, ok := x.Result.(*ImportMemosResponse_Report); ok {+ return x.Report+ }+ }+ return nil+}++type isImportMemosResponse_Result interface {+ isImportMemosResponse_Result()+}++type ImportMemosResponse_Plan struct {+ // What the import would do. Set by a finishing call with validate_only.+ Plan *MemoImportPlan `protobuf:"bytes,4,opt,name=plan,proto3,oneof"`+}++type ImportMemosResponse_Report struct {+ // What the import did. Set by a finishing call that imported.+ Report *MemoImportReport `protobuf:"bytes,5,opt,name=report,proto3,oneof"`+}++func (*ImportMemosResponse_Plan) isImportMemosResponse_Result() {}++func (*ImportMemosResponse_Report) isImportMemosResponse_Result() {}++// MemoImportIssue is one warning or failure of an import, tied to the memo+// UID from the archive when there is one.+type MemoImportIssue struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The archive memo UID the issue concerns, if any.+ Memo string `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"`+ Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *MemoImportIssue) Reset() {+ *x = MemoImportIssue{}+ mi := &file_api_v1_user_service_proto_msgTypes[14]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *MemoImportIssue) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*MemoImportIssue) ProtoMessage() {}++func (x *MemoImportIssue) ProtoReflect() protoreflect.Message {+ mi := &file_api_v1_user_service_proto_msgTypes[14]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use MemoImportIssue.ProtoReflect.Descriptor instead.+func (*MemoImportIssue) Descriptor() ([]byte, []int) {+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{14}+}++func (x *MemoImportIssue) GetMemo() string {+ if x != nil {+ return x.Memo+ }+ return ""+}++func (x *MemoImportIssue) GetMessage() string {+ if x != nil {+ return x.Message+ }+ return ""+}++// MemoImportPlan describes what importing a staged archive would do.+type MemoImportPlan struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // When the archive was written.+ ExportTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=export_time,json=exportTime,proto3" json:"export_time,omitempty"`+ // Username of the user who exported the archive.+ Exporter string `protobuf:"bytes,2,opt,name=exporter,proto3" json:"exporter,omitempty"`+ // The software that wrote the archive.+ Generator string `protobuf:"bytes,3,opt,name=generator,proto3" json:"generator,omitempty"`+ // Number of memo records in the archive.+ Memos int32 `protobuf:"varint,4,opt,name=memos,proto3" json:"memos,omitempty"`+ // Number of attachment files in the archive.+ Attachments int32 `protobuf:"varint,5,opt,name=attachments,proto3" json:"attachments,omitempty"`+ // Memos whose UID nobody on the instance holds.+ New int32 `protobuf:"varint,6,opt,name=new,proto3" json:"new,omitempty"`+ // Memos the user already holds; the conflict policy applies to them.+ Existing int32 `protobuf:"varint,7,opt,name=existing,proto3" json:"existing,omitempty"`+ // Memos whose UID another account holds; they are imported under fresh UIDs.+ Renamed int32 `protobuf:"varint,8,opt,name=renamed,proto3" json:"renamed,omitempty"`+ // Deviations the archive reader corrected while validating.+ Warnings []*MemoImportIssue `protobuf:"bytes,9,rep,name=warnings,proto3" json:"warnings,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *MemoImportPlan) Reset() {+ *x = MemoImportPlan{}+ mi := &file_api_v1_user_service_proto_msgTypes[15]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *MemoImportPlan) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*MemoImportPlan) ProtoMessage() {}++func (x *MemoImportPlan) ProtoReflect() protoreflect.Message {+ mi := &file_api_v1_user_service_proto_msgTypes[15]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use MemoImportPlan.ProtoReflect.Descriptor instead.+func (*MemoImportPlan) Descriptor() ([]byte, []int) {+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{15}+}++func (x *MemoImportPlan) GetExportTime() *timestamppb.Timestamp {+ if x != nil {+ return x.ExportTime+ }+ return nil+}++func (x *MemoImportPlan) GetExporter() string {+ if x != nil {+ return x.Exporter+ }+ return ""+}++func (x *MemoImportPlan) GetGenerator() string {+ if x != nil {+ return x.Generator+ }+ return ""+}++func (x *MemoImportPlan) GetMemos() int32 {+ if x != nil {+ return x.Memos+ }+ return 0+}++func (x *MemoImportPlan) GetAttachments() int32 {+ if x != nil {+ return x.Attachments+ }+ return 0+}++func (x *MemoImportPlan) GetNew() int32 {+ if x != nil {+ return x.New+ }+ return 0+}++func (x *MemoImportPlan) GetExisting() int32 {+ if x != nil {+ return x.Existing+ }+ return 0+}++func (x *MemoImportPlan) GetRenamed() int32 {+ if x != nil {+ return x.Renamed+ }+ return 0+}++func (x *MemoImportPlan) GetWarnings() []*MemoImportIssue {+ if x != nil {+ return x.Warnings+ }+ return nil+}++// MemoImportReport is the outcome of an import.+type MemoImportReport struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Created int32 `protobuf:"varint,1,opt,name=created,proto3" json:"created,omitempty"`+ Updated int32 `protobuf:"varint,2,opt,name=updated,proto3" json:"updated,omitempty"`+ Skipped int32 `protobuf:"varint,3,opt,name=skipped,proto3" json:"skipped,omitempty"`+ Failed int32 `protobuf:"varint,4,opt,name=failed,proto3" json:"failed,omitempty"`+ Warnings []*MemoImportIssue `protobuf:"bytes,5,rep,name=warnings,proto3" json:"warnings,omitempty"`+ // One entry per failed memo, with the reason.+ Failures []*MemoImportIssue `protobuf:"bytes,6,rep,name=failures,proto3" json:"failures,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *MemoImportReport) Reset() {+ *x = MemoImportReport{}+ mi := &file_api_v1_user_service_proto_msgTypes[16]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *MemoImportReport) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*MemoImportReport) ProtoMessage() {}++func (x *MemoImportReport) ProtoReflect() protoreflect.Message {+ mi := &file_api_v1_user_service_proto_msgTypes[16]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use MemoImportReport.ProtoReflect.Descriptor instead.+func (*MemoImportReport) Descriptor() ([]byte, []int) {+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{16}+}++func (x *MemoImportReport) GetCreated() int32 {+ if x != nil {+ return x.Created+ }+ return 0+}++func (x *MemoImportReport) GetUpdated() int32 {+ if x != nil {+ return x.Updated+ }+ return 0+}++func (x *MemoImportReport) GetSkipped() int32 {+ if x != nil {+ return x.Skipped+ }+ return 0+}++func (x *MemoImportReport) GetFailed() int32 {+ if x != nil {+ return x.Failed+ }+ return 0+}++func (x *MemoImportReport) GetWarnings() []*MemoImportIssue {+ if x != nil {+ return x.Warnings+ }+ return nil+}++func (x *MemoImportReport) GetFailures() []*MemoImportIssue {+ if x != nil {+ return x.Failures+ }+ return nil+}+type GetUserStatsRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// Required. The resource name of the user.@@ -1024,7 +1694,7 @@ type GetUserStatsRequest struct {func (x *GetUserStatsRequest) Reset() {*x = GetUserStatsRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[10]+ mi := &file_api_v1_user_service_proto_msgTypes[17]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1036,7 +1706,7 @@ func (x *GetUserStatsRequest) String() string {func (*GetUserStatsRequest) ProtoMessage() {}func (x *GetUserStatsRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[10]+ mi := &file_api_v1_user_service_proto_msgTypes[17]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1049,7 +1719,7 @@ func (x *GetUserStatsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GetUserStatsRequest.ProtoReflect.Descriptor instead.func (*GetUserStatsRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{10}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{17}}func (x *GetUserStatsRequest) GetName() string {@@ -1079,7 +1749,7 @@ type ListAllUserStatsRequest struct {func (x *ListAllUserStatsRequest) Reset() {*x = ListAllUserStatsRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[11]+ mi := &file_api_v1_user_service_proto_msgTypes[18]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1091,7 +1761,7 @@ func (x *ListAllUserStatsRequest) String() string {func (*ListAllUserStatsRequest) ProtoMessage() {}func (x *ListAllUserStatsRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[11]+ mi := &file_api_v1_user_service_proto_msgTypes[18]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1104,7 +1774,7 @@ func (x *ListAllUserStatsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListAllUserStatsRequest.ProtoReflect.Descriptor instead.func (*ListAllUserStatsRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{11}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{18}}func (x *ListAllUserStatsRequest) GetState() State {@@ -1131,7 +1801,7 @@ type ListAllUserStatsResponse struct {func (x *ListAllUserStatsResponse) Reset() {*x = ListAllUserStatsResponse{}- mi := &file_api_v1_user_service_proto_msgTypes[12]+ mi := &file_api_v1_user_service_proto_msgTypes[19]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1143,7 +1813,7 @@ func (x *ListAllUserStatsResponse) String() string {func (*ListAllUserStatsResponse) ProtoMessage() {}func (x *ListAllUserStatsResponse) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[12]+ mi := &file_api_v1_user_service_proto_msgTypes[19]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1156,7 +1826,7 @@ func (x *ListAllUserStatsResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListAllUserStatsResponse.ProtoReflect.Descriptor instead.func (*ListAllUserStatsResponse) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{12}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{19}}func (x *ListAllUserStatsResponse) GetStats() []*UserStats {@@ -1185,7 +1855,7 @@ type UserSetting struct {func (x *UserSetting) Reset() {*x = UserSetting{}- mi := &file_api_v1_user_service_proto_msgTypes[13]+ mi := &file_api_v1_user_service_proto_msgTypes[20]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1197,7 +1867,7 @@ func (x *UserSetting) String() string {func (*UserSetting) ProtoMessage() {}func (x *UserSetting) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[13]+ mi := &file_api_v1_user_service_proto_msgTypes[20]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1210,7 +1880,7 @@ func (x *UserSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use UserSetting.ProtoReflect.Descriptor instead.func (*UserSetting) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{13}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{20}}func (x *UserSetting) GetName() string {@@ -1287,7 +1957,7 @@ type GetUserSettingRequest struct {func (x *GetUserSettingRequest) Reset() {*x = GetUserSettingRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[14]+ mi := &file_api_v1_user_service_proto_msgTypes[21]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1299,7 +1969,7 @@ func (x *GetUserSettingRequest) String() string {func (*GetUserSettingRequest) ProtoMessage() {}func (x *GetUserSettingRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[14]+ mi := &file_api_v1_user_service_proto_msgTypes[21]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1312,7 +1982,7 @@ func (x *GetUserSettingRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GetUserSettingRequest.ProtoReflect.Descriptor instead.func (*GetUserSettingRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{14}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{21}}func (x *GetUserSettingRequest) GetName() string {@@ -1334,7 +2004,7 @@ type UpdateUserSettingRequest struct {func (x *UpdateUserSettingRequest) Reset() {*x = UpdateUserSettingRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[15]+ mi := &file_api_v1_user_service_proto_msgTypes[22]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1346,7 +2016,7 @@ func (x *UpdateUserSettingRequest) String() string {func (*UpdateUserSettingRequest) ProtoMessage() {}func (x *UpdateUserSettingRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[15]+ mi := &file_api_v1_user_service_proto_msgTypes[22]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1359,7 +2029,7 @@ func (x *UpdateUserSettingRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateUserSettingRequest.ProtoReflect.Descriptor instead.func (*UpdateUserSettingRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{15}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{22}}func (x *UpdateUserSettingRequest) GetSetting() *UserSetting {@@ -1396,7 +2066,7 @@ type ListUserSettingsRequest struct {func (x *ListUserSettingsRequest) Reset() {*x = ListUserSettingsRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[16]+ mi := &file_api_v1_user_service_proto_msgTypes[23]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1408,7 +2078,7 @@ func (x *ListUserSettingsRequest) String() string {func (*ListUserSettingsRequest) ProtoMessage() {}func (x *ListUserSettingsRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[16]+ mi := &file_api_v1_user_service_proto_msgTypes[23]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1421,7 +2091,7 @@ func (x *ListUserSettingsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListUserSettingsRequest.ProtoReflect.Descriptor instead.func (*ListUserSettingsRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{16}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{23}}func (x *ListUserSettingsRequest) GetParent() string {@@ -1459,7 +2129,7 @@ type ListUserSettingsResponse struct {func (x *ListUserSettingsResponse) Reset() {*x = ListUserSettingsResponse{}- mi := &file_api_v1_user_service_proto_msgTypes[17]+ mi := &file_api_v1_user_service_proto_msgTypes[24]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1471,7 +2141,7 @@ func (x *ListUserSettingsResponse) String() string {func (*ListUserSettingsResponse) ProtoMessage() {}func (x *ListUserSettingsResponse) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[17]+ mi := &file_api_v1_user_service_proto_msgTypes[24]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1484,7 +2154,7 @@ func (x *ListUserSettingsResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListUserSettingsResponse.ProtoReflect.Descriptor instead.func (*ListUserSettingsResponse) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{17}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{24}}func (x *ListUserSettingsResponse) GetSettings() []*UserSetting {@@ -1521,7 +2191,7 @@ type MemoView struct {func (x *MemoView) Reset() {*x = MemoView{}- mi := &file_api_v1_user_service_proto_msgTypes[18]+ mi := &file_api_v1_user_service_proto_msgTypes[25]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1533,7 +2203,7 @@ func (x *MemoView) String() string {func (*MemoView) ProtoMessage() {}func (x *MemoView) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[18]+ mi := &file_api_v1_user_service_proto_msgTypes[25]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1546,7 +2216,7 @@ func (x *MemoView) ProtoReflect() protoreflect.Message {// Deprecated: Use MemoView.ProtoReflect.Descriptor instead.func (*MemoView) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{18}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{25}}func (x *MemoView) GetName() string {@@ -1588,7 +2258,7 @@ type ListMemoViewsRequest struct {func (x *ListMemoViewsRequest) Reset() {*x = ListMemoViewsRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[19]+ mi := &file_api_v1_user_service_proto_msgTypes[26]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1600,7 +2270,7 @@ func (x *ListMemoViewsRequest) String() string {func (*ListMemoViewsRequest) ProtoMessage() {}func (x *ListMemoViewsRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[19]+ mi := &file_api_v1_user_service_proto_msgTypes[26]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1613,7 +2283,7 @@ func (x *ListMemoViewsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListMemoViewsRequest.ProtoReflect.Descriptor instead.func (*ListMemoViewsRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{19}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{26}}func (x *ListMemoViewsRequest) GetParent() string {@@ -1633,7 +2303,7 @@ type ListMemoViewsResponse struct {func (x *ListMemoViewsResponse) Reset() {*x = ListMemoViewsResponse{}- mi := &file_api_v1_user_service_proto_msgTypes[20]+ mi := &file_api_v1_user_service_proto_msgTypes[27]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1645,7 +2315,7 @@ func (x *ListMemoViewsResponse) String() string {func (*ListMemoViewsResponse) ProtoMessage() {}func (x *ListMemoViewsResponse) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[20]+ mi := &file_api_v1_user_service_proto_msgTypes[27]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1658,7 +2328,7 @@ func (x *ListMemoViewsResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListMemoViewsResponse.ProtoReflect.Descriptor instead.func (*ListMemoViewsResponse) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{20}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{27}}func (x *ListMemoViewsResponse) GetMemoViews() []*MemoView {@@ -1679,7 +2349,7 @@ type GetMemoViewRequest struct {func (x *GetMemoViewRequest) Reset() {*x = GetMemoViewRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[21]+ mi := &file_api_v1_user_service_proto_msgTypes[28]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1691,7 +2361,7 @@ func (x *GetMemoViewRequest) String() string {func (*GetMemoViewRequest) ProtoMessage() {}func (x *GetMemoViewRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[21]+ mi := &file_api_v1_user_service_proto_msgTypes[28]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1704,7 +2374,7 @@ func (x *GetMemoViewRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GetMemoViewRequest.ProtoReflect.Descriptor instead.func (*GetMemoViewRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{21}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{28}}func (x *GetMemoViewRequest) GetName() string {@@ -1729,7 +2399,7 @@ type CreateMemoViewRequest struct {func (x *CreateMemoViewRequest) Reset() {*x = CreateMemoViewRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[22]+ mi := &file_api_v1_user_service_proto_msgTypes[29]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1741,7 +2411,7 @@ func (x *CreateMemoViewRequest) String() string {func (*CreateMemoViewRequest) ProtoMessage() {}func (x *CreateMemoViewRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[22]+ mi := &file_api_v1_user_service_proto_msgTypes[29]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1754,7 +2424,7 @@ func (x *CreateMemoViewRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use CreateMemoViewRequest.ProtoReflect.Descriptor instead.func (*CreateMemoViewRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{22}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{29}}func (x *CreateMemoViewRequest) GetParent() string {@@ -1790,7 +2460,7 @@ type UpdateMemoViewRequest struct {func (x *UpdateMemoViewRequest) Reset() {*x = UpdateMemoViewRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[23]+ mi := &file_api_v1_user_service_proto_msgTypes[30]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1802,7 +2472,7 @@ func (x *UpdateMemoViewRequest) String() string {func (*UpdateMemoViewRequest) ProtoMessage() {}func (x *UpdateMemoViewRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[23]+ mi := &file_api_v1_user_service_proto_msgTypes[30]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1815,7 +2485,7 @@ func (x *UpdateMemoViewRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateMemoViewRequest.ProtoReflect.Descriptor instead.func (*UpdateMemoViewRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{23}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{30}}func (x *UpdateMemoViewRequest) GetMemoView() *MemoView {@@ -1843,7 +2513,7 @@ type DeleteMemoViewRequest struct {func (x *DeleteMemoViewRequest) Reset() {*x = DeleteMemoViewRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[24]+ mi := &file_api_v1_user_service_proto_msgTypes[31]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1855,7 +2525,7 @@ func (x *DeleteMemoViewRequest) String() string {func (*DeleteMemoViewRequest) ProtoMessage() {}func (x *DeleteMemoViewRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[24]+ mi := &file_api_v1_user_service_proto_msgTypes[31]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1868,7 +2538,7 @@ func (x *DeleteMemoViewRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use DeleteMemoViewRequest.ProtoReflect.Descriptor instead.func (*DeleteMemoViewRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{24}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{31}}func (x *DeleteMemoViewRequest) GetName() string {@@ -1895,7 +2565,7 @@ type LinkedIdentity struct {func (x *LinkedIdentity) Reset() {*x = LinkedIdentity{}- mi := &file_api_v1_user_service_proto_msgTypes[25]+ mi := &file_api_v1_user_service_proto_msgTypes[32]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1907,7 +2577,7 @@ func (x *LinkedIdentity) String() string {func (*LinkedIdentity) ProtoMessage() {}func (x *LinkedIdentity) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[25]+ mi := &file_api_v1_user_service_proto_msgTypes[32]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1920,7 +2590,7 @@ func (x *LinkedIdentity) ProtoReflect() protoreflect.Message {// Deprecated: Use LinkedIdentity.ProtoReflect.Descriptor instead.func (*LinkedIdentity) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{25}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{32}}func (x *LinkedIdentity) GetName() string {@@ -1955,7 +2625,7 @@ type ListLinkedIdentitiesRequest struct {func (x *ListLinkedIdentitiesRequest) Reset() {*x = ListLinkedIdentitiesRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[26]+ mi := &file_api_v1_user_service_proto_msgTypes[33]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1967,7 +2637,7 @@ func (x *ListLinkedIdentitiesRequest) String() string {func (*ListLinkedIdentitiesRequest) ProtoMessage() {}func (x *ListLinkedIdentitiesRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[26]+ mi := &file_api_v1_user_service_proto_msgTypes[33]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1980,7 +2650,7 @@ func (x *ListLinkedIdentitiesRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListLinkedIdentitiesRequest.ProtoReflect.Descriptor instead.func (*ListLinkedIdentitiesRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{26}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{33}}func (x *ListLinkedIdentitiesRequest) GetParent() string {@@ -2000,7 +2670,7 @@ type ListLinkedIdentitiesResponse struct {func (x *ListLinkedIdentitiesResponse) Reset() {*x = ListLinkedIdentitiesResponse{}- mi := &file_api_v1_user_service_proto_msgTypes[27]+ mi := &file_api_v1_user_service_proto_msgTypes[34]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2012,7 +2682,7 @@ func (x *ListLinkedIdentitiesResponse) String() string {func (*ListLinkedIdentitiesResponse) ProtoMessage() {}func (x *ListLinkedIdentitiesResponse) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[27]+ mi := &file_api_v1_user_service_proto_msgTypes[34]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2025,7 +2695,7 @@ func (x *ListLinkedIdentitiesResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListLinkedIdentitiesResponse.ProtoReflect.Descriptor instead.func (*ListLinkedIdentitiesResponse) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{27}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{34}}func (x *ListLinkedIdentitiesResponse) GetLinkedIdentities() []*LinkedIdentity {@@ -2055,7 +2725,7 @@ type CreateLinkedIdentityRequest struct {func (x *CreateLinkedIdentityRequest) Reset() {*x = CreateLinkedIdentityRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[28]+ mi := &file_api_v1_user_service_proto_msgTypes[35]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2067,7 +2737,7 @@ func (x *CreateLinkedIdentityRequest) String() string {func (*CreateLinkedIdentityRequest) ProtoMessage() {}func (x *CreateLinkedIdentityRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[28]+ mi := &file_api_v1_user_service_proto_msgTypes[35]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2080,7 +2750,7 @@ func (x *CreateLinkedIdentityRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use CreateLinkedIdentityRequest.ProtoReflect.Descriptor instead.func (*CreateLinkedIdentityRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{28}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{35}}func (x *CreateLinkedIdentityRequest) GetParent() string {@@ -2129,7 +2799,7 @@ type GetLinkedIdentityRequest struct {func (x *GetLinkedIdentityRequest) Reset() {*x = GetLinkedIdentityRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[29]+ mi := &file_api_v1_user_service_proto_msgTypes[36]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2141,7 +2811,7 @@ func (x *GetLinkedIdentityRequest) String() string {func (*GetLinkedIdentityRequest) ProtoMessage() {}func (x *GetLinkedIdentityRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[29]+ mi := &file_api_v1_user_service_proto_msgTypes[36]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2154,7 +2824,7 @@ func (x *GetLinkedIdentityRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GetLinkedIdentityRequest.ProtoReflect.Descriptor instead.func (*GetLinkedIdentityRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{29}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{36}}func (x *GetLinkedIdentityRequest) GetName() string {@@ -2175,7 +2845,7 @@ type DeleteLinkedIdentityRequest struct {func (x *DeleteLinkedIdentityRequest) Reset() {*x = DeleteLinkedIdentityRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[30]+ mi := &file_api_v1_user_service_proto_msgTypes[37]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2187,7 +2857,7 @@ func (x *DeleteLinkedIdentityRequest) String() string {func (*DeleteLinkedIdentityRequest) ProtoMessage() {}func (x *DeleteLinkedIdentityRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[30]+ mi := &file_api_v1_user_service_proto_msgTypes[37]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2200,7 +2870,7 @@ func (x *DeleteLinkedIdentityRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use DeleteLinkedIdentityRequest.ProtoReflect.Descriptor instead.func (*DeleteLinkedIdentityRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{30}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{37}}func (x *DeleteLinkedIdentityRequest) GetName() string {@@ -2231,7 +2901,7 @@ type PersonalAccessToken struct {func (x *PersonalAccessToken) Reset() {*x = PersonalAccessToken{}- mi := &file_api_v1_user_service_proto_msgTypes[31]+ mi := &file_api_v1_user_service_proto_msgTypes[38]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2243,7 +2913,7 @@ func (x *PersonalAccessToken) String() string {func (*PersonalAccessToken) ProtoMessage() {}func (x *PersonalAccessToken) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[31]+ mi := &file_api_v1_user_service_proto_msgTypes[38]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2256,7 +2926,7 @@ func (x *PersonalAccessToken) ProtoReflect() protoreflect.Message {// Deprecated: Use PersonalAccessToken.ProtoReflect.Descriptor instead.func (*PersonalAccessToken) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{31}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{38}}func (x *PersonalAccessToken) GetName() string {@@ -2309,7 +2979,7 @@ type ListPersonalAccessTokensRequest struct {func (x *ListPersonalAccessTokensRequest) Reset() {*x = ListPersonalAccessTokensRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[32]+ mi := &file_api_v1_user_service_proto_msgTypes[39]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2321,7 +2991,7 @@ func (x *ListPersonalAccessTokensRequest) String() string {func (*ListPersonalAccessTokensRequest) ProtoMessage() {}func (x *ListPersonalAccessTokensRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[32]+ mi := &file_api_v1_user_service_proto_msgTypes[39]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2334,7 +3004,7 @@ func (x *ListPersonalAccessTokensRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListPersonalAccessTokensRequest.ProtoReflect.Descriptor instead.func (*ListPersonalAccessTokensRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{32}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{39}}func (x *ListPersonalAccessTokensRequest) GetParent() string {@@ -2370,7 +3040,7 @@ type ListPersonalAccessTokensResponse struct {func (x *ListPersonalAccessTokensResponse) Reset() {*x = ListPersonalAccessTokensResponse{}- mi := &file_api_v1_user_service_proto_msgTypes[33]+ mi := &file_api_v1_user_service_proto_msgTypes[40]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2382,7 +3052,7 @@ func (x *ListPersonalAccessTokensResponse) String() string {func (*ListPersonalAccessTokensResponse) ProtoMessage() {}func (x *ListPersonalAccessTokensResponse) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[33]+ mi := &file_api_v1_user_service_proto_msgTypes[40]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2395,7 +3065,7 @@ func (x *ListPersonalAccessTokensResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListPersonalAccessTokensResponse.ProtoReflect.Descriptor instead.func (*ListPersonalAccessTokensResponse) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{33}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{40}}func (x *ListPersonalAccessTokensResponse) GetPersonalAccessTokens() []*PersonalAccessToken {@@ -2427,7 +3097,7 @@ type CreatePersonalAccessTokenRequest struct {func (x *CreatePersonalAccessTokenRequest) Reset() {*x = CreatePersonalAccessTokenRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[34]+ mi := &file_api_v1_user_service_proto_msgTypes[41]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2439,7 +3109,7 @@ func (x *CreatePersonalAccessTokenRequest) String() string {func (*CreatePersonalAccessTokenRequest) ProtoMessage() {}func (x *CreatePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[34]+ mi := &file_api_v1_user_service_proto_msgTypes[41]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2452,7 +3122,7 @@ func (x *CreatePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use CreatePersonalAccessTokenRequest.ProtoReflect.Descriptor instead.func (*CreatePersonalAccessTokenRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{34}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{41}}func (x *CreatePersonalAccessTokenRequest) GetParent() string {@@ -2489,7 +3159,7 @@ type CreatePersonalAccessTokenResponse struct {func (x *CreatePersonalAccessTokenResponse) Reset() {*x = CreatePersonalAccessTokenResponse{}- mi := &file_api_v1_user_service_proto_msgTypes[35]+ mi := &file_api_v1_user_service_proto_msgTypes[42]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2501,7 +3171,7 @@ func (x *CreatePersonalAccessTokenResponse) String() string {func (*CreatePersonalAccessTokenResponse) ProtoMessage() {}func (x *CreatePersonalAccessTokenResponse) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[35]+ mi := &file_api_v1_user_service_proto_msgTypes[42]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2514,7 +3184,7 @@ func (x *CreatePersonalAccessTokenResponse) ProtoReflect() protoreflect.Message// Deprecated: Use CreatePersonalAccessTokenResponse.ProtoReflect.Descriptor instead.func (*CreatePersonalAccessTokenResponse) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{35}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{42}}func (x *CreatePersonalAccessTokenResponse) GetPersonalAccessToken() *PersonalAccessToken {@@ -2542,7 +3212,7 @@ type DeletePersonalAccessTokenRequest struct {func (x *DeletePersonalAccessTokenRequest) Reset() {*x = DeletePersonalAccessTokenRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[36]+ mi := &file_api_v1_user_service_proto_msgTypes[43]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2554,7 +3224,7 @@ func (x *DeletePersonalAccessTokenRequest) String() string {func (*DeletePersonalAccessTokenRequest) ProtoMessage() {}func (x *DeletePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[36]+ mi := &file_api_v1_user_service_proto_msgTypes[43]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2567,7 +3237,7 @@ func (x *DeletePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use DeletePersonalAccessTokenRequest.ProtoReflect.Descriptor instead.func (*DeletePersonalAccessTokenRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{36}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{43}}func (x *DeletePersonalAccessTokenRequest) GetName() string {@@ -2602,7 +3272,7 @@ type UserWebhook struct {func (x *UserWebhook) Reset() {*x = UserWebhook{}- mi := &file_api_v1_user_service_proto_msgTypes[37]+ mi := &file_api_v1_user_service_proto_msgTypes[44]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2614,7 +3284,7 @@ func (x *UserWebhook) String() string {func (*UserWebhook) ProtoMessage() {}func (x *UserWebhook) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[37]+ mi := &file_api_v1_user_service_proto_msgTypes[44]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2627,7 +3297,7 @@ func (x *UserWebhook) ProtoReflect() protoreflect.Message {// Deprecated: Use UserWebhook.ProtoReflect.Descriptor instead.func (*UserWebhook) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{37}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{44}}func (x *UserWebhook) GetName() string {@@ -2690,7 +3360,7 @@ type ListUserWebhooksRequest struct {func (x *ListUserWebhooksRequest) Reset() {*x = ListUserWebhooksRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[38]+ mi := &file_api_v1_user_service_proto_msgTypes[45]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2702,7 +3372,7 @@ func (x *ListUserWebhooksRequest) String() string {func (*ListUserWebhooksRequest) ProtoMessage() {}func (x *ListUserWebhooksRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[38]+ mi := &file_api_v1_user_service_proto_msgTypes[45]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2715,7 +3385,7 @@ func (x *ListUserWebhooksRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListUserWebhooksRequest.ProtoReflect.Descriptor instead.func (*ListUserWebhooksRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{38}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{45}}func (x *ListUserWebhooksRequest) GetParent() string {@@ -2735,7 +3405,7 @@ type ListUserWebhooksResponse struct {func (x *ListUserWebhooksResponse) Reset() {*x = ListUserWebhooksResponse{}- mi := &file_api_v1_user_service_proto_msgTypes[39]+ mi := &file_api_v1_user_service_proto_msgTypes[46]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2747,7 +3417,7 @@ func (x *ListUserWebhooksResponse) String() string {func (*ListUserWebhooksResponse) ProtoMessage() {}func (x *ListUserWebhooksResponse) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[39]+ mi := &file_api_v1_user_service_proto_msgTypes[46]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2760,7 +3430,7 @@ func (x *ListUserWebhooksResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListUserWebhooksResponse.ProtoReflect.Descriptor instead.func (*ListUserWebhooksResponse) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{39}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{46}}func (x *ListUserWebhooksResponse) GetWebhooks() []*UserWebhook {@@ -2783,7 +3453,7 @@ type CreateUserWebhookRequest struct {func (x *CreateUserWebhookRequest) Reset() {*x = CreateUserWebhookRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[40]+ mi := &file_api_v1_user_service_proto_msgTypes[47]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2795,7 +3465,7 @@ func (x *CreateUserWebhookRequest) String() string {func (*CreateUserWebhookRequest) ProtoMessage() {}func (x *CreateUserWebhookRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[40]+ mi := &file_api_v1_user_service_proto_msgTypes[47]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2808,7 +3478,7 @@ func (x *CreateUserWebhookRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use CreateUserWebhookRequest.ProtoReflect.Descriptor instead.func (*CreateUserWebhookRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{40}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{47}}func (x *CreateUserWebhookRequest) GetParent() string {@@ -2837,7 +3507,7 @@ type UpdateUserWebhookRequest struct {func (x *UpdateUserWebhookRequest) Reset() {*x = UpdateUserWebhookRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[41]+ mi := &file_api_v1_user_service_proto_msgTypes[48]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2849,7 +3519,7 @@ func (x *UpdateUserWebhookRequest) String() string {func (*UpdateUserWebhookRequest) ProtoMessage() {}func (x *UpdateUserWebhookRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[41]+ mi := &file_api_v1_user_service_proto_msgTypes[48]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2862,7 +3532,7 @@ func (x *UpdateUserWebhookRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateUserWebhookRequest.ProtoReflect.Descriptor instead.func (*UpdateUserWebhookRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{41}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{48}}func (x *UpdateUserWebhookRequest) GetWebhook() *UserWebhook {@@ -2890,7 +3560,7 @@ type DeleteUserWebhookRequest struct {func (x *DeleteUserWebhookRequest) Reset() {*x = DeleteUserWebhookRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[42]+ mi := &file_api_v1_user_service_proto_msgTypes[49]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2902,7 +3572,7 @@ func (x *DeleteUserWebhookRequest) String() string {func (*DeleteUserWebhookRequest) ProtoMessage() {}func (x *DeleteUserWebhookRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[42]+ mi := &file_api_v1_user_service_proto_msgTypes[49]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2915,7 +3585,7 @@ func (x *DeleteUserWebhookRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use DeleteUserWebhookRequest.ProtoReflect.Descriptor instead.func (*DeleteUserWebhookRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{42}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{49}}func (x *DeleteUserWebhookRequest) GetName() string {@@ -2936,7 +3606,7 @@ type GetUserWebhookSigningSecretRequest struct {func (x *GetUserWebhookSigningSecretRequest) Reset() {*x = GetUserWebhookSigningSecretRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[43]+ mi := &file_api_v1_user_service_proto_msgTypes[50]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2948,7 +3618,7 @@ func (x *GetUserWebhookSigningSecretRequest) String() string {func (*GetUserWebhookSigningSecretRequest) ProtoMessage() {}func (x *GetUserWebhookSigningSecretRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[43]+ mi := &file_api_v1_user_service_proto_msgTypes[50]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2961,7 +3631,7 @@ func (x *GetUserWebhookSigningSecretRequest) ProtoReflect() protoreflect.Message// Deprecated: Use GetUserWebhookSigningSecretRequest.ProtoReflect.Descriptor instead.func (*GetUserWebhookSigningSecretRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{43}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{50}}func (x *GetUserWebhookSigningSecretRequest) GetName() string {@@ -2981,7 +3651,7 @@ type GetUserWebhookSigningSecretResponse struct {func (x *GetUserWebhookSigningSecretResponse) Reset() {*x = GetUserWebhookSigningSecretResponse{}- mi := &file_api_v1_user_service_proto_msgTypes[44]+ mi := &file_api_v1_user_service_proto_msgTypes[51]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2993,7 +3663,7 @@ func (x *GetUserWebhookSigningSecretResponse) String() string {func (*GetUserWebhookSigningSecretResponse) ProtoMessage() {}func (x *GetUserWebhookSigningSecretResponse) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[44]+ mi := &file_api_v1_user_service_proto_msgTypes[51]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3006,7 +3676,7 @@ func (x *GetUserWebhookSigningSecretResponse) ProtoReflect() protoreflect.Messag// Deprecated: Use GetUserWebhookSigningSecretResponse.ProtoReflect.Descriptor instead.func (*GetUserWebhookSigningSecretResponse) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{44}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{51}}func (x *GetUserWebhookSigningSecretResponse) GetSigningSecret() string {@@ -3044,7 +3714,7 @@ type UserNotification struct {func (x *UserNotification) Reset() {*x = UserNotification{}- mi := &file_api_v1_user_service_proto_msgTypes[45]+ mi := &file_api_v1_user_service_proto_msgTypes[52]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3056,7 +3726,7 @@ func (x *UserNotification) String() string {func (*UserNotification) ProtoMessage() {}func (x *UserNotification) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[45]+ mi := &file_api_v1_user_service_proto_msgTypes[52]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3069,7 +3739,7 @@ func (x *UserNotification) ProtoReflect() protoreflect.Message {// Deprecated: Use UserNotification.ProtoReflect.Descriptor instead.func (*UserNotification) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{45}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{52}}func (x *UserNotification) GetName() string {@@ -3184,7 +3854,7 @@ type ListUserNotificationsRequest struct {func (x *ListUserNotificationsRequest) Reset() {*x = ListUserNotificationsRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[46]+ mi := &file_api_v1_user_service_proto_msgTypes[53]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3196,7 +3866,7 @@ func (x *ListUserNotificationsRequest) String() string {func (*ListUserNotificationsRequest) ProtoMessage() {}func (x *ListUserNotificationsRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[46]+ mi := &file_api_v1_user_service_proto_msgTypes[53]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3209,7 +3879,7 @@ func (x *ListUserNotificationsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListUserNotificationsRequest.ProtoReflect.Descriptor instead.func (*ListUserNotificationsRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{46}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{53}}func (x *ListUserNotificationsRequest) GetParent() string {@@ -3250,7 +3920,7 @@ type ListUserNotificationsResponse struct {func (x *ListUserNotificationsResponse) Reset() {*x = ListUserNotificationsResponse{}- mi := &file_api_v1_user_service_proto_msgTypes[47]+ mi := &file_api_v1_user_service_proto_msgTypes[54]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3262,7 +3932,7 @@ func (x *ListUserNotificationsResponse) String() string {func (*ListUserNotificationsResponse) ProtoMessage() {}func (x *ListUserNotificationsResponse) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[47]+ mi := &file_api_v1_user_service_proto_msgTypes[54]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3275,7 +3945,7 @@ func (x *ListUserNotificationsResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListUserNotificationsResponse.ProtoReflect.Descriptor instead.func (*ListUserNotificationsResponse) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{47}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{54}}func (x *ListUserNotificationsResponse) GetNotifications() []*UserNotification {@@ -3302,7 +3972,7 @@ type UpdateUserNotificationRequest struct {func (x *UpdateUserNotificationRequest) Reset() {*x = UpdateUserNotificationRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[48]+ mi := &file_api_v1_user_service_proto_msgTypes[55]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3314,7 +3984,7 @@ func (x *UpdateUserNotificationRequest) String() string {func (*UpdateUserNotificationRequest) ProtoMessage() {}func (x *UpdateUserNotificationRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[48]+ mi := &file_api_v1_user_service_proto_msgTypes[55]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3327,7 +3997,7 @@ func (x *UpdateUserNotificationRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateUserNotificationRequest.ProtoReflect.Descriptor instead.func (*UpdateUserNotificationRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{48}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{55}}func (x *UpdateUserNotificationRequest) GetNotification() *UserNotification {@@ -3354,7 +4024,7 @@ type DeleteUserNotificationRequest struct {func (x *DeleteUserNotificationRequest) Reset() {*x = DeleteUserNotificationRequest{}- mi := &file_api_v1_user_service_proto_msgTypes[49]+ mi := &file_api_v1_user_service_proto_msgTypes[56]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3366,7 +4036,7 @@ func (x *DeleteUserNotificationRequest) String() string {func (*DeleteUserNotificationRequest) ProtoMessage() {}func (x *DeleteUserNotificationRequest) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[49]+ mi := &file_api_v1_user_service_proto_msgTypes[56]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3379,7 +4049,7 @@ func (x *DeleteUserNotificationRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use DeleteUserNotificationRequest.ProtoReflect.Descriptor instead.func (*DeleteUserNotificationRequest) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{49}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{56}}func (x *DeleteUserNotificationRequest) GetName() string {@@ -3402,7 +4072,7 @@ type UserStats_MemoTypeStats struct {func (x *UserStats_MemoTypeStats) Reset() {*x = UserStats_MemoTypeStats{}- mi := &file_api_v1_user_service_proto_msgTypes[51]+ mi := &file_api_v1_user_service_proto_msgTypes[58]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3414,7 +4084,7 @@ func (x *UserStats_MemoTypeStats) String() string {func (*UserStats_MemoTypeStats) ProtoMessage() {}func (x *UserStats_MemoTypeStats) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[51]+ mi := &file_api_v1_user_service_proto_msgTypes[58]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3477,7 +4147,7 @@ type UserSetting_GeneralSetting struct {func (x *UserSetting_GeneralSetting) Reset() {*x = UserSetting_GeneralSetting{}- mi := &file_api_v1_user_service_proto_msgTypes[52]+ mi := &file_api_v1_user_service_proto_msgTypes[59]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3489,7 +4159,7 @@ func (x *UserSetting_GeneralSetting) String() string {func (*UserSetting_GeneralSetting) ProtoMessage() {}func (x *UserSetting_GeneralSetting) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[52]+ mi := &file_api_v1_user_service_proto_msgTypes[59]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3502,7 +4172,7 @@ func (x *UserSetting_GeneralSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use UserSetting_GeneralSetting.ProtoReflect.Descriptor instead.func (*UserSetting_GeneralSetting) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{13, 0}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 0}}func (x *UserSetting_GeneralSetting) GetLocale() string {@@ -3547,7 +4217,7 @@ type UserSetting_TagMetadata struct {func (x *UserSetting_TagMetadata) Reset() {*x = UserSetting_TagMetadata{}- mi := &file_api_v1_user_service_proto_msgTypes[53]+ mi := &file_api_v1_user_service_proto_msgTypes[60]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3559,7 +4229,7 @@ func (x *UserSetting_TagMetadata) String() string {func (*UserSetting_TagMetadata) ProtoMessage() {}func (x *UserSetting_TagMetadata) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[53]+ mi := &file_api_v1_user_service_proto_msgTypes[60]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3572,7 +4242,7 @@ func (x *UserSetting_TagMetadata) ProtoReflect() protoreflect.Message {// Deprecated: Use UserSetting_TagMetadata.ProtoReflect.Descriptor instead.func (*UserSetting_TagMetadata) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{13, 1}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 1}}func (x *UserSetting_TagMetadata) GetBackgroundColor() *color.Color {@@ -3601,7 +4271,7 @@ type UserSetting_TagsSetting struct {func (x *UserSetting_TagsSetting) Reset() {*x = UserSetting_TagsSetting{}- mi := &file_api_v1_user_service_proto_msgTypes[54]+ mi := &file_api_v1_user_service_proto_msgTypes[61]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3613,7 +4283,7 @@ func (x *UserSetting_TagsSetting) String() string {func (*UserSetting_TagsSetting) ProtoMessage() {}func (x *UserSetting_TagsSetting) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[54]+ mi := &file_api_v1_user_service_proto_msgTypes[61]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3626,7 +4296,7 @@ func (x *UserSetting_TagsSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use UserSetting_TagsSetting.ProtoReflect.Descriptor instead.func (*UserSetting_TagsSetting) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{13, 2}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 2}}func (x *UserSetting_TagsSetting) GetTags() map[string]*UserSetting_TagMetadata {@@ -3647,7 +4317,7 @@ type UserSetting_WebhooksSetting struct {func (x *UserSetting_WebhooksSetting) Reset() {*x = UserSetting_WebhooksSetting{}- mi := &file_api_v1_user_service_proto_msgTypes[55]+ mi := &file_api_v1_user_service_proto_msgTypes[62]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3659,7 +4329,7 @@ func (x *UserSetting_WebhooksSetting) String() string {func (*UserSetting_WebhooksSetting) ProtoMessage() {}func (x *UserSetting_WebhooksSetting) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[55]+ mi := &file_api_v1_user_service_proto_msgTypes[62]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3672,7 +4342,7 @@ func (x *UserSetting_WebhooksSetting) ProtoReflect() protoreflect.Message {// Deprecated: Use UserSetting_WebhooksSetting.ProtoReflect.Descriptor instead.func (*UserSetting_WebhooksSetting) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{13, 3}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 3}}func (x *UserSetting_WebhooksSetting) GetWebhooks() []*UserWebhook {@@ -3695,7 +4365,7 @@ type MemoView_Icon struct {func (x *MemoView_Icon) Reset() {*x = MemoView_Icon{}- mi := &file_api_v1_user_service_proto_msgTypes[57]+ mi := &file_api_v1_user_service_proto_msgTypes[64]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3707,7 +4377,7 @@ func (x *MemoView_Icon) String() string {func (*MemoView_Icon) ProtoMessage() {}func (x *MemoView_Icon) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[57]+ mi := &file_api_v1_user_service_proto_msgTypes[64]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3720,7 +4390,7 @@ func (x *MemoView_Icon) ProtoReflect() protoreflect.Message {// Deprecated: Use MemoView_Icon.ProtoReflect.Descriptor instead.func (*MemoView_Icon) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{18, 0}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{25, 0}}func (x *MemoView_Icon) GetValue() isMemoView_Icon_Value {@@ -3784,7 +4454,7 @@ type UserNotification_MemoCommentPayload struct {func (x *UserNotification_MemoCommentPayload) Reset() {*x = UserNotification_MemoCommentPayload{}- mi := &file_api_v1_user_service_proto_msgTypes[58]+ mi := &file_api_v1_user_service_proto_msgTypes[65]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3796,7 +4466,7 @@ func (x *UserNotification_MemoCommentPayload) String() string {func (*UserNotification_MemoCommentPayload) ProtoMessage() {}func (x *UserNotification_MemoCommentPayload) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[58]+ mi := &file_api_v1_user_service_proto_msgTypes[65]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3809,7 +4479,7 @@ func (x *UserNotification_MemoCommentPayload) ProtoReflect() protoreflect.Messag// Deprecated: Use UserNotification_MemoCommentPayload.ProtoReflect.Descriptor instead.func (*UserNotification_MemoCommentPayload) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{45, 0}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 0}}func (x *UserNotification_MemoCommentPayload) GetMemo() string {@@ -3858,7 +4528,7 @@ type UserNotification_MemoMentionPayload struct {func (x *UserNotification_MemoMentionPayload) Reset() {*x = UserNotification_MemoMentionPayload{}- mi := &file_api_v1_user_service_proto_msgTypes[59]+ mi := &file_api_v1_user_service_proto_msgTypes[66]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3870,7 +4540,7 @@ func (x *UserNotification_MemoMentionPayload) String() string {func (*UserNotification_MemoMentionPayload) ProtoMessage() {}func (x *UserNotification_MemoMentionPayload) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[59]+ mi := &file_api_v1_user_service_proto_msgTypes[66]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3883,7 +4553,7 @@ func (x *UserNotification_MemoMentionPayload) ProtoReflect() protoreflect.Messag// Deprecated: Use UserNotification_MemoMentionPayload.ProtoReflect.Descriptor instead.func (*UserNotification_MemoMentionPayload) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{45, 1}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 1}}func (x *UserNotification_MemoMentionPayload) GetMemo() string {@@ -3931,7 +4601,7 @@ type UserNotification_SpaceInvitationPayload struct {func (x *UserNotification_SpaceInvitationPayload) Reset() {*x = UserNotification_SpaceInvitationPayload{}- mi := &file_api_v1_user_service_proto_msgTypes[60]+ mi := &file_api_v1_user_service_proto_msgTypes[67]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -3943,7 +4613,7 @@ func (x *UserNotification_SpaceInvitationPayload) String() string {func (*UserNotification_SpaceInvitationPayload) ProtoMessage() {}func (x *UserNotification_SpaceInvitationPayload) ProtoReflect() protoreflect.Message {- mi := &file_api_v1_user_service_proto_msgTypes[60]+ mi := &file_api_v1_user_service_proto_msgTypes[67]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -3956,7 +4626,7 @@ func (x *UserNotification_SpaceInvitationPayload) ProtoReflect() protoreflect.Me// Deprecated: Use UserNotification_SpaceInvitationPayload.ProtoReflect.Descriptor instead.func (*UserNotification_SpaceInvitationPayload) Descriptor() ([]byte, []int) {- return file_api_v1_user_service_proto_rawDescGZIP(), []int{45, 2}+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 2}}func (x *UserNotification_SpaceInvitationPayload) GetSpaceInvitation() string {@@ -3991,7 +4661,7 @@ var File_api_v1_user_service_proto protoreflect.FileDescriptorconst file_api_v1_user_service_proto_rawDesc = "" +"\n" +- "\x19api/v1/user_service.proto\x12\fmemos.api.v1\x1a\x13api/v1/common.proto\x1a\x1aapi/v1/space_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/color.proto\"\xc1\x04\n" ++ "\x19api/v1/user_service.proto\x12\fmemos.api.v1\x1a\x13api/v1/common.proto\x1a\x1aapi/v1/space_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/color.proto\"\xc1\x04\n" +"\x04User\x12\x17\n" +"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x120\n" +"\x04role\x18\x02 \x01(\x0e2\x17.memos.api.v1.User.RoleB\x03\xe0A\x02R\x04role\x12\x1f\n" +@@ -4068,7 +4738,57 @@ const file_api_v1_user_service_proto_rawDesc = "" +"\n" +"undo_count\x18\x04 \x01(\x05R\tundoCount:E\xeaAB\n" +"\x16memos.api.v1/UserStats\x12\x12users/{user}/stats*\tuserStats2\tuserStatsB\x1b\n" +- "\x19_attachment_storage_bytesJ\x04\b\x02\x10\x03R\x17memo_display_timestamps\"z\n" ++ "\x19_attachment_storage_bytesJ\x04\b\x02\x10\x03R\x17memo_display_timestamps\"C\n" ++ "\x12ExportMemosRequest\x12-\n" ++ "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" ++ "\x11memos.api.v1/UserR\x04name\"\xec\x03\n" ++ "\x12ImportMemosRequest\x12-\n" ++ "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" ++ "\x11memos.api.v1/UserR\x04name\x123\n" ++ "\x04spec\x18\x02 \x01(\v2\x1d.memos.api.v1.ImportMemosSpecH\x00R\x04spec\x12\x1d\n" ++ "\tupload_id\x18\x03 \x01(\tH\x00R\buploadId\x12&\n" ++ "\fwrite_offset\x18\x04 \x01(\x03B\x03\xe0A\x02R\vwriteOffset\x12\x17\n" ++ "\x04data\x18\x05 \x01(\fB\x03\xe0A\x01R\x04data\x12&\n" ++ "\ffinish_write\x18\x06 \x01(\bB\x03\xe0A\x01R\vfinishWrite\x12(\n" ++ "\rvalidate_only\x18\a \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12]\n" ++ "\x0fconflict_policy\x18\b \x01(\x0e2/.memos.api.v1.ImportMemosRequest.ConflictPolicyB\x03\xe0A\x01R\x0econflictPolicy\"W\n" ++ "\x0eConflictPolicy\x12\x1f\n" ++ "\x1bCONFLICT_POLICY_UNSPECIFIED\x10\x00\x12\b\n" ++ "\x04SKIP\x10\x01\x12\v\n" ++ "\aREPLACE\x10\x02\x12\r\n" ++ "\tDUPLICATE\x10\x03B\b\n" ++ "\x06upload\"5\n" ++ "\x0fImportMemosSpec\x12\"\n" ++ "\n" ++ "total_size\x18\x01 \x01(\x03B\x03\xe0A\x01R\ttotalSize\"\xf7\x01\n" ++ "\x13ImportMemosResponse\x12\x1b\n" ++ "\tupload_id\x18\x01 \x01(\tR\buploadId\x12%\n" ++ "\x0ecommitted_size\x18\x02 \x01(\x03R\rcommittedSize\x12$\n" ++ "\x0emax_chunk_size\x18\x03 \x01(\x05R\fmaxChunkSize\x122\n" ++ "\x04plan\x18\x04 \x01(\v2\x1c.memos.api.v1.MemoImportPlanH\x00R\x04plan\x128\n" ++ "\x06report\x18\x05 \x01(\v2\x1e.memos.api.v1.MemoImportReportH\x00R\x06reportB\b\n" ++ "\x06result\"?\n" ++ "\x0fMemoImportIssue\x12\x12\n" ++ "\x04memo\x18\x01 \x01(\tR\x04memo\x12\x18\n" ++ "\amessage\x18\x02 \x01(\tR\amessage\"\xc2\x02\n" ++ "\x0eMemoImportPlan\x12;\n" ++ "\vexport_time\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\n" ++ "exportTime\x12\x1a\n" ++ "\bexporter\x18\x02 \x01(\tR\bexporter\x12\x1c\n" ++ "\tgenerator\x18\x03 \x01(\tR\tgenerator\x12\x14\n" ++ "\x05memos\x18\x04 \x01(\x05R\x05memos\x12 \n" ++ "\vattachments\x18\x05 \x01(\x05R\vattachments\x12\x10\n" ++ "\x03new\x18\x06 \x01(\x05R\x03new\x12\x1a\n" ++ "\bexisting\x18\a \x01(\x05R\bexisting\x12\x18\n" ++ "\arenamed\x18\b \x01(\x05R\arenamed\x129\n" ++ "\bwarnings\x18\t \x03(\v2\x1d.memos.api.v1.MemoImportIssueR\bwarnings\"\xee\x01\n" ++ "\x10MemoImportReport\x12\x18\n" ++ "\acreated\x18\x01 \x01(\x05R\acreated\x12\x18\n" ++ "\aupdated\x18\x02 \x01(\x05R\aupdated\x12\x18\n" ++ "\askipped\x18\x03 \x01(\x05R\askipped\x12\x16\n" ++ "\x06failed\x18\x04 \x01(\x05R\x06failed\x129\n" ++ "\bwarnings\x18\x05 \x03(\v2\x1d.memos.api.v1.MemoImportIssueR\bwarnings\x129\n" ++ "\bfailures\x18\x06 \x03(\v2\x1d.memos.api.v1.MemoImportIssueR\bfailures\"z\n" +"\x13GetUserStatsRequest\x12-\n" +"\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" +"\x11memos.api.v1/UserR\x04name\x12\x1b\n" +@@ -4299,7 +5019,7 @@ const file_api_v1_user_service_proto_rawDesc = "" +"updateMask\"Z\n" +"\x1dDeleteUserNotificationRequest\x129\n" +"\x04name\x18\x01 \x01(\tB%\xe0A\x02\xfaA\x1f\n" +- "\x1dmemos.api.v1/UserNotificationR\x04name2\x8f$\n" ++ "\x1dmemos.api.v1/UserNotificationR\x04name2\x8d&\n" +"\vUserService\x12c\n" +"\tListUsers\x12\x1e.memos.api.v1.ListUsersRequest\x1a\x1f.memos.api.v1.ListUsersResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/api/v1/users\x12{\n" +"\rBatchGetUsers\x12\".memos.api.v1.BatchGetUsersRequest\x1a#.memos.api.v1.BatchGetUsersResponse\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/api/v1/users:batchGet\x12b\n" +@@ -4311,7 +5031,9 @@ const file_api_v1_user_service_proto_rawDesc = "" +"\n" +"DeleteUser\x12\x1f.memos.api.v1.DeleteUserRequest\x1a\x16.google.protobuf.Empty\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18*\x16/api/v1/{name=users/*}\x12~\n" +"\x10ListAllUserStats\x12%.memos.api.v1.ListAllUserStatsRequest\x1a&.memos.api.v1.ListAllUserStatsResponse\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/api/v1/users:stats\x12z\n" +- "\fGetUserStats\x12!.memos.api.v1.GetUserStatsRequest\x1a\x17.memos.api.v1.UserStats\".\xdaA\x04name\x82\xd3\xe4\x93\x02!\x12\x1f/api/v1/{name=users/*}:getStats\x12\x82\x01\n" ++ "\fGetUserStats\x12!.memos.api.v1.GetUserStatsRequest\x1a\x17.memos.api.v1.UserStats\".\xdaA\x04name\x82\xd3\xe4\x93\x02!\x12\x1f/api/v1/{name=users/*}:getStats\x12x\n" ++ "\vExportMemos\x12 .memos.api.v1.ExportMemosRequest\x1a\x14.google.api.HttpBody\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$\x12\"/api/v1/{name=users/*}:exportMemos\x12\x81\x01\n" ++ "\vImportMemos\x12 .memos.api.v1.ImportMemosRequest\x1a!.memos.api.v1.ImportMemosResponse\"-\x82\xd3\xe4\x93\x02':\x01*\"\"/api/v1/{name=users/*}:importMemos\x12\x82\x01\n" +"\x0eGetUserSetting\x12#.memos.api.v1.GetUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#\x12!/api/v1/{name=users/*/settings/*}\x12\xa8\x01\n" +"\x11UpdateUserSetting\x12&.memos.api.v1.UpdateUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"P\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x024:\asetting2)/api/v1/{setting.name=users/*/settings/*}\x12\x95\x01\n" +"\x10ListUserSettings\x12%.memos.api.v1.ListUserSettingsRequest\x1a&.memos.api.v1.ListUserSettingsResponse\"2\xdaA\x06parent\x82\xd3\xe4\x93\x02#\x12!/api/v1/{parent=users/*}/settings\x12\x89\x01\n" +@@ -4349,207 +5071,228 @@ func file_api_v1_user_service_proto_rawDescGZIP() []byte {return file_api_v1_user_service_proto_rawDescData}-var file_api_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 5)-var file_api_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 61)+var file_api_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6)+var file_api_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 68)var file_api_v1_user_service_proto_goTypes = []any{(User_Role)(0), // 0: memos.api.v1.User.Role- (UserSetting_Key)(0), // 1: memos.api.v1.UserSetting.Key- (UserNotification_Status)(0), // 2: memos.api.v1.UserNotification.Status- (UserNotification_Type)(0), // 3: memos.api.v1.UserNotification.Type- (UserNotification_SpaceInvitationPayload_State)(0), // 4: memos.api.v1.UserNotification.SpaceInvitationPayload.State- (*User)(nil), // 5: memos.api.v1.User- (*ListUsersRequest)(nil), // 6: memos.api.v1.ListUsersRequest- (*ListUsersResponse)(nil), // 7: memos.api.v1.ListUsersResponse- (*BatchGetUsersRequest)(nil), // 8: memos.api.v1.BatchGetUsersRequest- (*BatchGetUsersResponse)(nil), // 9: memos.api.v1.BatchGetUsersResponse- (*GetUserRequest)(nil), // 10: memos.api.v1.GetUserRequest- (*CreateUserRequest)(nil), // 11: memos.api.v1.CreateUserRequest- (*UpdateUserRequest)(nil), // 12: memos.api.v1.UpdateUserRequest- (*DeleteUserRequest)(nil), // 13: memos.api.v1.DeleteUserRequest- (*UserStats)(nil), // 14: memos.api.v1.UserStats- (*GetUserStatsRequest)(nil), // 15: memos.api.v1.GetUserStatsRequest- (*ListAllUserStatsRequest)(nil), // 16: memos.api.v1.ListAllUserStatsRequest- (*ListAllUserStatsResponse)(nil), // 17: memos.api.v1.ListAllUserStatsResponse- (*UserSetting)(nil), // 18: memos.api.v1.UserSetting- (*GetUserSettingRequest)(nil), // 19: memos.api.v1.GetUserSettingRequest- (*UpdateUserSettingRequest)(nil), // 20: memos.api.v1.UpdateUserSettingRequest- (*ListUserSettingsRequest)(nil), // 21: memos.api.v1.ListUserSettingsRequest- (*ListUserSettingsResponse)(nil), // 22: memos.api.v1.ListUserSettingsResponse- (*MemoView)(nil), // 23: memos.api.v1.MemoView- (*ListMemoViewsRequest)(nil), // 24: memos.api.v1.ListMemoViewsRequest- (*ListMemoViewsResponse)(nil), // 25: memos.api.v1.ListMemoViewsResponse- (*GetMemoViewRequest)(nil), // 26: memos.api.v1.GetMemoViewRequest- (*CreateMemoViewRequest)(nil), // 27: memos.api.v1.CreateMemoViewRequest- (*UpdateMemoViewRequest)(nil), // 28: memos.api.v1.UpdateMemoViewRequest- (*DeleteMemoViewRequest)(nil), // 29: memos.api.v1.DeleteMemoViewRequest- (*LinkedIdentity)(nil), // 30: memos.api.v1.LinkedIdentity- (*ListLinkedIdentitiesRequest)(nil), // 31: memos.api.v1.ListLinkedIdentitiesRequest- (*ListLinkedIdentitiesResponse)(nil), // 32: memos.api.v1.ListLinkedIdentitiesResponse- (*CreateLinkedIdentityRequest)(nil), // 33: memos.api.v1.CreateLinkedIdentityRequest- (*GetLinkedIdentityRequest)(nil), // 34: memos.api.v1.GetLinkedIdentityRequest- (*DeleteLinkedIdentityRequest)(nil), // 35: memos.api.v1.DeleteLinkedIdentityRequest- (*PersonalAccessToken)(nil), // 36: memos.api.v1.PersonalAccessToken- (*ListPersonalAccessTokensRequest)(nil), // 37: memos.api.v1.ListPersonalAccessTokensRequest- (*ListPersonalAccessTokensResponse)(nil), // 38: memos.api.v1.ListPersonalAccessTokensResponse- (*CreatePersonalAccessTokenRequest)(nil), // 39: memos.api.v1.CreatePersonalAccessTokenRequest- (*CreatePersonalAccessTokenResponse)(nil), // 40: memos.api.v1.CreatePersonalAccessTokenResponse- (*DeletePersonalAccessTokenRequest)(nil), // 41: memos.api.v1.DeletePersonalAccessTokenRequest- (*UserWebhook)(nil), // 42: memos.api.v1.UserWebhook- (*ListUserWebhooksRequest)(nil), // 43: memos.api.v1.ListUserWebhooksRequest- (*ListUserWebhooksResponse)(nil), // 44: memos.api.v1.ListUserWebhooksResponse- (*CreateUserWebhookRequest)(nil), // 45: memos.api.v1.CreateUserWebhookRequest- (*UpdateUserWebhookRequest)(nil), // 46: memos.api.v1.UpdateUserWebhookRequest- (*DeleteUserWebhookRequest)(nil), // 47: memos.api.v1.DeleteUserWebhookRequest- (*GetUserWebhookSigningSecretRequest)(nil), // 48: memos.api.v1.GetUserWebhookSigningSecretRequest- (*GetUserWebhookSigningSecretResponse)(nil), // 49: memos.api.v1.GetUserWebhookSigningSecretResponse- (*UserNotification)(nil), // 50: memos.api.v1.UserNotification- (*ListUserNotificationsRequest)(nil), // 51: memos.api.v1.ListUserNotificationsRequest- (*ListUserNotificationsResponse)(nil), // 52: memos.api.v1.ListUserNotificationsResponse- (*UpdateUserNotificationRequest)(nil), // 53: memos.api.v1.UpdateUserNotificationRequest- (*DeleteUserNotificationRequest)(nil), // 54: memos.api.v1.DeleteUserNotificationRequest- nil, // 55: memos.api.v1.UserStats.TagCountEntry- (*UserStats_MemoTypeStats)(nil), // 56: memos.api.v1.UserStats.MemoTypeStats- (*UserSetting_GeneralSetting)(nil), // 57: memos.api.v1.UserSetting.GeneralSetting- (*UserSetting_TagMetadata)(nil), // 58: memos.api.v1.UserSetting.TagMetadata- (*UserSetting_TagsSetting)(nil), // 59: memos.api.v1.UserSetting.TagsSetting- (*UserSetting_WebhooksSetting)(nil), // 60: memos.api.v1.UserSetting.WebhooksSetting- nil, // 61: memos.api.v1.UserSetting.TagsSetting.TagsEntry- (*MemoView_Icon)(nil), // 62: memos.api.v1.MemoView.Icon- (*UserNotification_MemoCommentPayload)(nil), // 63: memos.api.v1.UserNotification.MemoCommentPayload- (*UserNotification_MemoMentionPayload)(nil), // 64: memos.api.v1.UserNotification.MemoMentionPayload- (*UserNotification_SpaceInvitationPayload)(nil), // 65: memos.api.v1.UserNotification.SpaceInvitationPayload- (State)(0), // 66: memos.api.v1.State- (*timestamppb.Timestamp)(nil), // 67: google.protobuf.Timestamp- (*fieldmaskpb.FieldMask)(nil), // 68: google.protobuf.FieldMask- (*color.Color)(nil), // 69: google.type.Color- (*Space)(nil), // 70: memos.api.v1.Space- (SpaceMember_Role)(0), // 71: memos.api.v1.SpaceMember.Role- (*emptypb.Empty)(nil), // 72: google.protobuf.Empty+ (ImportMemosRequest_ConflictPolicy)(0), // 1: memos.api.v1.ImportMemosRequest.ConflictPolicy+ (UserSetting_Key)(0), // 2: memos.api.v1.UserSetting.Key+ (UserNotification_Status)(0), // 3: memos.api.v1.UserNotification.Status+ (UserNotification_Type)(0), // 4: memos.api.v1.UserNotification.Type+ (UserNotification_SpaceInvitationPayload_State)(0), // 5: memos.api.v1.UserNotification.SpaceInvitationPayload.State+ (*User)(nil), // 6: memos.api.v1.User+ (*ListUsersRequest)(nil), // 7: memos.api.v1.ListUsersRequest+ (*ListUsersResponse)(nil), // 8: memos.api.v1.ListUsersResponse+ (*BatchGetUsersRequest)(nil), // 9: memos.api.v1.BatchGetUsersRequest+ (*BatchGetUsersResponse)(nil), // 10: memos.api.v1.BatchGetUsersResponse+ (*GetUserRequest)(nil), // 11: memos.api.v1.GetUserRequest+ (*CreateUserRequest)(nil), // 12: memos.api.v1.CreateUserRequest+ (*UpdateUserRequest)(nil), // 13: memos.api.v1.UpdateUserRequest+ (*DeleteUserRequest)(nil), // 14: memos.api.v1.DeleteUserRequest+ (*UserStats)(nil), // 15: memos.api.v1.UserStats+ (*ExportMemosRequest)(nil), // 16: memos.api.v1.ExportMemosRequest+ (*ImportMemosRequest)(nil), // 17: memos.api.v1.ImportMemosRequest+ (*ImportMemosSpec)(nil), // 18: memos.api.v1.ImportMemosSpec+ (*ImportMemosResponse)(nil), // 19: memos.api.v1.ImportMemosResponse+ (*MemoImportIssue)(nil), // 20: memos.api.v1.MemoImportIssue+ (*MemoImportPlan)(nil), // 21: memos.api.v1.MemoImportPlan+ (*MemoImportReport)(nil), // 22: memos.api.v1.MemoImportReport+ (*GetUserStatsRequest)(nil), // 23: memos.api.v1.GetUserStatsRequest+ (*ListAllUserStatsRequest)(nil), // 24: memos.api.v1.ListAllUserStatsRequest+ (*ListAllUserStatsResponse)(nil), // 25: memos.api.v1.ListAllUserStatsResponse+ (*UserSetting)(nil), // 26: memos.api.v1.UserSetting+ (*GetUserSettingRequest)(nil), // 27: memos.api.v1.GetUserSettingRequest+ (*UpdateUserSettingRequest)(nil), // 28: memos.api.v1.UpdateUserSettingRequest+ (*ListUserSettingsRequest)(nil), // 29: memos.api.v1.ListUserSettingsRequest+ (*ListUserSettingsResponse)(nil), // 30: memos.api.v1.ListUserSettingsResponse+ (*MemoView)(nil), // 31: memos.api.v1.MemoView+ (*ListMemoViewsRequest)(nil), // 32: memos.api.v1.ListMemoViewsRequest+ (*ListMemoViewsResponse)(nil), // 33: memos.api.v1.ListMemoViewsResponse+ (*GetMemoViewRequest)(nil), // 34: memos.api.v1.GetMemoViewRequest+ (*CreateMemoViewRequest)(nil), // 35: memos.api.v1.CreateMemoViewRequest+ (*UpdateMemoViewRequest)(nil), // 36: memos.api.v1.UpdateMemoViewRequest+ (*DeleteMemoViewRequest)(nil), // 37: memos.api.v1.DeleteMemoViewRequest+ (*LinkedIdentity)(nil), // 38: memos.api.v1.LinkedIdentity+ (*ListLinkedIdentitiesRequest)(nil), // 39: memos.api.v1.ListLinkedIdentitiesRequest+ (*ListLinkedIdentitiesResponse)(nil), // 40: memos.api.v1.ListLinkedIdentitiesResponse+ (*CreateLinkedIdentityRequest)(nil), // 41: memos.api.v1.CreateLinkedIdentityRequest+ (*GetLinkedIdentityRequest)(nil), // 42: memos.api.v1.GetLinkedIdentityRequest+ (*DeleteLinkedIdentityRequest)(nil), // 43: memos.api.v1.DeleteLinkedIdentityRequest+ (*PersonalAccessToken)(nil), // 44: memos.api.v1.PersonalAccessToken+ (*ListPersonalAccessTokensRequest)(nil), // 45: memos.api.v1.ListPersonalAccessTokensRequest+ (*ListPersonalAccessTokensResponse)(nil), // 46: memos.api.v1.ListPersonalAccessTokensResponse+ (*CreatePersonalAccessTokenRequest)(nil), // 47: memos.api.v1.CreatePersonalAccessTokenRequest+ (*CreatePersonalAccessTokenResponse)(nil), // 48: memos.api.v1.CreatePersonalAccessTokenResponse+ (*DeletePersonalAccessTokenRequest)(nil), // 49: memos.api.v1.DeletePersonalAccessTokenRequest+ (*UserWebhook)(nil), // 50: memos.api.v1.UserWebhook+ (*ListUserWebhooksRequest)(nil), // 51: memos.api.v1.ListUserWebhooksRequest+ (*ListUserWebhooksResponse)(nil), // 52: memos.api.v1.ListUserWebhooksResponse+ (*CreateUserWebhookRequest)(nil), // 53: memos.api.v1.CreateUserWebhookRequest+ (*UpdateUserWebhookRequest)(nil), // 54: memos.api.v1.UpdateUserWebhookRequest+ (*DeleteUserWebhookRequest)(nil), // 55: memos.api.v1.DeleteUserWebhookRequest+ (*GetUserWebhookSigningSecretRequest)(nil), // 56: memos.api.v1.GetUserWebhookSigningSecretRequest+ (*GetUserWebhookSigningSecretResponse)(nil), // 57: memos.api.v1.GetUserWebhookSigningSecretResponse+ (*UserNotification)(nil), // 58: memos.api.v1.UserNotification+ (*ListUserNotificationsRequest)(nil), // 59: memos.api.v1.ListUserNotificationsRequest+ (*ListUserNotificationsResponse)(nil), // 60: memos.api.v1.ListUserNotificationsResponse+ (*UpdateUserNotificationRequest)(nil), // 61: memos.api.v1.UpdateUserNotificationRequest+ (*DeleteUserNotificationRequest)(nil), // 62: memos.api.v1.DeleteUserNotificationRequest+ nil, // 63: memos.api.v1.UserStats.TagCountEntry+ (*UserStats_MemoTypeStats)(nil), // 64: memos.api.v1.UserStats.MemoTypeStats+ (*UserSetting_GeneralSetting)(nil), // 65: memos.api.v1.UserSetting.GeneralSetting+ (*UserSetting_TagMetadata)(nil), // 66: memos.api.v1.UserSetting.TagMetadata+ (*UserSetting_TagsSetting)(nil), // 67: memos.api.v1.UserSetting.TagsSetting+ (*UserSetting_WebhooksSetting)(nil), // 68: memos.api.v1.UserSetting.WebhooksSetting+ nil, // 69: memos.api.v1.UserSetting.TagsSetting.TagsEntry+ (*MemoView_Icon)(nil), // 70: memos.api.v1.MemoView.Icon+ (*UserNotification_MemoCommentPayload)(nil), // 71: memos.api.v1.UserNotification.MemoCommentPayload+ (*UserNotification_MemoMentionPayload)(nil), // 72: memos.api.v1.UserNotification.MemoMentionPayload+ (*UserNotification_SpaceInvitationPayload)(nil), // 73: memos.api.v1.UserNotification.SpaceInvitationPayload+ (State)(0), // 74: memos.api.v1.State+ (*timestamppb.Timestamp)(nil), // 75: google.protobuf.Timestamp+ (*fieldmaskpb.FieldMask)(nil), // 76: google.protobuf.FieldMask+ (*color.Color)(nil), // 77: google.type.Color+ (*Space)(nil), // 78: memos.api.v1.Space+ (SpaceMember_Role)(0), // 79: memos.api.v1.SpaceMember.Role+ (*emptypb.Empty)(nil), // 80: google.protobuf.Empty+ (*httpbody.HttpBody)(nil), // 81: google.api.HttpBody}var file_api_v1_user_service_proto_depIdxs = []int32{0, // 0: memos.api.v1.User.role:type_name -> memos.api.v1.User.Role- 66, // 1: memos.api.v1.User.state:type_name -> memos.api.v1.State- 67, // 2: memos.api.v1.User.create_time:type_name -> google.protobuf.Timestamp- 67, // 3: memos.api.v1.User.update_time:type_name -> google.protobuf.Timestamp- 5, // 4: memos.api.v1.ListUsersResponse.users:type_name -> memos.api.v1.User- 5, // 5: memos.api.v1.BatchGetUsersResponse.users:type_name -> memos.api.v1.User- 68, // 6: memos.api.v1.GetUserRequest.read_mask:type_name -> google.protobuf.FieldMask- 5, // 7: memos.api.v1.CreateUserRequest.user:type_name -> memos.api.v1.User- 5, // 8: memos.api.v1.UpdateUserRequest.user:type_name -> memos.api.v1.User- 68, // 9: memos.api.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask- 56, // 10: memos.api.v1.UserStats.memo_type_stats:type_name -> memos.api.v1.UserStats.MemoTypeStats- 55, // 11: memos.api.v1.UserStats.tag_count:type_name -> memos.api.v1.UserStats.TagCountEntry- 67, // 12: memos.api.v1.UserStats.memo_created_timestamps:type_name -> google.protobuf.Timestamp- 67, // 13: memos.api.v1.UserStats.memo_updated_timestamps:type_name -> google.protobuf.Timestamp- 66, // 14: memos.api.v1.ListAllUserStatsRequest.state:type_name -> memos.api.v1.State- 14, // 15: memos.api.v1.ListAllUserStatsResponse.stats:type_name -> memos.api.v1.UserStats- 57, // 16: memos.api.v1.UserSetting.general_setting:type_name -> memos.api.v1.UserSetting.GeneralSetting- 60, // 17: memos.api.v1.UserSetting.webhooks_setting:type_name -> memos.api.v1.UserSetting.WebhooksSetting- 59, // 18: memos.api.v1.UserSetting.tags_setting:type_name -> memos.api.v1.UserSetting.TagsSetting- 18, // 19: memos.api.v1.UpdateUserSettingRequest.setting:type_name -> memos.api.v1.UserSetting- 68, // 20: memos.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask- 18, // 21: memos.api.v1.ListUserSettingsResponse.settings:type_name -> memos.api.v1.UserSetting- 62, // 22: memos.api.v1.MemoView.icon:type_name -> memos.api.v1.MemoView.Icon- 23, // 23: memos.api.v1.ListMemoViewsResponse.memo_views:type_name -> memos.api.v1.MemoView- 23, // 24: memos.api.v1.CreateMemoViewRequest.memo_view:type_name -> memos.api.v1.MemoView- 23, // 25: memos.api.v1.UpdateMemoViewRequest.memo_view:type_name -> memos.api.v1.MemoView- 68, // 26: memos.api.v1.UpdateMemoViewRequest.update_mask:type_name -> google.protobuf.FieldMask- 30, // 27: memos.api.v1.ListLinkedIdentitiesResponse.linked_identities:type_name -> memos.api.v1.LinkedIdentity- 67, // 28: memos.api.v1.PersonalAccessToken.created_at:type_name -> google.protobuf.Timestamp- 67, // 29: memos.api.v1.PersonalAccessToken.expires_at:type_name -> google.protobuf.Timestamp- 67, // 30: memos.api.v1.PersonalAccessToken.last_used_at:type_name -> google.protobuf.Timestamp- 36, // 31: memos.api.v1.ListPersonalAccessTokensResponse.personal_access_tokens:type_name -> memos.api.v1.PersonalAccessToken- 36, // 32: memos.api.v1.CreatePersonalAccessTokenResponse.personal_access_token:type_name -> memos.api.v1.PersonalAccessToken- 67, // 33: memos.api.v1.UserWebhook.create_time:type_name -> google.protobuf.Timestamp- 67, // 34: memos.api.v1.UserWebhook.update_time:type_name -> google.protobuf.Timestamp- 42, // 35: memos.api.v1.ListUserWebhooksResponse.webhooks:type_name -> memos.api.v1.UserWebhook- 42, // 36: memos.api.v1.CreateUserWebhookRequest.webhook:type_name -> memos.api.v1.UserWebhook- 42, // 37: memos.api.v1.UpdateUserWebhookRequest.webhook:type_name -> memos.api.v1.UserWebhook- 68, // 38: memos.api.v1.UpdateUserWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask- 5, // 39: memos.api.v1.UserNotification.sender_user:type_name -> memos.api.v1.User- 2, // 40: memos.api.v1.UserNotification.status:type_name -> memos.api.v1.UserNotification.Status- 67, // 41: memos.api.v1.UserNotification.create_time:type_name -> google.protobuf.Timestamp- 3, // 42: memos.api.v1.UserNotification.type:type_name -> memos.api.v1.UserNotification.Type- 63, // 43: memos.api.v1.UserNotification.memo_comment:type_name -> memos.api.v1.UserNotification.MemoCommentPayload- 64, // 44: memos.api.v1.UserNotification.memo_mention:type_name -> memos.api.v1.UserNotification.MemoMentionPayload- 65, // 45: memos.api.v1.UserNotification.space_invitation:type_name -> memos.api.v1.UserNotification.SpaceInvitationPayload- 50, // 46: memos.api.v1.ListUserNotificationsResponse.notifications:type_name -> memos.api.v1.UserNotification- 50, // 47: memos.api.v1.UpdateUserNotificationRequest.notification:type_name -> memos.api.v1.UserNotification- 68, // 48: memos.api.v1.UpdateUserNotificationRequest.update_mask:type_name -> google.protobuf.FieldMask- 69, // 49: memos.api.v1.UserSetting.TagMetadata.background_color:type_name -> google.type.Color- 61, // 50: memos.api.v1.UserSetting.TagsSetting.tags:type_name -> memos.api.v1.UserSetting.TagsSetting.TagsEntry- 42, // 51: memos.api.v1.UserSetting.WebhooksSetting.webhooks:type_name -> memos.api.v1.UserWebhook- 58, // 52: memos.api.v1.UserSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.v1.UserSetting.TagMetadata- 70, // 53: memos.api.v1.UserNotification.SpaceInvitationPayload.space:type_name -> memos.api.v1.Space- 71, // 54: memos.api.v1.UserNotification.SpaceInvitationPayload.role:type_name -> memos.api.v1.SpaceMember.Role- 4, // 55: memos.api.v1.UserNotification.SpaceInvitationPayload.state:type_name -> memos.api.v1.UserNotification.SpaceInvitationPayload.State- 6, // 56: memos.api.v1.UserService.ListUsers:input_type -> memos.api.v1.ListUsersRequest- 8, // 57: memos.api.v1.UserService.BatchGetUsers:input_type -> memos.api.v1.BatchGetUsersRequest- 10, // 58: memos.api.v1.UserService.GetUser:input_type -> memos.api.v1.GetUserRequest- 11, // 59: memos.api.v1.UserService.CreateUser:input_type -> memos.api.v1.CreateUserRequest- 12, // 60: memos.api.v1.UserService.UpdateUser:input_type -> memos.api.v1.UpdateUserRequest- 13, // 61: memos.api.v1.UserService.DeleteUser:input_type -> memos.api.v1.DeleteUserRequest- 16, // 62: memos.api.v1.UserService.ListAllUserStats:input_type -> memos.api.v1.ListAllUserStatsRequest- 15, // 63: memos.api.v1.UserService.GetUserStats:input_type -> memos.api.v1.GetUserStatsRequest- 19, // 64: memos.api.v1.UserService.GetUserSetting:input_type -> memos.api.v1.GetUserSettingRequest- 20, // 65: memos.api.v1.UserService.UpdateUserSetting:input_type -> memos.api.v1.UpdateUserSettingRequest- 21, // 66: memos.api.v1.UserService.ListUserSettings:input_type -> memos.api.v1.ListUserSettingsRequest- 24, // 67: memos.api.v1.UserService.ListMemoViews:input_type -> memos.api.v1.ListMemoViewsRequest- 26, // 68: memos.api.v1.UserService.GetMemoView:input_type -> memos.api.v1.GetMemoViewRequest- 27, // 69: memos.api.v1.UserService.CreateMemoView:input_type -> memos.api.v1.CreateMemoViewRequest- 28, // 70: memos.api.v1.UserService.UpdateMemoView:input_type -> memos.api.v1.UpdateMemoViewRequest- 29, // 71: memos.api.v1.UserService.DeleteMemoView:input_type -> memos.api.v1.DeleteMemoViewRequest- 31, // 72: memos.api.v1.UserService.ListLinkedIdentities:input_type -> memos.api.v1.ListLinkedIdentitiesRequest- 33, // 73: memos.api.v1.UserService.CreateLinkedIdentity:input_type -> memos.api.v1.CreateLinkedIdentityRequest- 34, // 74: memos.api.v1.UserService.GetLinkedIdentity:input_type -> memos.api.v1.GetLinkedIdentityRequest- 35, // 75: memos.api.v1.UserService.DeleteLinkedIdentity:input_type -> memos.api.v1.DeleteLinkedIdentityRequest- 37, // 76: memos.api.v1.UserService.ListPersonalAccessTokens:input_type -> memos.api.v1.ListPersonalAccessTokensRequest- 39, // 77: memos.api.v1.UserService.CreatePersonalAccessToken:input_type -> memos.api.v1.CreatePersonalAccessTokenRequest- 41, // 78: memos.api.v1.UserService.DeletePersonalAccessToken:input_type -> memos.api.v1.DeletePersonalAccessTokenRequest- 43, // 79: memos.api.v1.UserService.ListUserWebhooks:input_type -> memos.api.v1.ListUserWebhooksRequest- 45, // 80: memos.api.v1.UserService.CreateUserWebhook:input_type -> memos.api.v1.CreateUserWebhookRequest- 46, // 81: memos.api.v1.UserService.UpdateUserWebhook:input_type -> memos.api.v1.UpdateUserWebhookRequest- 47, // 82: memos.api.v1.UserService.DeleteUserWebhook:input_type -> memos.api.v1.DeleteUserWebhookRequest- 48, // 83: memos.api.v1.UserService.GetUserWebhookSigningSecret:input_type -> memos.api.v1.GetUserWebhookSigningSecretRequest- 51, // 84: memos.api.v1.UserService.ListUserNotifications:input_type -> memos.api.v1.ListUserNotificationsRequest- 53, // 85: memos.api.v1.UserService.UpdateUserNotification:input_type -> memos.api.v1.UpdateUserNotificationRequest- 54, // 86: memos.api.v1.UserService.DeleteUserNotification:input_type -> memos.api.v1.DeleteUserNotificationRequest- 7, // 87: memos.api.v1.UserService.ListUsers:output_type -> memos.api.v1.ListUsersResponse- 9, // 88: memos.api.v1.UserService.BatchGetUsers:output_type -> memos.api.v1.BatchGetUsersResponse- 5, // 89: memos.api.v1.UserService.GetUser:output_type -> memos.api.v1.User- 5, // 90: memos.api.v1.UserService.CreateUser:output_type -> memos.api.v1.User- 5, // 91: memos.api.v1.UserService.UpdateUser:output_type -> memos.api.v1.User- 72, // 92: memos.api.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty- 17, // 93: memos.api.v1.UserService.ListAllUserStats:output_type -> memos.api.v1.ListAllUserStatsResponse- 14, // 94: memos.api.v1.UserService.GetUserStats:output_type -> memos.api.v1.UserStats- 18, // 95: memos.api.v1.UserService.GetUserSetting:output_type -> memos.api.v1.UserSetting- 18, // 96: memos.api.v1.UserService.UpdateUserSetting:output_type -> memos.api.v1.UserSetting- 22, // 97: memos.api.v1.UserService.ListUserSettings:output_type -> memos.api.v1.ListUserSettingsResponse- 25, // 98: memos.api.v1.UserService.ListMemoViews:output_type -> memos.api.v1.ListMemoViewsResponse- 23, // 99: memos.api.v1.UserService.GetMemoView:output_type -> memos.api.v1.MemoView- 23, // 100: memos.api.v1.UserService.CreateMemoView:output_type -> memos.api.v1.MemoView- 23, // 101: memos.api.v1.UserService.UpdateMemoView:output_type -> memos.api.v1.MemoView- 72, // 102: memos.api.v1.UserService.DeleteMemoView:output_type -> google.protobuf.Empty- 32, // 103: memos.api.v1.UserService.ListLinkedIdentities:output_type -> memos.api.v1.ListLinkedIdentitiesResponse- 30, // 104: memos.api.v1.UserService.CreateLinkedIdentity:output_type -> memos.api.v1.LinkedIdentity- 30, // 105: memos.api.v1.UserService.GetLinkedIdentity:output_type -> memos.api.v1.LinkedIdentity- 72, // 106: memos.api.v1.UserService.DeleteLinkedIdentity:output_type -> google.protobuf.Empty- 38, // 107: memos.api.v1.UserService.ListPersonalAccessTokens:output_type -> memos.api.v1.ListPersonalAccessTokensResponse- 40, // 108: memos.api.v1.UserService.CreatePersonalAccessToken:output_type -> memos.api.v1.CreatePersonalAccessTokenResponse- 72, // 109: memos.api.v1.UserService.DeletePersonalAccessToken:output_type -> google.protobuf.Empty- 44, // 110: memos.api.v1.UserService.ListUserWebhooks:output_type -> memos.api.v1.ListUserWebhooksResponse- 42, // 111: memos.api.v1.UserService.CreateUserWebhook:output_type -> memos.api.v1.UserWebhook- 42, // 112: memos.api.v1.UserService.UpdateUserWebhook:output_type -> memos.api.v1.UserWebhook- 72, // 113: memos.api.v1.UserService.DeleteUserWebhook:output_type -> google.protobuf.Empty- 49, // 114: memos.api.v1.UserService.GetUserWebhookSigningSecret:output_type -> memos.api.v1.GetUserWebhookSigningSecretResponse- 52, // 115: memos.api.v1.UserService.ListUserNotifications:output_type -> memos.api.v1.ListUserNotificationsResponse- 50, // 116: memos.api.v1.UserService.UpdateUserNotification:output_type -> memos.api.v1.UserNotification- 72, // 117: memos.api.v1.UserService.DeleteUserNotification:output_type -> google.protobuf.Empty- 87, // [87:118] is the sub-list for method output_type- 56, // [56:87] is the sub-list for method input_type- 56, // [56:56] is the sub-list for extension type_name- 56, // [56:56] is the sub-list for extension extendee- 0, // [0:56] is the sub-list for field type_name+ 74, // 1: memos.api.v1.User.state:type_name -> memos.api.v1.State+ 75, // 2: memos.api.v1.User.create_time:type_name -> google.protobuf.Timestamp+ 75, // 3: memos.api.v1.User.update_time:type_name -> google.protobuf.Timestamp+ 6, // 4: memos.api.v1.ListUsersResponse.users:type_name -> memos.api.v1.User+ 6, // 5: memos.api.v1.BatchGetUsersResponse.users:type_name -> memos.api.v1.User+ 76, // 6: memos.api.v1.GetUserRequest.read_mask:type_name -> google.protobuf.FieldMask+ 6, // 7: memos.api.v1.CreateUserRequest.user:type_name -> memos.api.v1.User+ 6, // 8: memos.api.v1.UpdateUserRequest.user:type_name -> memos.api.v1.User+ 76, // 9: memos.api.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask+ 64, // 10: memos.api.v1.UserStats.memo_type_stats:type_name -> memos.api.v1.UserStats.MemoTypeStats+ 63, // 11: memos.api.v1.UserStats.tag_count:type_name -> memos.api.v1.UserStats.TagCountEntry+ 75, // 12: memos.api.v1.UserStats.memo_created_timestamps:type_name -> google.protobuf.Timestamp+ 75, // 13: memos.api.v1.UserStats.memo_updated_timestamps:type_name -> google.protobuf.Timestamp+ 18, // 14: memos.api.v1.ImportMemosRequest.spec:type_name -> memos.api.v1.ImportMemosSpec+ 1, // 15: memos.api.v1.ImportMemosRequest.conflict_policy:type_name -> memos.api.v1.ImportMemosRequest.ConflictPolicy+ 21, // 16: memos.api.v1.ImportMemosResponse.plan:type_name -> memos.api.v1.MemoImportPlan+ 22, // 17: memos.api.v1.ImportMemosResponse.report:type_name -> memos.api.v1.MemoImportReport+ 75, // 18: memos.api.v1.MemoImportPlan.export_time:type_name -> google.protobuf.Timestamp+ 20, // 19: memos.api.v1.MemoImportPlan.warnings:type_name -> memos.api.v1.MemoImportIssue+ 20, // 20: memos.api.v1.MemoImportReport.warnings:type_name -> memos.api.v1.MemoImportIssue+ 20, // 21: memos.api.v1.MemoImportReport.failures:type_name -> memos.api.v1.MemoImportIssue+ 74, // 22: memos.api.v1.ListAllUserStatsRequest.state:type_name -> memos.api.v1.State+ 15, // 23: memos.api.v1.ListAllUserStatsResponse.stats:type_name -> memos.api.v1.UserStats+ 65, // 24: memos.api.v1.UserSetting.general_setting:type_name -> memos.api.v1.UserSetting.GeneralSetting+ 68, // 25: memos.api.v1.UserSetting.webhooks_setting:type_name -> memos.api.v1.UserSetting.WebhooksSetting+ 67, // 26: memos.api.v1.UserSetting.tags_setting:type_name -> memos.api.v1.UserSetting.TagsSetting+ 26, // 27: memos.api.v1.UpdateUserSettingRequest.setting:type_name -> memos.api.v1.UserSetting+ 76, // 28: memos.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask+ 26, // 29: memos.api.v1.ListUserSettingsResponse.settings:type_name -> memos.api.v1.UserSetting+ 70, // 30: memos.api.v1.MemoView.icon:type_name -> memos.api.v1.MemoView.Icon+ 31, // 31: memos.api.v1.ListMemoViewsResponse.memo_views:type_name -> memos.api.v1.MemoView+ 31, // 32: memos.api.v1.CreateMemoViewRequest.memo_view:type_name -> memos.api.v1.MemoView+ 31, // 33: memos.api.v1.UpdateMemoViewRequest.memo_view:type_name -> memos.api.v1.MemoView+ 76, // 34: memos.api.v1.UpdateMemoViewRequest.update_mask:type_name -> google.protobuf.FieldMask+ 38, // 35: memos.api.v1.ListLinkedIdentitiesResponse.linked_identities:type_name -> memos.api.v1.LinkedIdentity+ 75, // 36: memos.api.v1.PersonalAccessToken.created_at:type_name -> google.protobuf.Timestamp+ 75, // 37: memos.api.v1.PersonalAccessToken.expires_at:type_name -> google.protobuf.Timestamp+ 75, // 38: memos.api.v1.PersonalAccessToken.last_used_at:type_name -> google.protobuf.Timestamp+ 44, // 39: memos.api.v1.ListPersonalAccessTokensResponse.personal_access_tokens:type_name -> memos.api.v1.PersonalAccessToken+ 44, // 40: memos.api.v1.CreatePersonalAccessTokenResponse.personal_access_token:type_name -> memos.api.v1.PersonalAccessToken+ 75, // 41: memos.api.v1.UserWebhook.create_time:type_name -> google.protobuf.Timestamp+ 75, // 42: memos.api.v1.UserWebhook.update_time:type_name -> google.protobuf.Timestamp+ 50, // 43: memos.api.v1.ListUserWebhooksResponse.webhooks:type_name -> memos.api.v1.UserWebhook+ 50, // 44: memos.api.v1.CreateUserWebhookRequest.webhook:type_name -> memos.api.v1.UserWebhook+ 50, // 45: memos.api.v1.UpdateUserWebhookRequest.webhook:type_name -> memos.api.v1.UserWebhook+ 76, // 46: memos.api.v1.UpdateUserWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask+ 6, // 47: memos.api.v1.UserNotification.sender_user:type_name -> memos.api.v1.User+ 3, // 48: memos.api.v1.UserNotification.status:type_name -> memos.api.v1.UserNotification.Status+ 75, // 49: memos.api.v1.UserNotification.create_time:type_name -> google.protobuf.Timestamp+ 4, // 50: memos.api.v1.UserNotification.type:type_name -> memos.api.v1.UserNotification.Type+ 71, // 51: memos.api.v1.UserNotification.memo_comment:type_name -> memos.api.v1.UserNotification.MemoCommentPayload+ 72, // 52: memos.api.v1.UserNotification.memo_mention:type_name -> memos.api.v1.UserNotification.MemoMentionPayload+ 73, // 53: memos.api.v1.UserNotification.space_invitation:type_name -> memos.api.v1.UserNotification.SpaceInvitationPayload+ 58, // 54: memos.api.v1.ListUserNotificationsResponse.notifications:type_name -> memos.api.v1.UserNotification+ 58, // 55: memos.api.v1.UpdateUserNotificationRequest.notification:type_name -> memos.api.v1.UserNotification+ 76, // 56: memos.api.v1.UpdateUserNotificationRequest.update_mask:type_name -> google.protobuf.FieldMask+ 77, // 57: memos.api.v1.UserSetting.TagMetadata.background_color:type_name -> google.type.Color+ 69, // 58: memos.api.v1.UserSetting.TagsSetting.tags:type_name -> memos.api.v1.UserSetting.TagsSetting.TagsEntry+ 50, // 59: memos.api.v1.UserSetting.WebhooksSetting.webhooks:type_name -> memos.api.v1.UserWebhook+ 66, // 60: memos.api.v1.UserSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.v1.UserSetting.TagMetadata+ 78, // 61: memos.api.v1.UserNotification.SpaceInvitationPayload.space:type_name -> memos.api.v1.Space+ 79, // 62: memos.api.v1.UserNotification.SpaceInvitationPayload.role:type_name -> memos.api.v1.SpaceMember.Role+ 5, // 63: memos.api.v1.UserNotification.SpaceInvitationPayload.state:type_name -> memos.api.v1.UserNotification.SpaceInvitationPayload.State+ 7, // 64: memos.api.v1.UserService.ListUsers:input_type -> memos.api.v1.ListUsersRequest+ 9, // 65: memos.api.v1.UserService.BatchGetUsers:input_type -> memos.api.v1.BatchGetUsersRequest+ 11, // 66: memos.api.v1.UserService.GetUser:input_type -> memos.api.v1.GetUserRequest+ 12, // 67: memos.api.v1.UserService.CreateUser:input_type -> memos.api.v1.CreateUserRequest+ 13, // 68: memos.api.v1.UserService.UpdateUser:input_type -> memos.api.v1.UpdateUserRequest+ 14, // 69: memos.api.v1.UserService.DeleteUser:input_type -> memos.api.v1.DeleteUserRequest+ 24, // 70: memos.api.v1.UserService.ListAllUserStats:input_type -> memos.api.v1.ListAllUserStatsRequest+ 23, // 71: memos.api.v1.UserService.GetUserStats:input_type -> memos.api.v1.GetUserStatsRequest+ 16, // 72: memos.api.v1.UserService.ExportMemos:input_type -> memos.api.v1.ExportMemosRequest+ 17, // 73: memos.api.v1.UserService.ImportMemos:input_type -> memos.api.v1.ImportMemosRequest+ 27, // 74: memos.api.v1.UserService.GetUserSetting:input_type -> memos.api.v1.GetUserSettingRequest+ 28, // 75: memos.api.v1.UserService.UpdateUserSetting:input_type -> memos.api.v1.UpdateUserSettingRequest+ 29, // 76: memos.api.v1.UserService.ListUserSettings:input_type -> memos.api.v1.ListUserSettingsRequest+ 32, // 77: memos.api.v1.UserService.ListMemoViews:input_type -> memos.api.v1.ListMemoViewsRequest+ 34, // 78: memos.api.v1.UserService.GetMemoView:input_type -> memos.api.v1.GetMemoViewRequest+ 35, // 79: memos.api.v1.UserService.CreateMemoView:input_type -> memos.api.v1.CreateMemoViewRequest+ 36, // 80: memos.api.v1.UserService.UpdateMemoView:input_type -> memos.api.v1.UpdateMemoViewRequest+ 37, // 81: memos.api.v1.UserService.DeleteMemoView:input_type -> memos.api.v1.DeleteMemoViewRequest+ 39, // 82: memos.api.v1.UserService.ListLinkedIdentities:input_type -> memos.api.v1.ListLinkedIdentitiesRequest+ 41, // 83: memos.api.v1.UserService.CreateLinkedIdentity:input_type -> memos.api.v1.CreateLinkedIdentityRequest+ 42, // 84: memos.api.v1.UserService.GetLinkedIdentity:input_type -> memos.api.v1.GetLinkedIdentityRequest+ 43, // 85: memos.api.v1.UserService.DeleteLinkedIdentity:input_type -> memos.api.v1.DeleteLinkedIdentityRequest+ 45, // 86: memos.api.v1.UserService.ListPersonalAccessTokens:input_type -> memos.api.v1.ListPersonalAccessTokensRequest+ 47, // 87: memos.api.v1.UserService.CreatePersonalAccessToken:input_type -> memos.api.v1.CreatePersonalAccessTokenRequest+ 49, // 88: memos.api.v1.UserService.DeletePersonalAccessToken:input_type -> memos.api.v1.DeletePersonalAccessTokenRequest+ 51, // 89: memos.api.v1.UserService.ListUserWebhooks:input_type -> memos.api.v1.ListUserWebhooksRequest+ 53, // 90: memos.api.v1.UserService.CreateUserWebhook:input_type -> memos.api.v1.CreateUserWebhookRequest+ 54, // 91: memos.api.v1.UserService.UpdateUserWebhook:input_type -> memos.api.v1.UpdateUserWebhookRequest+ 55, // 92: memos.api.v1.UserService.DeleteUserWebhook:input_type -> memos.api.v1.DeleteUserWebhookRequest+ 56, // 93: memos.api.v1.UserService.GetUserWebhookSigningSecret:input_type -> memos.api.v1.GetUserWebhookSigningSecretRequest+ 59, // 94: memos.api.v1.UserService.ListUserNotifications:input_type -> memos.api.v1.ListUserNotificationsRequest+ 61, // 95: memos.api.v1.UserService.UpdateUserNotification:input_type -> memos.api.v1.UpdateUserNotificationRequest+ 62, // 96: memos.api.v1.UserService.DeleteUserNotification:input_type -> memos.api.v1.DeleteUserNotificationRequest+ 8, // 97: memos.api.v1.UserService.ListUsers:output_type -> memos.api.v1.ListUsersResponse+ 10, // 98: memos.api.v1.UserService.BatchGetUsers:output_type -> memos.api.v1.BatchGetUsersResponse+ 6, // 99: memos.api.v1.UserService.GetUser:output_type -> memos.api.v1.User+ 6, // 100: memos.api.v1.UserService.CreateUser:output_type -> memos.api.v1.User+ 6, // 101: memos.api.v1.UserService.UpdateUser:output_type -> memos.api.v1.User+ 80, // 102: memos.api.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty+ 25, // 103: memos.api.v1.UserService.ListAllUserStats:output_type -> memos.api.v1.ListAllUserStatsResponse+ 15, // 104: memos.api.v1.UserService.GetUserStats:output_type -> memos.api.v1.UserStats+ 81, // 105: memos.api.v1.UserService.ExportMemos:output_type -> google.api.HttpBody+ 19, // 106: memos.api.v1.UserService.ImportMemos:output_type -> memos.api.v1.ImportMemosResponse+ 26, // 107: memos.api.v1.UserService.GetUserSetting:output_type -> memos.api.v1.UserSetting+ 26, // 108: memos.api.v1.UserService.UpdateUserSetting:output_type -> memos.api.v1.UserSetting+ 30, // 109: memos.api.v1.UserService.ListUserSettings:output_type -> memos.api.v1.ListUserSettingsResponse+ 33, // 110: memos.api.v1.UserService.ListMemoViews:output_type -> memos.api.v1.ListMemoViewsResponse+ 31, // 111: memos.api.v1.UserService.GetMemoView:output_type -> memos.api.v1.MemoView+ 31, // 112: memos.api.v1.UserService.CreateMemoView:output_type -> memos.api.v1.MemoView+ 31, // 113: memos.api.v1.UserService.UpdateMemoView:output_type -> memos.api.v1.MemoView+ 80, // 114: memos.api.v1.UserService.DeleteMemoView:output_type -> google.protobuf.Empty+ 40, // 115: memos.api.v1.UserService.ListLinkedIdentities:output_type -> memos.api.v1.ListLinkedIdentitiesResponse+ 38, // 116: memos.api.v1.UserService.CreateLinkedIdentity:output_type -> memos.api.v1.LinkedIdentity+ 38, // 117: memos.api.v1.UserService.GetLinkedIdentity:output_type -> memos.api.v1.LinkedIdentity+ 80, // 118: memos.api.v1.UserService.DeleteLinkedIdentity:output_type -> google.protobuf.Empty+ 46, // 119: memos.api.v1.UserService.ListPersonalAccessTokens:output_type -> memos.api.v1.ListPersonalAccessTokensResponse+ 48, // 120: memos.api.v1.UserService.CreatePersonalAccessToken:output_type -> memos.api.v1.CreatePersonalAccessTokenResponse+ 80, // 121: memos.api.v1.UserService.DeletePersonalAccessToken:output_type -> google.protobuf.Empty+ 52, // 122: memos.api.v1.UserService.ListUserWebhooks:output_type -> memos.api.v1.ListUserWebhooksResponse+ 50, // 123: memos.api.v1.UserService.CreateUserWebhook:output_type -> memos.api.v1.UserWebhook+ 50, // 124: memos.api.v1.UserService.UpdateUserWebhook:output_type -> memos.api.v1.UserWebhook+ 80, // 125: memos.api.v1.UserService.DeleteUserWebhook:output_type -> google.protobuf.Empty+ 57, // 126: memos.api.v1.UserService.GetUserWebhookSigningSecret:output_type -> memos.api.v1.GetUserWebhookSigningSecretResponse+ 60, // 127: memos.api.v1.UserService.ListUserNotifications:output_type -> memos.api.v1.ListUserNotificationsResponse+ 58, // 128: memos.api.v1.UserService.UpdateUserNotification:output_type -> memos.api.v1.UserNotification+ 80, // 129: memos.api.v1.UserService.DeleteUserNotification:output_type -> google.protobuf.Empty+ 97, // [97:130] is the sub-list for method output_type+ 64, // [64:97] is the sub-list for method input_type+ 64, // [64:64] is the sub-list for extension type_name+ 64, // [64:64] is the sub-list for extension extendee+ 0, // [0:64] is the sub-list for field type_name}func init() { file_api_v1_user_service_proto_init() }@@ -4560,17 +5303,25 @@ func file_api_v1_user_service_proto_init() {file_api_v1_common_proto_init()file_api_v1_space_service_proto_init()file_api_v1_user_service_proto_msgTypes[9].OneofWrappers = []any{}+ file_api_v1_user_service_proto_msgTypes[11].OneofWrappers = []any{+ (*ImportMemosRequest_Spec)(nil),+ (*ImportMemosRequest_UploadId)(nil),+ }file_api_v1_user_service_proto_msgTypes[13].OneofWrappers = []any{+ (*ImportMemosResponse_Plan)(nil),+ (*ImportMemosResponse_Report)(nil),+ }+ file_api_v1_user_service_proto_msgTypes[20].OneofWrappers = []any{(*UserSetting_GeneralSetting_)(nil),(*UserSetting_WebhooksSetting_)(nil),(*UserSetting_TagsSetting_)(nil),}- file_api_v1_user_service_proto_msgTypes[45].OneofWrappers = []any{+ file_api_v1_user_service_proto_msgTypes[52].OneofWrappers = []any{(*UserNotification_MemoComment)(nil),(*UserNotification_MemoMention)(nil),(*UserNotification_SpaceInvitation)(nil),}- file_api_v1_user_service_proto_msgTypes[57].OneofWrappers = []any{+ file_api_v1_user_service_proto_msgTypes[64].OneofWrappers = []any{(*MemoView_Icon_Emoji)(nil),(*MemoView_Icon_Lucide)(nil),}@@ -4579,8 +5330,8 @@ func file_api_v1_user_service_proto_init() {File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_user_service_proto_rawDesc), len(file_api_v1_user_service_proto_rawDesc)),- NumEnums: 5,- NumMessages: 61,+ NumEnums: 6,+ NumMessages: 68,NumExtensions: 0,NumServices: 1,},diff --git a/proto/gen/api/v1/user_service.pb.gw.go b/proto/gen/api/v1/user_service.pb.gw.goindex aad139f22..7f8177d08 100644--- a/proto/gen/api/v1/user_service.pb.gw.go+++ b/proto/gen/api/v1/user_service.pb.gw.go@@ -413,6 +413,90 @@ func local_request_UserService_GetUserStats_0(ctx context.Context, marshaler runreturn msg, metadata, err}+func request_UserService_ExportMemos_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq ExportMemosRequest+ metadata runtime.ServerMetadata+ err error+ )+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ if req.Body != nil {+ _, _ = io.Copy(io.Discard, req.Body)+ }+ msg, err := client.ExportMemos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err+}++func local_request_UserService_ExportMemos_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq ExportMemosRequest+ metadata runtime.ServerMetadata+ err error+ )+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ msg, err := server.ExportMemos(ctx, &protoReq)+ return msg, metadata, err+}++func request_UserService_ImportMemos_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq ImportMemosRequest+ metadata runtime.ServerMetadata+ err error+ )+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ if req.Body != nil {+ _, _ = io.Copy(io.Discard, req.Body)+ }+ msg, err := client.ImportMemos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err+}++func local_request_UserService_ImportMemos_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq ImportMemosRequest+ metadata runtime.ServerMetadata+ err error+ )+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ msg, err := server.ImportMemos(ctx, &protoReq)+ return msg, metadata, err+}+func request_UserService_GetUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {var (protoReq GetUserSettingRequest@@ -1724,6 +1808,46 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux}forward_UserService_GetUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)})+ mux.Handle(http.MethodGet, pattern_UserService_ExportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ var stream runtime.ServerTransportStream+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ExportMemos", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:exportMemos"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_UserService_ExportMemos_0(annotatedContext, inboundMarshaler, server, req, pathParams)+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_UserService_ExportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodPost, pattern_UserService_ImportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ var stream runtime.ServerTransportStream+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ImportMemos", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:importMemos"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_UserService_ImportMemos_0(annotatedContext, inboundMarshaler, server, req, pathParams)+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_UserService_ImportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })mux.Handle(http.MethodGet, pattern_UserService_GetUserSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -2360,6 +2484,40 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux}forward_UserService_GetUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)})+ mux.Handle(http.MethodGet, pattern_UserService_ExportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ExportMemos", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:exportMemos"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_UserService_ExportMemos_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_UserService_ExportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodPost, pattern_UserService_ImportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ImportMemos", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:importMemos"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_UserService_ImportMemos_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_UserService_ImportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })mux.Handle(http.MethodGet, pattern_UserService_GetUserSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -2763,6 +2921,8 @@ var (pattern_UserService_DeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, ""))pattern_UserService_ListAllUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "stats"))pattern_UserService_GetUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "getStats"))+ pattern_UserService_ExportMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "exportMemos"))+ pattern_UserService_ImportMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "importMemos"))pattern_UserService_GetUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "settings", "name"}, ""))pattern_UserService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "settings", "setting.name"}, ""))pattern_UserService_ListUserSettings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "settings"}, ""))@@ -2797,6 +2957,8 @@ var (forward_UserService_DeleteUser_0 = runtime.ForwardResponseMessageforward_UserService_ListAllUserStats_0 = runtime.ForwardResponseMessageforward_UserService_GetUserStats_0 = runtime.ForwardResponseMessage+ forward_UserService_ExportMemos_0 = runtime.ForwardResponseMessage+ forward_UserService_ImportMemos_0 = runtime.ForwardResponseMessageforward_UserService_GetUserSetting_0 = runtime.ForwardResponseMessageforward_UserService_UpdateUserSetting_0 = runtime.ForwardResponseMessageforward_UserService_ListUserSettings_0 = runtime.ForwardResponseMessagediff --git a/proto/gen/api/v1/user_service_grpc.pb.go b/proto/gen/api/v1/user_service_grpc.pb.goindex b5d6e8836..6b85e1109 100644--- a/proto/gen/api/v1/user_service_grpc.pb.go+++ b/proto/gen/api/v1/user_service_grpc.pb.go@@ -8,6 +8,7 @@ package apiv1import (context "context"+ httpbody "google.golang.org/genproto/googleapis/api/httpbody"grpc "google.golang.org/grpc"codes "google.golang.org/grpc/codes"status "google.golang.org/grpc/status"@@ -28,6 +29,8 @@ const (UserService_DeleteUser_FullMethodName = "/memos.api.v1.UserService/DeleteUser"UserService_ListAllUserStats_FullMethodName = "/memos.api.v1.UserService/ListAllUserStats"UserService_GetUserStats_FullMethodName = "/memos.api.v1.UserService/GetUserStats"+ UserService_ExportMemos_FullMethodName = "/memos.api.v1.UserService/ExportMemos"+ UserService_ImportMemos_FullMethodName = "/memos.api.v1.UserService/ImportMemos"UserService_GetUserSetting_FullMethodName = "/memos.api.v1.UserService/GetUserSetting"UserService_UpdateUserSetting_FullMethodName = "/memos.api.v1.UserService/UpdateUserSetting"UserService_ListUserSettings_FullMethodName = "/memos.api.v1.UserService/ListUserSettings"@@ -74,6 +77,19 @@ type UserServiceClient interface {ListAllUserStats(ctx context.Context, in *ListAllUserStatsRequest, opts ...grpc.CallOption) (*ListAllUserStatsResponse, error)// GetUserStats returns statistics for a specific user.GetUserStats(ctx context.Context, in *GetUserStatsRequest, opts ...grpc.CallOption) (*UserStats, error)+ // ExportMemos writes every memo the user created, with comments, archived+ // memos, and attachment files, as a Memo Archive (a ZIP file, see+ // docs/design/memo-archive-format.md). Only the user may export their own+ // memos. The body is the archive; content_type is its media type.+ ExportMemos(ctx context.Context, in *ExportMemosRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error)+ // ImportMemos uploads a Memo Archive in bounded chunks and imports it into+ // the user's memos. The first call carries the spec and returns an+ // upload_id; later calls carry that upload_id. A finishing call with+ // validate_only returns the plan and keeps the archive staged; a finishing+ // call without it imports and returns the report. Uploads are bound to the+ // authenticated user, expire after 30 minutes of inactivity, and do not+ // survive a server restart.+ ImportMemos(ctx context.Context, in *ImportMemosRequest, opts ...grpc.CallOption) (*ImportMemosResponse, error)// GetUserSetting returns the user setting.GetUserSetting(ctx context.Context, in *GetUserSettingRequest, opts ...grpc.CallOption) (*UserSetting, error)// UpdateUserSetting updates the user setting.@@ -216,6 +232,26 @@ func (c *userServiceClient) GetUserStats(ctx context.Context, in *GetUserStatsRereturn out, nil}+func (c *userServiceClient) ExportMemos(ctx context.Context, in *ExportMemosRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(httpbody.HttpBody)+ err := c.cc.Invoke(ctx, UserService_ExportMemos_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *userServiceClient) ImportMemos(ctx context.Context, in *ImportMemosRequest, opts ...grpc.CallOption) (*ImportMemosResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(ImportMemosResponse)+ err := c.cc.Invoke(ctx, UserService_ImportMemos_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}+func (c *userServiceClient) GetUserSetting(ctx context.Context, in *GetUserSettingRequest, opts ...grpc.CallOption) (*UserSetting, error) {cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)out := new(UserSetting)@@ -467,6 +503,19 @@ type UserServiceServer interface {ListAllUserStats(context.Context, *ListAllUserStatsRequest) (*ListAllUserStatsResponse, error)// GetUserStats returns statistics for a specific user.GetUserStats(context.Context, *GetUserStatsRequest) (*UserStats, error)+ // ExportMemos writes every memo the user created, with comments, archived+ // memos, and attachment files, as a Memo Archive (a ZIP file, see+ // docs/design/memo-archive-format.md). Only the user may export their own+ // memos. The body is the archive; content_type is its media type.+ ExportMemos(context.Context, *ExportMemosRequest) (*httpbody.HttpBody, error)+ // ImportMemos uploads a Memo Archive in bounded chunks and imports it into+ // the user's memos. The first call carries the spec and returns an+ // upload_id; later calls carry that upload_id. A finishing call with+ // validate_only returns the plan and keeps the archive staged; a finishing+ // call without it imports and returns the report. Uploads are bound to the+ // authenticated user, expire after 30 minutes of inactivity, and do not+ // survive a server restart.+ ImportMemos(context.Context, *ImportMemosRequest) (*ImportMemosResponse, error)// GetUserSetting returns the user setting.GetUserSetting(context.Context, *GetUserSettingRequest) (*UserSetting, error)// UpdateUserSetting updates the user setting.@@ -553,6 +602,12 @@ func (UnimplementedUserServiceServer) ListAllUserStats(context.Context, *ListAllfunc (UnimplementedUserServiceServer) GetUserStats(context.Context, *GetUserStatsRequest) (*UserStats, error) {return nil, status.Error(codes.Unimplemented, "method GetUserStats not implemented")}+func (UnimplementedUserServiceServer) ExportMemos(context.Context, *ExportMemosRequest) (*httpbody.HttpBody, error) {+ return nil, status.Error(codes.Unimplemented, "method ExportMemos not implemented")+}+func (UnimplementedUserServiceServer) ImportMemos(context.Context, *ImportMemosRequest) (*ImportMemosResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method ImportMemos not implemented")+}func (UnimplementedUserServiceServer) GetUserSetting(context.Context, *GetUserSettingRequest) (*UserSetting, error) {return nil, status.Error(codes.Unimplemented, "method GetUserSetting not implemented")}@@ -787,6 +842,42 @@ func _UserService_GetUserStats_Handler(srv interface{}, ctx context.Context, decreturn interceptor(ctx, in, info, handler)}+func _UserService_ExportMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(ExportMemosRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(UserServiceServer).ExportMemos(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: UserService_ExportMemos_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(UserServiceServer).ExportMemos(ctx, req.(*ExportMemosRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _UserService_ImportMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(ImportMemosRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(UserServiceServer).ImportMemos(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: UserService_ImportMemos_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(UserServiceServer).ImportMemos(ctx, req.(*ImportMemosRequest))+ }+ return interceptor(ctx, in, info, handler)+}+func _UserService_GetUserSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {in := new(GetUserSettingRequest)if err := dec(in); err != nil {@@ -1240,6 +1331,14 @@ var UserService_ServiceDesc = grpc.ServiceDesc{MethodName: "GetUserStats",Handler: _UserService_GetUserStats_Handler,},+ {+ MethodName: "ExportMemos",+ Handler: _UserService_ExportMemos_Handler,+ },+ {+ MethodName: "ImportMemos",+ Handler: _UserService_ImportMemos_Handler,+ },{MethodName: "GetUserSetting",Handler: _UserService_GetUserSetting_Handler,diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yamlindex 04e3621db..5b8aa8356 100644--- a/proto/gen/openapi.yaml+++ b/proto/gen/openapi.yaml@@ -2847,6 +2847,34 @@ paths:application/json:schema:$ref: '#/components/schemas/Status'+ /api/v1/users/{user}:exportMemos:+ get:+ tags:+ - UserService+ description: |-+ ExportMemos writes every memo the user created, with comments, archived+ memos, and attachment files, as a Memo Archive (a ZIP file, see+ docs/design/memo-archive-format.md). Only the user may export their own+ memos. The body is the archive; content_type is its media type.+ operationId: UserService_ExportMemos+ parameters:+ - name: user+ in: path+ description: The user id.+ required: true+ schema:+ type: string+ responses:+ "200":+ description: OK+ content:+ '*/*': {}+ default:+ description: Default error response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/Status'/api/v1/users/{user}:getStats:get:tags:@@ -2880,6 +2908,45 @@ paths:application/json:schema:$ref: '#/components/schemas/Status'+ /api/v1/users/{user}:importMemos:+ post:+ tags:+ - UserService+ description: |-+ ImportMemos uploads a Memo Archive in bounded chunks and imports it into+ the user's memos. The first call carries the spec and returns an+ upload_id; later calls carry that upload_id. A finishing call with+ validate_only returns the plan and keeps the archive staged; a finishing+ call without it imports and returns the report. Uploads are bound to the+ authenticated user, expire after 30 minutes of inactivity, and do not+ survive a server restart.+ operationId: UserService_ImportMemos+ parameters:+ - name: user+ in: path+ description: The user id.+ required: true+ schema:+ type: string+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/ImportMemosRequest'+ required: true+ responses:+ "200":+ description: OK+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/ImportMemosResponse'+ default:+ description: Default error response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/Status'/api/v1/users:batchGet:post:tags:@@ -3357,6 +3424,86 @@ components:properties:oauth2Config:$ref: '#/components/schemas/OAuth2Config'+ ImportMemosRequest:+ required:+ - name+ - writeOffset+ type: object+ properties:+ name:+ type: string+ description: |-+ Required. The user who receives the memos. Must be the caller.+ Format: users/{user}+ spec:+ allOf:+ - $ref: '#/components/schemas/ImportMemosSpec'+ description: Starts a new upload. The same call may also carry data and finish_write.+ uploadId:+ type: string+ description: Continues the upload identified by a previous response.+ writeOffset:+ type: string+ description: |-+ Required. Zero-based byte offset at which data is written. Must equal the+ committed size, except when retrying the most recently accepted chunk+ with identical bytes and offset, which is accepted without writing again.+ data:+ type: string+ description: |-+ Optional. Archive bytes, at most max_chunk_size long. With no data and+ finish_write false, the call reports progress without writing, and+ write_offset is ignored.+ format: bytes+ finishWrite:+ type: boolean+ description: |-+ Optional. Finish the upload after writing data. The committed size must+ then equal total_size. The archive is validated and, unless+ validate_only is set, imported. Any later call for an imported upload+ returns the same report.+ validateOnly:+ type: boolean+ description: |-+ Optional. On a finishing call, validate the archive and return the plan+ without importing. The upload stays staged so a later finishing call can+ import it.+ conflictPolicy:+ enum:+ - CONFLICT_POLICY_UNSPECIFIED+ - SKIP+ - REPLACE+ - DUPLICATE+ type: string+ description: Optional. Read on the finishing call that imports. Unspecified means SKIP.+ format: enum+ ImportMemosResponse:+ type: object+ properties:+ uploadId:+ type: string+ description: Opaque ID for subsequent calls. This is not a resource name.+ committedSize:+ type: string+ description: Number of archive bytes committed so far.+ maxChunkSize:+ type: integer+ description: Maximum number of data bytes accepted in one call.+ format: int32+ plan:+ allOf:+ - $ref: '#/components/schemas/MemoImportPlan'+ description: What the import would do. Set by a finishing call with validate_only.+ report:+ allOf:+ - $ref: '#/components/schemas/MemoImportReport'+ description: What the import did. Set by a finishing call that imported.+ ImportMemosSpec:+ type: object+ properties:+ totalSize:+ type: string+ description: Optional. Total size of the archive in bytes.InstanceProfile:type: objectproperties:@@ -4058,6 +4205,81 @@ components:description: |-Optional. The space in which this memo is placed. Format: spaces/{space}.Every memo, including a comment, owns its placement independently.+ MemoImportIssue:+ type: object+ properties:+ memo:+ type: string+ description: The archive memo UID the issue concerns, if any.+ message:+ type: string+ description: |-+ MemoImportIssue is one warning or failure of an import, tied to the memo+ UID from the archive when there is one.+ MemoImportPlan:+ type: object+ properties:+ exportTime:+ type: string+ description: When the archive was written.+ format: date-time+ exporter:+ type: string+ description: Username of the user who exported the archive.+ generator:+ type: string+ description: The software that wrote the archive.+ memos:+ type: integer+ description: Number of memo records in the archive.+ format: int32+ attachments:+ type: integer+ description: Number of attachment files in the archive.+ format: int32+ new:+ type: integer+ description: Memos whose UID nobody on the instance holds.+ format: int32+ existing:+ type: integer+ description: Memos the user already holds; the conflict policy applies to them.+ format: int32+ renamed:+ type: integer+ description: Memos whose UID another account holds; they are imported under fresh UIDs.+ format: int32+ warnings:+ type: array+ items:+ $ref: '#/components/schemas/MemoImportIssue'+ description: Deviations the archive reader corrected while validating.+ description: MemoImportPlan describes what importing a staged archive would do.+ MemoImportReport:+ type: object+ properties:+ created:+ type: integer+ format: int32+ updated:+ type: integer+ format: int32+ skipped:+ type: integer+ format: int32+ failed:+ type: integer+ format: int32+ warnings:+ type: array+ items:+ $ref: '#/components/schemas/MemoImportIssue'+ failures:+ type: array+ items:+ $ref: '#/components/schemas/MemoImportIssue'+ description: One entry per failed memo, with the reason.+ description: MemoImportReport is the outcome of an import.MemoRelation:required:- memodiff --git a/server/api/v1/attachment_service_storage.go b/server/api/v1/attachment_service_storage.goindex b516953e3..49d446a75 100644--- a/server/api/v1/attachment_service_storage.go+++ b/server/api/v1/attachment_service_storage.go@@ -1,6 +1,7 @@package v1import (+ "bytes""context""fmt""io"@@ -233,13 +234,28 @@ func (s *APIV1Service) cleanupDeletedAttachmentStorage(ctx context.Context, atta// GetAttachmentBlob reads an attachment from its configured storage.func (s *APIV1Service) GetAttachmentBlob(ctx context.Context, attachment *store.Attachment) ([]byte, error) {- // For local storage, read the file from the local disk.- if attachment.StorageType == storepb.AttachmentStorageType_LOCAL {+ content, err := s.openAttachmentContent(ctx, attachment)+ if err != nil {+ return nil, err+ }+ defer content.Close()+ blob, err := io.ReadAll(content)+ if err != nil {+ return nil, errors.Wrap(err, "failed to read attachment content")+ }+ return blob, nil+}++// openAttachmentContent streams an attachment from its configured storage.+// Database-backed attachments are re-read with their blob when the caller+// listed them without it.+func (s *APIV1Service) openAttachmentContent(ctx context.Context, attachment *store.Attachment) (io.ReadCloser, error) {+ switch attachment.StorageType {+ case storepb.AttachmentStorageType_LOCAL:attachmentPath := filepath.FromSlash(attachment.Reference)if !filepath.IsAbs(attachmentPath) {attachmentPath = filepath.Join(s.Profile.Data, attachmentPath)}-file, err := os.Open(attachmentPath)if err != nil {if os.IsNotExist(err) {@@ -247,28 +263,31 @@ func (s *APIV1Service) GetAttachmentBlob(ctx context.Context, attachment *store.}return nil, errors.Wrap(err, "failed to open the file")}- defer file.Close()- blob, err := io.ReadAll(file)- if err != nil {- return nil, errors.Wrap(err, "failed to read the file")- }- return blob, nil- }- // For S3 storage, download the file from S3.- if attachment.StorageType == storepb.AttachmentStorageType_S3 {+ return file, nil+ case storepb.AttachmentStorageType_S3:driver, s3Object, err := s.Store.ResolveAttachmentS3Driver(ctx, attachment)if err != nil {return nil, errors.Wrap(err, "failed to resolve S3 attachment driver")}-- blob, err := driver.GetObject(ctx, s3Object.Key)+ object, err := driver.GetObjectStream(ctx, s3Object.Key, "")if err != nil {- return nil, errors.Wrap(err, "failed to get object from S3")+ return nil, errors.Wrap(err, "failed to stream object from S3")+ }+ return object.Body, nil+ default:+ blob := attachment.Blob+ if blob == nil {+ stored, err := s.Store.GetAttachment(ctx, &store.FindAttachment{ID: &attachment.ID, GetBlob: true})+ if err != nil {+ return nil, errors.Wrap(err, "failed to load attachment blob")+ }+ if stored == nil {+ return nil, errors.New("attachment not found")+ }+ blob = stored.Blob}- return blob, nil+ return io.NopCloser(bytes.NewReader(blob)), nil}- // For database storage, return the blob from the database.- return attachment.Blob, nil}var fileKeyPattern = regexp.MustCompile(`\{[a-z]{1,9}\}`)diff --git a/server/api/v1/attachment_upload.go b/server/api/v1/attachment_upload.goindex ea26fa9f3..16aff6070 100644--- a/server/api/v1/attachment_upload.go+++ b/server/api/v1/attachment_upload.go@@ -2,7 +2,6 @@ package v1import ("context"- "crypto/sha256""io""os""time"@@ -16,6 +15,25 @@ import ("github.com/usememos/memos/store")+const (+ attachmentUploadMetadataLimit = 64 << 10+ attachmentUploadTempPrefix = ".memos-rpc-upload-"+ attachmentUploadProcedure = "/memos.api.v1.AttachmentService/UploadAttachment"+)++// attachmentUploadState is what an attachment upload carries besides its+// bytes. Only Attachment is an API resource.+type attachmentUploadState struct {+ metadata *v1pb.Attachment+ uid string+ finalizeAttempted bool+}++type (+ attachmentUpload = uploadSession[attachmentUploadState]+ attachmentUploads = uploadSessions[attachmentUploadState]+)+// UploadAttachment accepts bounded unary chunks. A call carrying a spec opens// a new upload; a call carrying an upload ID continues one. Either kind may// write data and finalize.@@ -24,7 +42,7 @@ func (s *APIV1Service) UploadAttachment(ctx context.Context, request *v1pb.Uploaif err != nil {return nil, err}- if len(request.Data) > attachmentUploadChunkSize {+ if len(request.Data) > uploadChunkSize {return nil, status.Errorf(codes.ResourceExhausted, "upload chunk exceeds the limit")}var id string@@ -41,15 +59,10 @@ func (s *APIV1Service) UploadAttachment(ctx context.Context, request *v1pb.Uploaupload.mu.Lock()case *v1pb.UploadAttachmentRequest_UploadId:id = u.UploadId- upload, err = s.attachmentUploads.get(id, user.ID)+ upload, err = s.attachmentUploads.resume(id, user.ID)if err != nil {return nil, err}- upload.mu.Lock()- if !time.Now().Before(upload.expireTime) {- upload.mu.Unlock()- return nil, status.Errorf(codes.NotFound, "upload not found or expired")- }default:return nil, status.Errorf(codes.InvalidArgument, "spec or upload_id is required")}@@ -57,14 +70,14 @@ func (s *APIV1Service) UploadAttachment(ctx context.Context, request *v1pb.Uploaif err := ctx.Err(); err != nil {return nil, status.FromContextError(err).Err()}- if err := upload.write(ctx, request); err != nil {+ if err := upload.write(request.WriteOffset, request.Data, request.FinishWrite); err != nil {return nil, err}var attachment *v1pb.Attachmentif upload.complete {// Recheck access and existence; a completed upload must not resurrect a// deleted attachment or disclose metadata after access is revoked.- attachment, err = s.GetAttachment(ctx, &v1pb.GetAttachmentRequest{Name: "attachments/" + upload.uid})+ attachment, err = s.GetAttachment(ctx, &v1pb.GetAttachmentRequest{Name: "attachments/" + upload.state.uid})} else if request.FinishWrite {if upload.committedSize != upload.totalSize {return nil, status.Errorf(codes.FailedPrecondition, "upload is incomplete")@@ -78,9 +91,9 @@ func (s *APIV1Service) UploadAttachment(ctx context.Context, request *v1pb.Uploaif err != nil {return nil, err}- upload.expireTime = time.Now().Add(attachmentUploadTTL)+ upload.expireTime = time.Now().Add(uploadTTL)return &v1pb.UploadAttachmentResponse{- UploadId: id, CommittedSize: upload.committedSize, Attachment: attachment, MaxChunkSize: attachmentUploadChunkSize,+ UploadId: id, CommittedSize: upload.committedSize, Attachment: attachment, MaxChunkSize: uploadChunkSize,}, nil}@@ -122,64 +135,15 @@ func (s *APIV1Service) startAttachmentUpload(ctx context.Context, request *v1pb.if err != nil {return "", nil, err}- upload := &attachmentUpload{ownerID: ownerID, metadata: metadata, uid: create.UID, totalSize: spec.TotalSize}- id, err := s.attachmentUploads.create(s.Profile.Data, upload)- if err != nil {- return "", nil, err- }- return id, upload, nil-}--func (u *attachmentUpload) write(ctx context.Context, request *v1pb.UploadAttachmentRequest) error {- if len(request.Data) == 0 {- if request.FinishWrite && request.WriteOffset != u.committedSize {- return status.Errorf(codes.OutOfRange, "write_offset must equal committed_size")- }- return nil- }- digest := sha256.Sum256(request.Data)- if u.committedSize > 0 && request.WriteOffset+int64(len(request.Data)) == u.committedSize && digest == u.lastDigest {- return nil // A lost response can be retried without appending bytes twice.- }- if u.complete {- return status.Errorf(codes.FailedPrecondition, "upload is already complete")- }- if request.WriteOffset != u.committedSize {- return status.Errorf(codes.OutOfRange, "write_offset must equal committed_size")- }- if int64(len(request.Data)) > u.totalSize-u.committedSize {- return status.Errorf(codes.InvalidArgument, "data exceeds total_size")- }- file, err := os.OpenFile(u.path, os.O_WRONLY, 0600)- if err != nil {- return status.Errorf(codes.Internal, "failed to open upload file: %v", err)- }- defer file.Close()- n, err := file.WriteAt(request.Data, u.committedSize)- if err == nil && n != len(request.Data) {- err = io.ErrShortWrite- }- if err == nil {- err = ctx.Err()- }- if err != nil {- if truncateErr := file.Truncate(u.committedSize); truncateErr != nil {- // The file no longer matches committedSize; revoke the upload.- u.expireTime = time.Time{}- os.Remove(u.path)- }- return status.Errorf(codes.Internal, "failed to write upload chunk: %v", err)- }- u.lastDigest = digest- u.committedSize += int64(n)- return nil+ state := attachmentUploadState{metadata: metadata, uid: create.UID}+ return s.attachmentUploads.create(s.Profile.Data, attachmentUploadTempPrefix, ownerID, spec.TotalSize, state)}func (s *APIV1Service) finishAttachmentUpload(ctx context.Context, upload *attachmentUpload) (*v1pb.Attachment, error) {- if upload.finalizeAttempted {+ if upload.state.finalizeAttempted {// A database operation may commit before returning an error. Resolve that// outcome before saving another object under the upload's stable UID.- persisted, err := s.Store.GetAttachment(ctx, &store.FindAttachment{UID: &upload.uid})+ persisted, err := s.Store.GetAttachment(ctx, &store.FindAttachment{UID: &upload.state.uid})if err != nil {return nil, status.Errorf(codes.Internal, "failed to resolve previous finalization: %v", err)}@@ -187,7 +151,7 @@ func (s *APIV1Service) finishAttachmentUpload(ctx context.Context, upload *attacif persisted.CreatorID != upload.ownerID {return nil, status.Errorf(codes.AlreadyExists, "attachment ID already exists")}- return s.GetAttachment(ctx, &v1pb.GetAttachmentRequest{Name: "attachments/" + upload.uid})+ return s.GetAttachment(ctx, &v1pb.GetAttachmentRequest{Name: "attachments/" + upload.state.uid})}}setting, err := s.Store.GetInstanceStorageSetting(ctx)@@ -202,17 +166,17 @@ func (s *APIV1Service) finishAttachmentUpload(ctx context.Context, upload *attacreturn nil, status.Errorf(codes.Internal, "failed to open upload file: %v", err)}defer file.Close()- metadata := proto.CloneOf(upload.metadata)+ metadata := proto.CloneOf(upload.state.metadata)metadata.Content = make([]byte, min(upload.totalSize, 512))if _, err := io.ReadFull(file, metadata.Content); err != nil {return nil, status.Errorf(codes.Internal, "failed to read attachment header: %v", err)}// Revalidate memo permissions and media metadata with the actual MIME type.- create, err := s.prepareAttachment(ctx, &v1pb.CreateAttachmentRequest{Attachment: metadata, AttachmentId: upload.uid})+ create, err := s.prepareAttachment(ctx, &v1pb.CreateAttachmentRequest{Attachment: metadata, AttachmentId: upload.state.uid})if err != nil {return nil, err}create.Size = upload.totalSize- upload.finalizeAttempted = true+ upload.state.finalizeAttempted = truereturn s.processAndSaveAttachment(ctx, create, setting, file)}diff --git a/server/api/v1/attachment_upload_state.go b/server/api/v1/attachment_upload_state.godeleted file mode 100644index 45e7ddf38..000000000--- a/server/api/v1/attachment_upload_state.go+++ /dev/null@@ -1,194 +0,0 @@-package v1--import (- "crypto/rand"- "crypto/sha256"- "os"- "path/filepath"- "sync"- "time"-- "google.golang.org/grpc/codes"- "google.golang.org/grpc/status"-- v1pb "github.com/usememos/memos/proto/gen/api/v1"-)--const (- attachmentUploadChunkSize = 2 << 20- attachmentUploadRequestLimit = 4 << 20- attachmentUploadMetadataLimit = 64 << 10- attachmentUploadTTL = 30 * time.Minute- attachmentUploadMaxSessions = 1024- attachmentUploadMaxActive = 128- attachmentUploadMaxActivePerUser = 8- attachmentUploadTempPrefix = ".memos-rpc-upload-"- attachmentUploadProcedure = "/memos.api.v1.AttachmentService/UploadAttachment"-)--// Upload state is private to the process; only Attachment is an API resource.-// Each upload holds metadata and the last chunk's digest, never its contents.-type attachmentUpload struct {- mu sync.Mutex- ownerID int32- metadata *v1pb.Attachment- uid string- path string- totalSize int64- committedSize int64- // expireTime is zeroed to revoke an upload before its TTL elapses.- expireTime time.Time- // lastDigest identifies the most recently accepted chunk so a client can- // safely resend it after losing the response.- lastDigest [sha256.Size]byte- finalizeAttempted bool- complete bool-}--type attachmentUploads struct {- mu sync.Mutex- entries map[string]*attachmentUpload- stop chan struct{}- done chan struct{}- closed bool-}--func (m *attachmentUploads) startLocked(dir string) {- if m.entries != nil {- return- }- m.entries = make(map[string]*attachmentUpload)- m.stop = make(chan struct{})- m.done = make(chan struct{})- go func() {- defer close(m.done)- ticker := time.NewTicker(time.Minute)- defer ticker.Stop()- for {- select {- case <-m.stop:- return- case now := <-ticker.C:- m.mu.Lock()- m.sweepLocked(now, 0)- m.removeOrphansLocked(dir, now)- m.mu.Unlock()- }- }- }()-}--// sweepLocked drops expired uploads and counts the unfinished ones, both in-// total and for ownerID. An upload locked by an in-flight request is-// unfinished by definition.-func (m *attachmentUploads) sweepLocked(now time.Time, ownerID int32) (owned, total int) {- count := func(upload *attachmentUpload) {- total++- if upload.ownerID == ownerID {- owned++- }- }- for id, upload := range m.entries {- // Never hold the manager lock while waiting for a file write or finalize.- if !upload.mu.TryLock() {- count(upload)- continue- }- if !now.Before(upload.expireTime) {- os.Remove(upload.path)- delete(m.entries, id)- } else if !upload.complete {- count(upload)- }- upload.mu.Unlock()- }- return owned, total-}--func (m *attachmentUploads) removeOrphansLocked(dir string, now time.Time) {- tracked := make(map[string]bool, len(m.entries))- for _, upload := range m.entries {- tracked[upload.path] = true // path is immutable after insertion.- }- paths, _ := filepath.Glob(filepath.Join(dir, attachmentUploadTempPrefix+"*"))- for _, path := range paths {- if tracked[path] {- continue- }- if info, err := os.Stat(path); err == nil && info.Mode().IsRegular() && now.Sub(info.ModTime()) >= attachmentUploadTTL {- os.Remove(path)- }- }-}--func (m *attachmentUploads) create(dir string, upload *attachmentUpload) (string, error) {- m.mu.Lock()- defer m.mu.Unlock()- if m.closed {- return "", status.Errorf(codes.Unavailable, "server is shutting down")- }- m.startLocked(dir)- owned, total := m.sweepLocked(time.Now(), upload.ownerID)- if owned >= attachmentUploadMaxActivePerUser {- return "", status.Errorf(codes.ResourceExhausted, "too many active uploads")- }- if len(m.entries) >= attachmentUploadMaxSessions || total >= attachmentUploadMaxActive {- return "", status.Errorf(codes.ResourceExhausted, "too many uploads")- }- file, err := os.CreateTemp(dir, attachmentUploadTempPrefix+"*")- if err != nil {- return "", status.Errorf(codes.Internal, "failed to create upload file: %v", err)- }- if err := file.Close(); err != nil {- os.Remove(file.Name())- return "", status.Errorf(codes.Internal, "failed to close upload file: %v", err)- }- upload.path = file.Name()- upload.expireTime = time.Now().Add(attachmentUploadTTL)- id := rand.Text()- m.entries[id] = upload- return id, nil-}--func (m *attachmentUploads) get(id string, ownerID int32) (*attachmentUpload, error) {- m.mu.Lock()- upload := m.entries[id]- closed := m.closed- m.mu.Unlock()- if closed {- return nil, status.Errorf(codes.Unavailable, "server is shutting down")- }- if upload == nil || upload.ownerID != ownerID {- return nil, status.Errorf(codes.NotFound, "upload not found or expired")- }- return upload, nil-}--// CloseAttachmentUploads stops expiration work and removes pending upload files.-// Call it after draining HTTP requests during server shutdown.-func (s *APIV1Service) CloseAttachmentUploads() {- m := &s.attachmentUploads- m.mu.Lock()- if m.closed {- m.mu.Unlock()- return- }- m.closed = true- if m.stop != nil {- close(m.stop)- }- done := m.done- m.mu.Unlock()- if done != nil {- <-done- }- m.mu.Lock()- defer m.mu.Unlock()- for id, upload := range m.entries {- upload.mu.Lock()- upload.expireTime = time.Time{}- os.Remove(upload.path)- upload.mu.Unlock()- delete(m.entries, id)- }-}diff --git a/server/api/v1/attachment_upload_test.go b/server/api/v1/attachment_upload_test.goindex 40e819320..d7b15772b 100644--- a/server/api/v1/attachment_upload_test.go+++ b/server/api/v1/attachment_upload_test.go@@ -25,7 +25,7 @@ import (func newUploadTestService(t *testing.T) (*APIV1Service, context.Context) {t.Helper()svc := newIntegrationService(t)- t.Cleanup(svc.CloseAttachmentUploads)+ t.Cleanup(svc.CloseUploads)user := createSpaceTestUser(context.Background(), t, svc, "uploader", store.RoleUser)return svc, userCtx(context.Background(), user.ID)}@@ -45,7 +45,7 @@ func startTestUpload(ctx context.Context, t *testing.T, svc *APIV1Service, sizeresponse, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: spec})require.NoError(t, err)require.NotEmpty(t, response.UploadId)- require.EqualValues(t, attachmentUploadChunkSize, response.MaxChunkSize)+ require.EqualValues(t, uploadChunkSize, response.MaxChunkSize)require.Zero(t, response.CommittedSize)require.Nil(t, response.Attachment)return response.UploadId@@ -159,7 +159,7 @@ func TestUploadAttachmentValidation(t *testing.T) {require.Equal(t, codes.NotFound, status.Code(err))_, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID("unknown")})require.Equal(t, codes.NotFound, status.Code(err))- _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(id), Data: make([]byte, attachmentUploadChunkSize+1)})+ _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(id), Data: make([]byte, uploadChunkSize+1)})require.Equal(t, codes.ResourceExhausted, status.Code(err))_, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(id), Data: []byte("four")})require.Equal(t, codes.InvalidArgument, status.Code(err))@@ -248,7 +248,7 @@ func TestUploadAttachmentRechecksMemoAndSize(t *testing.T) {func TestUploadAttachmentExpiryAndLimits(t *testing.T) {svc, ctx := newUploadTestService(t)- ids := make([]string, attachmentUploadMaxActivePerUser)+ ids := make([]string, uploadMaxActivePerUser)for i := range ids {ids[i] = startTestUpload(ctx, t, svc, 0)}@@ -270,7 +270,7 @@ func TestUploadAttachmentExpiryAndLimits(t *testing.T) {for _, path := range []string{orphan, recent, unrelated} {require.NoError(t, os.WriteFile(path, []byte("x"), 0600))}- old := time.Now().Add(-2 * attachmentUploadTTL)+ old := time.Now().Add(-2 * uploadTTL)require.NoError(t, os.Chtimes(orphan, old, old))require.NoError(t, os.Chtimes(unrelated, old, old))svc.attachmentUploads.mu.Lock()@@ -281,7 +281,7 @@ func TestUploadAttachmentExpiryAndLimits(t *testing.T) {require.NoFileExists(t, orphan)require.FileExists(t, recent)require.FileExists(t, unrelated)- svc.CloseAttachmentUploads()+ svc.CloseUploads()require.Empty(t, svc.attachmentUploads.entries)}@@ -293,7 +293,7 @@ func TestUploadAttachmentAboveLegacyRequestLimit(t *testing.T) {})require.NoError(t, err)id := startTestUpload(ctx, t, svc, size)- chunk := bytes.Repeat([]byte{0x5a}, attachmentUploadChunkSize)+ chunk := bytes.Repeat([]byte{0x5a}, uploadChunkSize)var response *v1pb.UploadAttachmentResponsefor offset := int64(0); offset < size; offset += int64(len(chunk)) {response, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{diff --git a/server/api/v1/attachment_upload_transport_test.go b/server/api/v1/attachment_upload_transport_test.goindex 5dfee517b..6276a0028 100644--- a/server/api/v1/attachment_upload_transport_test.go+++ b/server/api/v1/attachment_upload_transport_test.go@@ -66,7 +66,7 @@ func TestUploadAttachmentTransports(t *testing.T) {require.NoError(t, protojson.Unmarshal(rec.Body.Bytes(), response))require.NotNil(t, response.Attachment)- oversized, err := protojson.Marshal(&v1pb.UploadAttachmentRequest{Data: make([]byte, attachmentUploadRequestLimit)})+ oversized, err := protojson.Marshal(&v1pb.UploadAttachmentRequest{Data: make([]byte, uploadRequestLimit)})require.NoError(t, err)reader := &uploadCountingReader{reader: bytes.NewReader(oversized)}req := httptest.NewRequest(http.MethodPost, path, reader)@@ -75,24 +75,24 @@ func TestUploadAttachmentTransports(t *testing.T) {rec = httptest.NewRecorder()e.ServeHTTP(rec, req)require.GreaterOrEqual(t, rec.Code, 400)- require.LessOrEqual(t, reader.read, attachmentUploadRequestLimit+1, "body must be bounded before decoding")+ require.LessOrEqual(t, reader.read, uploadRequestLimit+1, "body must be bounded before decoding")})}t.Run("Connect protobuf and compressed message limit", func(t *testing.T) {server := httptest.NewTestServer(t, e)client := apiv1connect.NewAttachmentServiceClient(server.Client(), server.URL)- initial := connect.NewRequest(&v1pb.UploadAttachmentRequest{Upload: uploadSpec("binary.bin", attachmentUploadChunkSize)})+ initial := connect.NewRequest(&v1pb.UploadAttachmentRequest{Upload: uploadSpec("binary.bin", uploadChunkSize)})initial.Header().Set("Authorization", "Bearer "+token)response, err := client.UploadAttachment(context.Background(), initial)require.NoError(t, err)- last := connect.NewRequest(&v1pb.UploadAttachmentRequest{Upload: uploadID(response.Msg.UploadId), Data: make([]byte, attachmentUploadChunkSize), FinishWrite: true})+ last := connect.NewRequest(&v1pb.UploadAttachmentRequest{Upload: uploadID(response.Msg.UploadId), Data: make([]byte, uploadChunkSize), FinishWrite: true})last.Header().Set("Authorization", "Bearer "+token)finished, err := client.UploadAttachment(context.Background(), last)require.NoError(t, err)- require.EqualValues(t, attachmentUploadChunkSize, finished.Msg.Attachment.Size)+ require.EqualValues(t, uploadChunkSize, finished.Msg.Attachment.Size)- data, err := proto.Marshal(&v1pb.UploadAttachmentRequest{Data: make([]byte, attachmentUploadRequestLimit+1)})+ data, err := proto.Marshal(&v1pb.UploadAttachmentRequest{Data: make([]byte, uploadRequestLimit+1)})require.NoError(t, err)var compressed bytes.Bufferwriter := gzip.NewWriter(&compressed)diff --git a/server/api/v1/connect_services.go b/server/api/v1/connect_services.goindex 7fcf27cf1..b455b8a65 100644--- a/server/api/v1/connect_services.go+++ b/server/api/v1/connect_services.go@@ -4,6 +4,7 @@ import ("context""connectrpc.com/connect"+ "google.golang.org/genproto/googleapis/api/httpbody""google.golang.org/protobuf/types/known/emptypb"v1pb "github.com/usememos/memos/proto/gen/api/v1"@@ -157,6 +158,22 @@ func (s *ConnectServiceHandler) GetUserStats(ctx context.Context, req *connect.Rreturn connect.NewResponse(resp), nil}+func (s *ConnectServiceHandler) ExportMemos(ctx context.Context, req *connect.Request[v1pb.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error) {+ resp, err := s.APIV1Service.ExportMemos(ctx, req.Msg)+ if err != nil {+ return nil, convertGRPCError(err)+ }+ return connect.NewResponse(resp), nil+}++func (s *ConnectServiceHandler) ImportMemos(ctx context.Context, req *connect.Request[v1pb.ImportMemosRequest]) (*connect.Response[v1pb.ImportMemosResponse], error) {+ resp, err := s.APIV1Service.ImportMemos(ctx, req.Msg)+ if err != nil {+ return nil, convertGRPCError(err)+ }+ return connect.NewResponse(resp), nil+}+func (s *ConnectServiceHandler) GetUserSetting(ctx context.Context, req *connect.Request[v1pb.GetUserSettingRequest]) (*connect.Response[v1pb.UserSetting], error) {resp, err := s.APIV1Service.GetUserSetting(ctx, req.Msg)if err != nil {diff --git a/server/api/v1/memo_archive_export.go b/server/api/v1/memo_archive_export.gonew file mode 100644index 000000000..328268649--- /dev/null+++ b/server/api/v1/memo_archive_export.go@@ -0,0 +1,246 @@+package v1++import (+ "context"+ "io"+ "maps"+ "slices"+ "time"++ "github.com/pkg/errors"+ "google.golang.org/protobuf/encoding/protojson"++ "github.com/usememos/memos/core/memoarchive"+ storepb "github.com/usememos/memos/proto/gen/store"+ "github.com/usememos/memos/store"+)++// archiveQueryChunk bounds the number of IDs placed in one IN clause.+const archiveQueryChunk = 500++// memoArchiveExport gathers everything one user's archive needs before any+// entry is written, so the manifest can carry accurate counts.+type memoArchiveExport struct {+ memos []*store.Memo+ attachmentsByID map[int32][]*store.Attachment+ relatedIDsByID map[int32][]int32+ reactionsByID map[int32][]*store.Reaction+ spacesByID map[int32]*store.Space+ memoUIDs map[int32]string+ usernames map[int32]string+ attachmentsCount int+}++// ExportMemoArchive writes a Memo Archive holding every memo the user+// created, including comments and archived memos, and the attachments linked+// to them. Nothing another user created is included.+func (s *APIV1Service) ExportMemoArchive(ctx context.Context, user *store.User, w io.Writer) error {+ if user == nil {+ return errors.New("user is required")+ }+ export, err := s.loadMemoArchiveExport(ctx, user)+ if err != nil {+ return err+ }++ exportTime := time.Now().UTC().Truncate(time.Second)+ writer := memoarchive.NewWriter(w, exportTime)+ if err := writer.WriteManifest(&memoarchive.Manifest{+ Generator: memoarchive.Generator{Name: "memos", Version: s.Profile.Version},+ ExportTime: memoarchive.FormatTime(exportTime.Unix()),+ Scope: memoarchive.Scope{+ Kind: memoarchive.ScopeKindUser,+ User: &memoarchive.ScopeUser{Username: user.Username, DisplayName: user.Nickname},+ },+ Counts: &memoarchive.Counts{Memos: len(export.memos), Attachments: export.attachmentsCount},+ }); err != nil {+ return err+ }++ for _, memo := range export.memos {+ record, err := s.buildMemoArchiveRecord(ctx, writer, user, export, memo)+ if err != nil {+ return err+ }+ if err := writer.WriteMemo(record, []byte(memo.Content)); err != nil {+ return err+ }+ }+ return writer.Close()+}++func (s *APIV1Service) loadMemoArchiveExport(ctx context.Context, user *store.User) (*memoArchiveExport, error) {+ memos, err := s.Store.ListMemos(ctx, &store.FindMemo{CreatorID: &user.ID})+ if err != nil {+ return nil, errors.Wrap(err, "failed to list memos")+ }+ export := &memoArchiveExport{+ memos: memos,+ attachmentsByID: make(map[int32][]*store.Attachment),+ relatedIDsByID: make(map[int32][]int32),+ reactionsByID: make(map[int32][]*store.Reaction),+ spacesByID: make(map[int32]*store.Space),+ memoUIDs: make(map[int32]string),+ usernames: map[int32]string{user.ID: user.Username},+ }+ memoIDs := make([]int32, 0, len(memos))+ for _, memo := range memos {+ memoIDs = append(memoIDs, memo.ID)+ export.memoUIDs[memo.ID] = memo.UID+ if memo.SpaceID != nil {+ if _, ok := export.spacesByID[*memo.SpaceID]; !ok {+ space, err := s.Store.GetSpace(ctx, &store.FindSpace{ID: memo.SpaceID})+ if err != nil {+ return nil, errors.Wrap(err, "failed to get space")+ }+ export.spacesByID[*memo.SpaceID] = space+ }+ }+ }++ foreignMemoIDs := make(map[int32]struct{})+ reactorIDs := make(map[int32]struct{})+ relationType := store.MemoRelationReference+ for chunk := range slices.Chunk(memoIDs, archiveQueryChunk) {+ attachments, err := s.Store.ListAttachments(ctx, &store.FindAttachment{MemoIDList: chunk})+ if err != nil {+ return nil, errors.Wrap(err, "failed to list attachments")+ }+ for _, attachment := range attachments {+ if attachment.MemoID == nil {+ continue+ }+ export.attachmentsByID[*attachment.MemoID] = append(export.attachmentsByID[*attachment.MemoID], attachment)+ if attachment.StorageType != storepb.AttachmentStorageType_EXTERNAL {+ export.attachmentsCount+++ }+ }++ relations, err := s.Store.ListMemoRelations(ctx, &store.FindMemoRelation{MemoIDList: chunk, Type: &relationType})+ if err != nil {+ return nil, errors.Wrap(err, "failed to list memo relations")+ }+ for _, relation := range relations {+ // MemoIDList matches either endpoint; only outgoing relations from+ // the user's own memos belong to their records.+ if _, own := export.memoUIDs[relation.MemoID]; !own {+ continue+ }+ export.relatedIDsByID[relation.MemoID] = append(export.relatedIDsByID[relation.MemoID], relation.RelatedMemoID)+ if _, own := export.memoUIDs[relation.RelatedMemoID]; !own {+ foreignMemoIDs[relation.RelatedMemoID] = struct{}{}+ }+ }++ reactions, err := s.Store.ListReactions(ctx, &store.FindReaction{MemoIDList: chunk})+ if err != nil {+ return nil, errors.Wrap(err, "failed to list reactions")+ }+ for _, reaction := range reactions {+ export.reactionsByID[reaction.MemoID] = append(export.reactionsByID[reaction.MemoID], reaction)+ if reaction.CreatorID != user.ID {+ reactorIDs[reaction.CreatorID] = struct{}{}+ }+ }+ }++ for chunk := range slices.Chunk(slices.Sorted(maps.Keys(foreignMemoIDs)), archiveQueryChunk) {+ related, err := s.Store.ListMemos(ctx, &store.FindMemo{IDList: chunk, ExcludeContent: true})+ if err != nil {+ return nil, errors.Wrap(err, "failed to list related memos")+ }+ for _, memo := range related {+ export.memoUIDs[memo.ID] = memo.UID+ }+ }+ for chunk := range slices.Chunk(slices.Sorted(maps.Keys(reactorIDs)), archiveQueryChunk) {+ users, err := s.Store.ListUsers(ctx, &store.FindUser{IDList: chunk})+ if err != nil {+ return nil, errors.Wrap(err, "failed to list users")+ }+ for _, reactor := range users {+ export.usernames[reactor.ID] = reactor.Username+ }+ }+ return export, nil+}++func (s *APIV1Service) buildMemoArchiveRecord(ctx context.Context, writer *memoarchive.Writer, user *store.User, export *memoArchiveExport, memo *store.Memo) (*memoarchive.Memo, error) {+ record := &memoarchive.Memo{+ UID: memo.UID,+ Creator: user.Username,+ CreateTime: memoarchive.FormatTime(memo.CreatedTs),+ UpdateTime: memoarchive.FormatTime(memo.UpdatedTs),+ State: string(memo.RowStatus),+ Visibility: memo.Visibility.String(),+ Pinned: memo.Pinned,+ Tags: memo.Payload.GetTags(),+ }+ if location := memo.Payload.GetLocation(); location != nil {+ record.Location = &memoarchive.Location{+ Placeholder: location.Placeholder,+ Latitude: location.Latitude,+ Longitude: location.Longitude,+ }+ }+ if memo.SpaceID != nil {+ if space := export.spacesByID[*memo.SpaceID]; space != nil {+ record.Space = &memoarchive.Space{UID: space.UID, Title: space.Title}+ }+ }+ if memo.ParentUID != nil && *memo.ParentUID != "" {+ record.Parent = *memo.ParentUID+ }+ for _, relatedID := range export.relatedIDsByID[memo.ID] {+ uid, ok := export.memoUIDs[relatedID]+ if !ok {+ continue+ }+ record.Relations = append(record.Relations, memoarchive.Relation{Type: memoarchive.RelationReference, Memo: uid})+ }+ for _, reaction := range export.reactionsByID[memo.ID] {+ username, ok := export.usernames[reaction.CreatorID]+ if !ok {+ continue+ }+ record.Reactions = append(record.Reactions, memoarchive.Reaction{+ ReactionType: reaction.ReactionType,+ Creator: username,+ CreateTime: memoarchive.FormatTime(reaction.CreatedTs),+ })+ }+ for _, attachment := range export.attachmentsByID[memo.ID] {+ entry := memoarchive.Attachment{+ UID: attachment.UID,+ Filename: attachment.Filename,+ Type: attachment.Type,+ Size: attachment.Size,+ CreateTime: memoarchive.FormatTime(attachment.CreatedTs),+ }+ if metadata := convertMediaMetadataFromStore(attachment.Payload.GetMediaMetadata()); metadata != nil {+ raw, err := protojson.Marshal(metadata)+ if err != nil {+ return nil, errors.Wrapf(err, "failed to encode media metadata of attachment %s", attachment.UID)+ }+ entry.MediaMetadata = raw+ }+ if attachment.StorageType == storepb.AttachmentStorageType_EXTERNAL {+ entry.ExternalLink = attachment.Reference+ } else {+ content, err := s.openAttachmentContent(ctx, attachment)+ if err != nil {+ return nil, errors.Wrapf(err, "failed to read attachment %s", attachment.UID)+ }+ entry.Path = memoarchive.AttachmentPath(attachment.UID, attachment.Filename)+ digest, size, err := writer.WriteAttachment(entry.Path, content)+ _ = content.Close()+ if err != nil {+ return nil, err+ }+ entry.SHA256 = digest+ entry.Size = size+ }+ record.Attachments = append(record.Attachments, entry)+ }+ return record, nil+}diff --git a/server/api/v1/memo_archive_import.go b/server/api/v1/memo_archive_import.gonew file mode 100644index 000000000..1184a5f44--- /dev/null+++ b/server/api/v1/memo_archive_import.go@@ -0,0 +1,603 @@+package v1++import (+ "bytes"+ "context"+ "crypto/sha256"+ "encoding/hex"+ "fmt"+ "io"+ "log/slog"+ "slices"+ "time"++ "github.com/lithammer/shortuuid/v4"+ "github.com/pkg/errors"+ "google.golang.org/protobuf/encoding/protojson"+ "google.golang.org/protobuf/types/known/timestamppb"++ "github.com/usememos/memos/core/memoarchive"+ "github.com/usememos/memos/core/memopayload"+ v1pb "github.com/usememos/memos/proto/gen/api/v1"+ storepb "github.com/usememos/memos/proto/gen/store"+ "github.com/usememos/memos/store"+)++// PlanMemoArchiveImport classifies every record of an archive against the+// instance without writing anything.+func (s *APIV1Service) PlanMemoArchiveImport(ctx context.Context, user *store.User, archive *memoarchive.Archive) (*v1pb.MemoImportPlan, error) {+ if user == nil || archive == nil {+ return nil, errors.New("user and archive are required")+ }+ exportTime, err := memoarchive.ParseTime(archive.Manifest.ExportTime)+ if err != nil {+ return nil, errors.Wrap(err, "invalid export time")+ }+ plan := &v1pb.MemoImportPlan{+ ExportTime: timestamppb.New(time.Unix(exportTime, 0)),+ Generator: archive.Manifest.Generator.Name + " " + archive.Manifest.Generator.Version,+ Memos: int32(len(archive.Memos)),+ Warnings: archiveIssues(archive.Warnings),+ }+ if archive.Manifest.Scope.User != nil {+ plan.Exporter = archive.Manifest.Scope.User.Username+ }+ for _, record := range archive.Memos {+ for _, attachment := range record.Attachments {+ if attachment.Path != "" {+ plan.Attachments+++ }+ }+ }+ existing, err := s.findMemosByUID(ctx, archive, true)+ if err != nil {+ return nil, err+ }+ for _, record := range archive.Memos {+ switch memo := existing[record.UID]; {+ case memo == nil:+ plan.New+++ case memo.CreatorID == user.ID:+ plan.Existing+++ default:+ plan.Renamed+++ }+ }+ return plan, nil+}++// findMemosByUID loads the instance memos whose UIDs appear in the archive.+func (s *APIV1Service) findMemosByUID(ctx context.Context, archive *memoarchive.Archive, excludeContent bool) (map[string]*store.Memo, error) {+ uids := make([]string, 0, len(archive.Memos))+ for _, record := range archive.Memos {+ uids = append(uids, record.UID)+ }+ found := make(map[string]*store.Memo, len(uids))+ for chunk := range slices.Chunk(uids, archiveQueryChunk) {+ memos, err := s.Store.ListMemos(ctx, &store.FindMemo{UIDList: chunk, ExcludeContent: excludeContent})+ if err != nil {+ return nil, errors.Wrap(err, "failed to look up memos")+ }+ for _, memo := range memos {+ found[memo.UID] = memo+ }+ }+ return found, nil+}++func archiveIssues(warnings []memoarchive.Warning) []*v1pb.MemoImportIssue {+ issues := make([]*v1pb.MemoImportIssue, 0, len(warnings))+ for _, warning := range warnings {+ issues = append(issues, &v1pb.MemoImportIssue{Memo: warning.UID, Message: warning.Message})+ }+ return issues+}++// writtenMemo pairs an archive record with the instance memo it was created+// as or merged into, for the relation pass.+type writtenMemo struct {+ record *memoarchive.Memo+ memo *store.Memo+}++type memoArchiveImporter struct {+ service *APIV1Service+ ctx context.Context+ user *store.User+ archive *memoarchive.Archive+ policy v1pb.ImportMemosRequest_ConflictPolicy+ report *v1pb.MemoImportReport++ storageSetting *storepb.InstanceStorageSetting+ contentLengthLimit int+ // existing holds the instance memos whose UIDs the archive uses, keyed by+ // UID, loaded once before any write.+ existing map[string]*store.Memo+ // resolved maps archive memo UIDs to the instance memos they became,+ // including skipped ones so comments and references can point at them.+ resolved map[string]*store.Memo+ // written lists the records that were created or updated, whose+ // relations are applied once every record exists.+ written []writtenMemo+ // spaces caches Space resolution per archive Space UID; memberSpaces is+ // the importer's Space list, loaded on first use.+ spaces map[string]*int32+ memberSpaces []*store.Space+}++// ImportMemoArchive applies an opened archive to the importing user's memos+// following the documented import semantics. The user in ctx must be the+// same as user.+func (s *APIV1Service) ImportMemoArchive(ctx context.Context, user *store.User, archive *memoarchive.Archive, policy v1pb.ImportMemosRequest_ConflictPolicy) (*v1pb.MemoImportReport, error) {+ if user == nil || archive == nil {+ return nil, errors.New("user and archive are required")+ }+ if policy == v1pb.ImportMemosRequest_CONFLICT_POLICY_UNSPECIFIED {+ policy = v1pb.ImportMemosRequest_SKIP+ }+ storageSetting, err := s.Store.GetInstanceStorageSetting(ctx)+ if err != nil {+ return nil, errors.Wrap(err, "failed to get instance storage setting")+ }+ contentLengthLimit, err := s.getContentLengthLimit(ctx)+ if err != nil {+ return nil, errors.Wrap(err, "failed to get content length limit")+ }+ existing, err := s.findMemosByUID(ctx, archive, false)+ if err != nil {+ return nil, err+ }+ importer := &memoArchiveImporter{+ service: s,+ ctx: ctx,+ user: user,+ archive: archive,+ policy: policy,+ report: &v1pb.MemoImportReport{Warnings: archiveIssues(archive.Warnings)},+ storageSetting: storageSetting,+ contentLengthLimit: contentLengthLimit,+ existing: existing,+ resolved: make(map[string]*store.Memo, len(archive.Memos)),+ spaces: make(map[string]*int32),+ }+ for _, record := range archive.Memos {+ if err := ctx.Err(); err != nil {+ return nil, err+ }+ if err := importer.importMemo(record); err != nil {+ importer.report.Failed+++ importer.report.Failures = append(importer.report.Failures, &v1pb.MemoImportIssue{Memo: record.UID, Message: err.Error()})+ }+ }+ for _, written := range importer.written {+ if err := ctx.Err(); err != nil {+ return nil, err+ }+ if err := importer.applyRelations(written); err != nil {+ importer.warn(written.record.UID, "relations were not applied: "+err.Error())+ }+ }+ if importer.report.Created > 0 || importer.report.Updated > 0 {+ s.SSEHub.publishMemoChanged()+ }+ return importer.report, nil+}++func (i *memoArchiveImporter) warn(uid, message string) {+ i.report.Warnings = append(i.report.Warnings, &v1pb.MemoImportIssue{Memo: uid, Message: message})+}++func (i *memoArchiveImporter) importMemo(record *memoarchive.Memo) error {+ content, err := i.archive.Content(record)+ if err != nil {+ return err+ }+ if len(content) > i.contentLengthLimit {+ return errors.Errorf("content too long (max %d characters)", i.contentLengthLimit)+ }+ targetUID := record.UID+ if existing := i.existing[record.UID]; existing != nil {+ if existing.CreatorID == i.user.ID {+ switch i.policy {+ case v1pb.ImportMemosRequest_SKIP:+ i.resolved[record.UID] = existing+ i.report.Skipped+++ return nil+ case v1pb.ImportMemosRequest_REPLACE:+ return i.replaceMemo(record, existing, content)+ }+ }+ targetUID = shortuuid.New()+ }+ return i.createMemo(record, targetUID, content)+}++func (i *memoArchiveImporter) createMemo(record *memoarchive.Memo, targetUID string, content []byte) error {+ memo, err := i.buildMemo(record, targetUID, content)+ if err != nil {+ return err+ }+ var parentID *int32+ if record.Parent != "" {+ parent, err := i.resolveMemo(record.Parent)+ if err != nil {+ return err+ }+ if parent == nil {+ i.warn(record.UID, fmt.Sprintf("parent memo %s was not found; imported as a top-level memo", record.Parent))+ } else {+ parentID = &parent.ID+ }+ }+ added, err := i.importAttachments(record, nil)+ if err != nil {+ return err+ }+ // Creation never sets pinned or the lifecycle state; they follow in a+ // second write, as they do for a memo created through the API.+ wantPinned, wantRowStatus := memo.Pinned, memo.RowStatus+ err = i.bindAttachments(memo, added, added, func(prepared *preparedMemoAttachments, required []int32) error {+ if err := i.service.createMemoWithMutation(i.ctx, i.user, memo, parentID, prepared, required, nil); err != nil {+ return mapMemoCreateError(err, targetUID, "failed to create memo")+ }+ return nil+ })+ if err != nil {+ return err+ }+ if wantPinned || wantRowStatus == store.Archived {+ update := &store.UpdateMemo{ID: memo.ID, UpdatedTs: &memo.UpdatedTs}+ if wantPinned {+ update.Pinned = &wantPinned+ }+ if wantRowStatus == store.Archived {+ update.RowStatus = &wantRowStatus+ }+ if err := i.service.Store.UpdateMemo(i.ctx, update); err != nil {+ return mapMemoWriteError(err, "failed to apply memo state")+ }+ memo.Pinned, memo.RowStatus = wantPinned, wantRowStatus+ }+ i.resolved[record.UID] = memo+ i.written = append(i.written, writtenMemo{record: record, memo: memo})+ i.report.Created+++ return nil+}++func (i *memoArchiveImporter) replaceMemo(record *memoarchive.Memo, existing *store.Memo, content []byte) error {+ next, err := i.buildMemo(record, existing.UID, content)+ if err != nil {+ return err+ }+ if record.Parent != "" && (existing.ParentUID == nil || *existing.ParentUID != record.Parent) {+ i.warn(record.UID, "comment threading of an existing memo cannot be changed; the parent from the archive was ignored")+ }+ update := &store.UpdateMemo{+ ID: existing.ID,+ Content: &next.Content,+ Payload: next.Payload,+ Visibility: &next.Visibility,+ Pinned: &next.Pinned,+ RowStatus: &next.RowStatus,+ CreatedTs: &next.CreatedTs,+ UpdatedTs: &next.UpdatedTs,+ ClearSpace: next.SpaceID == nil,+ SpaceID: next.SpaceID,+ }+ current, err := i.service.Store.ListAttachments(i.ctx, &store.FindAttachment{MemoID: &existing.ID})+ if err != nil {+ return errors.Wrap(err, "failed to list attachments")+ }+ names := make([]*v1pb.Attachment, 0, len(current)+len(record.Attachments))+ for _, attachment := range current {+ names = append(names, &v1pb.Attachment{Name: AttachmentNamePrefix + attachment.UID})+ }+ added, err := i.importAttachments(record, current)+ if err != nil {+ return err+ }+ err = i.bindAttachments(existing, append(names, added...), added, func(prepared *preparedMemoAttachments, required []int32) error {+ return i.service.applyMemoMutation(i.ctx, existing, prepared, update, required, nil)+ })+ if err != nil {+ return err+ }+ i.resolved[record.UID] = existing+ i.written = append(i.written, writtenMemo{record: record, memo: existing})+ i.report.Updated+++ return nil+}++// bindAttachments prepares the memo's attachment set, resolves the managed+// references in its content, and runs write. When any step fails, the+// attachments this run created for the memo are removed again.+func (i *memoArchiveImporter) bindAttachments(memo *store.Memo, names, added []*v1pb.Attachment, write func(*preparedMemoAttachments, []int32) error) error {+ err := func() error {+ prepared, err := i.service.prepareMemoAttachments(i.ctx, i.user, memo, names)+ if err != nil {+ return err+ }+ required, err := i.service.resolveMemoAttachmentReferences(memo.Content, prepared.normalized)+ if err != nil {+ return err+ }+ return write(prepared, required)+ }()+ if err != nil {+ i.discardAttachments(added)+ }+ return err+}++// buildMemo turns a record into the memo row to write, resolving the Space+// and applying the visibility fallback.+func (i *memoArchiveImporter) buildMemo(record *memoarchive.Memo, uid string, content []byte) (*store.Memo, error) {+ createdTs, err := memoarchive.ParseTime(record.CreateTime)+ if err != nil {+ return nil, err+ }+ updatedTs, err := memoarchive.ParseTime(record.UpdateTime)+ if err != nil {+ return nil, err+ }+ memo := &store.Memo{+ UID: uid,+ CreatorID: i.user.ID,+ RowStatus: store.RowStatus(record.State),+ CreatedTs: createdTs,+ UpdatedTs: updatedTs,+ Content: string(content),+ Visibility: store.Visibility(record.Visibility),+ Pinned: record.Pinned,+ }+ if record.Space != nil {+ spaceID, err := i.resolveSpace(record.Space)+ if err != nil {+ return nil, err+ }+ if spaceID == nil {+ i.warn(record.UID, fmt.Sprintf("space %q was not found among your spaces; imported without a space", record.Space.UID))+ }+ memo.SpaceID = spaceID+ }+ if memo.Visibility == store.SpaceAudience && memo.SpaceID == nil {+ i.warn(record.UID, "SPACE visibility needs a space; imported as PRIVATE")+ memo.Visibility = store.Private+ }+ if err := memopayload.RebuildMemoPayload(i.ctx, memo, i.service.MarkdownService); err != nil {+ return nil, errors.Wrap(err, "failed to rebuild memo payload")+ }+ if record.Location != nil {+ memo.Payload.Location = &storepb.MemoPayload_Location{+ Placeholder: record.Location.Placeholder,+ Latitude: record.Location.Latitude,+ Longitude: record.Location.Longitude,+ }+ }+ return memo, nil+}++// resolveSpace matches a record's Space by UID, then by title, among the+// Spaces the importing user is an active member of.+func (i *memoArchiveImporter) resolveSpace(space *memoarchive.Space) (*int32, error) {+ if cached, ok := i.spaces[space.UID]; ok {+ return cached, nil+ }+ if i.memberSpaces == nil {+ memberSpaces, err := i.service.Store.ListSpaces(i.ctx, &store.FindSpace{MemberUserID: &i.user.ID})+ if err != nil {+ return nil, errors.Wrap(err, "failed to list spaces")+ }+ i.memberSpaces = memberSpaces+ }+ var resolved *int32+ for _, match := range []func(*store.Space) bool{+ func(candidate *store.Space) bool { return candidate.UID == space.UID },+ func(candidate *store.Space) bool { return space.Title != "" && candidate.Title == space.Title },+ } {+ for _, candidate := range i.memberSpaces {+ if candidate.CurrentUserRole.IsActiveMember() && match(candidate) {+ resolved = &candidate.ID+ break+ }+ }+ if resolved != nil {+ break+ }+ }+ i.spaces[space.UID] = resolved+ return resolved, nil+}++// resolveMemo finds the instance memo an archive UID refers to: one this run+// has already placed, or one on the instance the user may read.+func (i *memoArchiveImporter) resolveMemo(uid string) (*store.Memo, error) {+ if memo, ok := i.resolved[uid]; ok {+ return memo, nil+ }+ memo, err := i.service.Store.GetMemo(i.ctx, &store.FindMemo{UID: &uid, Access: newMemoAccessScope(i.user, true)})+ if err != nil {+ return nil, errors.Wrap(err, "failed to look up memo")+ }+ return memo, nil+}++// importAttachments creates the attachments of a record that the memo does+// not already hold and returns their names for binding.+func (i *memoArchiveImporter) importAttachments(record *memoarchive.Memo, current []*store.Attachment) ([]*v1pb.Attachment, error) {+ bound := make(map[string]struct{}, len(current))+ for _, attachment := range current {+ bound[attachment.UID] = struct{}{}+ }+ created := make([]*v1pb.Attachment, 0, len(record.Attachments))+ for index := range record.Attachments {+ entry := &record.Attachments[index]+ if _, ok := bound[entry.UID]; ok {+ continue+ }+ name, err := i.importAttachment(entry)+ if err != nil {+ i.discardAttachments(created)+ return nil, errors.Wrapf(err, "attachment %s", entry.UID)+ }+ created = append(created, &v1pb.Attachment{Name: name})+ }+ return created, nil+}++// importAttachment stores one attachment entry and returns the resource name+// to bind.+func (i *memoArchiveImporter) importAttachment(entry *memoarchive.Attachment) (string, error) {+ mimeType, ok := normalizeMimeType(entry.Type)+ if !ok {+ return "", errors.Errorf("invalid media type %q", entry.Type)+ }+ if !validateFilename(entry.Filename) {+ return "", errors.New("filename contains invalid characters")+ }+ uid, err := i.resolveAttachmentUID(entry)+ if err != nil {+ return "", err+ }+ if uid == "" {+ // An identical unlinked attachment already belongs to the user.+ return AttachmentNamePrefix + entry.UID, nil+ }+ if entry.ExternalLink != "" {+ attachment, err := i.service.Store.CreateAttachment(i.ctx, &store.Attachment{+ UID: uid,+ CreatorID: i.user.ID,+ Filename: entry.Filename,+ Type: mimeType,+ Size: entry.Size,+ StorageType: storepb.AttachmentStorageType_EXTERNAL,+ Reference: entry.ExternalLink,+ })+ if err != nil {+ return "", errors.Wrap(err, "failed to create external attachment")+ }+ return AttachmentNamePrefix + attachment.UID, nil+ }+ if err := checkUploadSize(i.storageSetting, entry.Size); err != nil {+ return "", err+ }+ data, err := i.archive.ReadAttachment(entry)+ if err != nil {+ return "", err+ }+ create := &store.Attachment{+ UID: uid,+ CreatorID: i.user.ID,+ Filename: entry.Filename,+ Type: mimeType,+ Size: int64(len(data)),+ }+ if len(entry.MediaMetadata) > 0 {+ metadata := &v1pb.MediaMetadata{}+ if err := (protojson.UnmarshalOptions{DiscardUnknown: true}).Unmarshal(entry.MediaMetadata, metadata); err != nil {+ i.warn("", fmt.Sprintf("attachment %s: media metadata was not understood and was dropped", entry.UID))+ } else if stored, err := validateClientMediaMetadata(metadata, mimeType); err != nil {+ i.warn("", fmt.Sprintf("attachment %s: media metadata was rejected and dropped: %v", entry.UID, err))+ } else if stored != nil {+ create.Payload = ensureAttachmentPayload(create.Payload)+ create.Payload.MediaMetadata = stored+ }+ }+ attachment, err := i.service.processAndSaveAttachment(i.ctx, create, i.storageSetting, bytes.NewReader(data))+ if err != nil {+ return "", err+ }+ return attachment.Name, nil+}++// resolveAttachmentUID decides which UID a new attachment gets. It returns+// the empty string when an unlinked attachment with the same UID, owner, and+// bytes already exists and should simply be bound.+func (i *memoArchiveImporter) resolveAttachmentUID(entry *memoarchive.Attachment) (string, error) {+ existing, err := i.service.Store.GetAttachment(i.ctx, &store.FindAttachment{UID: &entry.UID})+ if err != nil {+ return "", errors.Wrap(err, "failed to look up attachment")+ }+ if existing == nil {+ return entry.UID, nil+ }+ if entry.Path != "" && existing.CreatorID == i.user.ID && existing.MemoID == nil && existing.Size == entry.Size &&+ existing.StorageType != storepb.AttachmentStorageType_EXTERNAL {+ if digest, err := i.storedAttachmentDigest(existing); err == nil && digest == entry.SHA256 {+ return "", nil+ }+ }+ return shortuuid.New(), nil+}++// storedAttachmentDigest streams an attachment from storage and returns its+// lowercase hexadecimal SHA-256.+func (i *memoArchiveImporter) storedAttachmentDigest(attachment *store.Attachment) (string, error) {+ content, err := i.service.openAttachmentContent(i.ctx, attachment)+ if err != nil {+ return "", err+ }+ defer content.Close()+ digest := sha256.New()+ if _, err := io.Copy(digest, content); err != nil {+ return "", err+ }+ return hex.EncodeToString(digest.Sum(nil)), nil+}++// discardAttachments removes attachments this run created for a memo that+// then failed, so no orphan uploads are left behind.+func (i *memoArchiveImporter) discardAttachments(attachments []*v1pb.Attachment) {+ for _, attachment := range attachments {+ uid, err := ExtractAttachmentUIDFromName(attachment.Name)+ if err != nil {+ continue+ }+ stored, err := i.service.Store.GetAttachment(i.ctx, &store.FindAttachment{UID: &uid})+ if err != nil || stored == nil || stored.CreatorID != i.user.ID || stored.MemoID != nil {+ continue+ }+ if err := i.service.Store.DeleteAttachments(i.ctx, []*store.Attachment{stored}); err != nil {+ slog.Warn("failed to discard attachment after import failure", slog.String("uid", uid), slog.Any("error", err))+ }+ }+}++// applyRelations replaces the memo's REFERENCE relations with those from the+// record, skipping targets that exist neither in the archive nor on the+// instance.+func (i *memoArchiveImporter) applyRelations(written writtenMemo) error {+ record := written.record+ if len(record.Relations) == 0 {+ return nil+ }+ // Reload so the optimistic content check sees the memo as written.+ memo, err := i.service.Store.GetMemo(i.ctx, &store.FindMemo{ID: &written.memo.ID})+ if err != nil {+ return errors.Wrap(err, "failed to reload memo")+ }+ if memo == nil {+ return errors.New("memo disappeared during import")+ }+ relations := make([]*store.MemoRelation, 0, len(record.Relations))+ seen := map[int32]struct{}{memo.ID: {}}+ for _, relation := range record.Relations {+ target, err := i.resolveMemo(relation.Memo)+ if err != nil {+ return err+ }+ if target == nil {+ i.warn(record.UID, fmt.Sprintf("referenced memo %s was not found; the reference was dropped", relation.Memo))+ continue+ }+ if _, dup := seen[target.ID]; dup {+ continue+ }+ seen[target.ID] = struct{}{}+ relations = append(relations, &store.MemoRelation{MemoID: memo.ID, RelatedMemoID: target.ID, Type: store.MemoRelationReference})+ }+ if len(relations) == 0 {+ return nil+ }+ return i.service.applyMemoMutation(i.ctx, memo, nil, nil, nil, &relations)+}diff --git a/server/api/v1/test/attachment_service_s3_test.go b/server/api/v1/test/attachment_service_s3_test.goindex d7ad87f8e..a33017aab 100644--- a/server/api/v1/test/attachment_service_s3_test.go+++ b/server/api/v1/test/attachment_service_s3_test.go@@ -23,7 +23,7 @@ func TestS3AttachmentLifecycleAcrossStorageChange(t *testing.T) {func TestUploadAttachmentS3(t *testing.T) {ts := NewTestService(t)defer ts.Cleanup()- defer ts.Service.CloseAttachmentUploads()+ defer ts.Service.CloseUploads()fake := fakes3.New(t, "uploads")ctx := context.Background()user, err := ts.CreateRegularUser(ctx, "chunk-uploader")diff --git a/server/api/v1/test/memo_archive_test.go b/server/api/v1/test/memo_archive_test.gonew file mode 100644index 000000000..c6630199e--- /dev/null+++ b/server/api/v1/test/memo_archive_test.go@@ -0,0 +1,529 @@+package test++import (+ "bytes"+ "context"+ "crypto/sha256"+ "encoding/hex"+ "testing"+ "time"++ "github.com/stretchr/testify/require"+ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/status"+ "google.golang.org/protobuf/types/known/fieldmaskpb"+ "google.golang.org/protobuf/types/known/timestamppb"++ "github.com/usememos/memos/core/memoarchive"+ v1pb "github.com/usememos/memos/proto/gen/api/v1"+ apiv1 "github.com/usememos/memos/server/api/v1"+ "github.com/usememos/memos/store"+)++// archiveFixture is the state one user builds before exporting.+type archiveFixture struct {+ user *store.User+ userCtx context.Context+ photo []byte+ parent *v1pb.Memo+ archived *v1pb.Memo+ allMemoUIDs []string+}++func buildArchiveFixture(t *testing.T, ts *TestService, username string) *archiveFixture {+ t.Helper()+ ctx := context.Background()+ user, err := ts.CreateRegularUser(ctx, username)+ require.NoError(t, err)+ userCtx := ts.CreateUserContext(ctx, user.ID)+ space, err := ts.Store.CreateSpace(ctx, &store.Space{UID: "team-notes", Title: "Team Notes"}, user.ID)+ require.NoError(t, err)++ photo := []byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 1, 2, 3, 4}+ attachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{+ AttachmentId: "photo0001",+ Attachment: &v1pb.Attachment{Filename: "white board.png", Type: "image/png", Content: photo},+ })+ require.NoError(t, err)++ referenced, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{+ MemoId: "referenced1",+ Memo: &v1pb.Memo{+ Content: "Referenced memo #work",+ Visibility: v1pb.Visibility_PUBLIC,+ CreateTime: timestamppb.New(mustTime(t, "2026-03-01T09:00:00Z")),+ UpdateTime: timestamppb.New(mustTime(t, "2026-03-01T09:30:00Z")),+ },+ })+ require.NoError(t, err)++ parent, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{+ MemoId: "parent00001",+ Memo: &v1pb.Memo{+ Content: "# Whiteboard\n\nSee the photo. No trailing newline",+ Visibility: v1pb.Visibility_PRIVATE,+ Pinned: true,+ CreateTime: timestamppb.New(mustTime(t, "2026-03-02T14:05:11Z")),+ UpdateTime: timestamppb.New(mustTime(t, "2026-03-02T14:20:47Z")),+ Location: &v1pb.Location{Placeholder: "Office", Latitude: 52.52, Longitude: 13.405},+ Attachments: []*v1pb.Attachment{{Name: attachment.Name}},+ Relations: []*v1pb.MemoRelation{{Type: v1pb.MemoRelation_REFERENCE, RelatedMemo: &v1pb.MemoRelation_Memo{Name: referenced.Name}}},+ },+ })+ require.NoError(t, err)+ // Creation ignores pinned; pin the memo the way the client does.+ parent, err = ts.Service.UpdateMemo(userCtx, &v1pb.UpdateMemoRequest{+ Memo: &v1pb.Memo{Name: parent.Name, Pinned: true, UpdateTime: timestamppb.New(mustTime(t, "2026-03-02T14:20:47Z"))},+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"pinned", "update_time"}},+ })+ require.NoError(t, err)++ _, err = ts.Service.CreateMemoComment(userCtx, &v1pb.CreateMemoCommentRequest{+ Name: parent.Name,+ CommentId: "comment0001",+ Comment: &v1pb.Memo{+ Content: "A comment",+ Visibility: v1pb.Visibility_PRIVATE,+ CreateTime: timestamppb.New(mustTime(t, "2026-02-28T08:00:00Z")),+ },+ })+ require.NoError(t, err)++ spaceName := "spaces/" + space.UID+ _, err = ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{+ MemoId: "spacememo01",+ Memo: &v1pb.Memo{Content: "Shared with the team", Visibility: v1pb.Visibility_SPACE, Space: &spaceName},+ })+ require.NoError(t, err)++ archived, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{+ MemoId: "archived001",+ Memo: &v1pb.Memo{Content: "Old note", Visibility: v1pb.Visibility_PROTECTED},+ })+ require.NoError(t, err)+ archived, err = ts.Service.UpdateMemo(userCtx, &v1pb.UpdateMemoRequest{+ Memo: &v1pb.Memo{Name: archived.Name, State: v1pb.State_ARCHIVED},+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}},+ })+ require.NoError(t, err)++ return &archiveFixture{+ user: user, userCtx: userCtx, photo: photo, parent: parent, archived: archived,+ allMemoUIDs: []string{"referenced1", "parent00001", "comment0001", "spacememo01", "archived001"},+ }+}++func mustTime(t *testing.T, value string) time.Time {+ t.Helper()+ parsed, err := time.Parse(time.RFC3339, value)+ require.NoError(t, err)+ return parsed+}++func readArchive(t *testing.T, data []byte) *memoarchive.Archive {+ t.Helper()+ archive, err := memoarchive.Read(bytes.NewReader(data), int64(len(data)))+ require.NoError(t, err)+ return archive+}++func exportArchive(t *testing.T, ts *TestService, user *store.User) *memoarchive.Archive {+ t.Helper()+ return readArchive(t, exportArchiveBytes(t, ts, user))+}++func exportArchiveBytes(t *testing.T, ts *TestService, user *store.User) []byte {+ t.Helper()+ var buffer bytes.Buffer+ require.NoError(t, ts.Service.ExportMemoArchive(context.Background(), user, &buffer))+ return buffer.Bytes()+}++func archiveMemosByUID(archive *memoarchive.Archive) map[string]*memoarchive.Memo {+ byUID := make(map[string]*memoarchive.Memo, len(archive.Memos))+ for _, memo := range archive.Memos {+ byUID[memo.UID] = memo+ }+ return byUID+}++func TestExportMemoArchive(t *testing.T) {+ ts := NewTestService(t)+ defer ts.Cleanup()+ fixture := buildArchiveFixture(t, ts, "exporter")++ // Another user's memo must never appear, even when it comments on ours.+ other, err := ts.CreateRegularUser(context.Background(), "someone-else")+ require.NoError(t, err)+ _, err = ts.Service.CreateMemo(ts.CreateUserContext(context.Background(), other.ID), &v1pb.CreateMemoRequest{+ Memo: &v1pb.Memo{Content: "not yours", Visibility: v1pb.Visibility_PUBLIC},+ })+ require.NoError(t, err)++ archive := exportArchive(t, ts, fixture.user)+ require.Equal(t, memoarchive.ScopeKindUser, archive.Manifest.Scope.Kind)+ require.Equal(t, "exporter", archive.Manifest.Scope.User.Username)+ require.Equal(t, &memoarchive.Counts{Memos: 5, Attachments: 1}, archive.Manifest.Counts)+ require.Empty(t, archive.Warnings)+ require.Len(t, archive.Memos, 5)++ byUID := archiveMemosByUID(archive)+ for _, uid := range fixture.allMemoUIDs {+ require.Contains(t, byUID, uid)+ require.Equal(t, "exporter", byUID[uid].Creator)+ }++ parent := byUID["parent00001"]+ require.Equal(t, "2026-03-02T14:05:11Z", parent.CreateTime)+ require.Equal(t, "2026-03-02T14:20:47Z", parent.UpdateTime)+ require.Equal(t, "NORMAL", parent.State)+ require.Equal(t, "PRIVATE", parent.Visibility)+ require.True(t, parent.Pinned)+ require.Equal(t, &memoarchive.Location{Placeholder: "Office", Latitude: 52.52, Longitude: 13.405}, parent.Location)+ require.Equal(t, []memoarchive.Relation{{Type: "REFERENCE", Memo: "referenced1"}}, parent.Relations)+ require.Empty(t, parent.Parent)+ content, err := archive.Content(parent)+ require.NoError(t, err)+ require.Equal(t, "# Whiteboard\n\nSee the photo. No trailing newline", string(content))+ require.Len(t, parent.Attachments, 1)+ entry := parent.Attachments[0]+ require.Equal(t, "photo0001", entry.UID)+ require.Equal(t, "white board.png", entry.Filename)+ require.Equal(t, "image/png", entry.Type)+ require.Equal(t, "attachments/photo0001/white board.png", entry.Path)+ digest := sha256.Sum256(fixture.photo)+ require.Equal(t, hex.EncodeToString(digest[:]), entry.SHA256)+ require.Equal(t, int64(len(fixture.photo)), entry.Size)+ photoBytes, err := archive.ReadAttachment(&entry)+ require.NoError(t, err)+ require.Equal(t, fixture.photo, photoBytes)++ comment := byUID["comment0001"]+ require.Equal(t, "parent00001", comment.Parent)+ require.Equal(t, "2026-02-28T08:00:00Z", comment.CreateTime)+ // The comment is older than its parent but must still follow it.+ require.Less(t, indexOfMemo(archive, "parent00001"), indexOfMemo(archive, "comment0001"))++ require.Equal(t, &memoarchive.Space{UID: "team-notes", Title: "Team Notes"}, byUID["spacememo01"].Space)+ require.Equal(t, "SPACE", byUID["spacememo01"].Visibility)+ require.Equal(t, "ARCHIVED", byUID["archived001"].State)+ require.Equal(t, "PROTECTED", byUID["archived001"].Visibility)+ require.Equal(t, []string{"work"}, byUID["referenced1"].Tags)+}++func indexOfMemo(archive *memoarchive.Archive, uid string) int {+ for index, memo := range archive.Memos {+ if memo.UID == uid {+ return index+ }+ }+ return -1+}++func TestImportMemoArchiveIntoAnotherAccount(t *testing.T) {+ ts := NewTestService(t)+ defer ts.Cleanup()+ fixture := buildArchiveFixture(t, ts, "exporter")+ archive := exportArchive(t, ts, fixture.user)++ ctx := context.Background()+ importer, err := ts.CreateRegularUser(ctx, "importer")+ require.NoError(t, err)+ importerCtx := ts.CreateUserContext(ctx, importer.ID)++ report, err := ts.Service.ImportMemoArchive(importerCtx, importer, archive, v1pb.ImportMemosRequest_SKIP)+ require.NoError(t, err)+ require.Equal(t, int32(5), report.Created)+ require.Zero(t, report.Updated)+ require.Zero(t, report.Skipped)+ require.Zero(t, report.Failed, "%v", report.Failures)+ // The space memo cannot land in a space the importer does not belong to.+ require.Len(t, report.Warnings, 2)+ require.Contains(t, report.Warnings[0].Message, "space")+ require.Contains(t, report.Warnings[1].Message, "SPACE visibility")++ memos, err := ts.Store.ListMemos(ctx, &store.FindMemo{CreatorID: &importer.ID})+ require.NoError(t, err)+ require.Len(t, memos, 5)+ byContent := make(map[string]*store.Memo, len(memos))+ for _, memo := range memos {+ byContent[memo.Content] = memo+ // The exporter still owns every original UID, so each import got a fresh one.+ require.NotContains(t, fixture.allMemoUIDs, memo.UID)+ require.Equal(t, importer.ID, memo.CreatorID)+ }++ parent := byContent["# Whiteboard\n\nSee the photo. No trailing newline"]+ require.NotNil(t, parent)+ require.True(t, parent.Pinned)+ require.Equal(t, store.Private, parent.Visibility)+ require.Equal(t, mustTime(t, "2026-03-02T14:05:11Z").Unix(), parent.CreatedTs)+ require.Equal(t, mustTime(t, "2026-03-02T14:20:47Z").Unix(), parent.UpdatedTs)+ require.Equal(t, "Office", parent.Payload.GetLocation().GetPlaceholder())+ require.InDelta(t, 52.52, parent.Payload.GetLocation().GetLatitude(), 0.0001)++ comment := byContent["A comment"]+ require.NotNil(t, comment)+ require.NotNil(t, comment.ParentUID)+ require.Equal(t, parent.UID, *comment.ParentUID)++ referenced := byContent["Referenced memo #work"]+ require.NotNil(t, referenced)+ require.Equal(t, []string{"work"}, referenced.Payload.GetTags())+ relations, err := ts.Store.ListMemoRelations(ctx, &store.FindMemoRelation{MemoID: &parent.ID})+ require.NoError(t, err)+ var references []*store.MemoRelation+ for _, relation := range relations {+ if relation.Type == store.MemoRelationReference {+ references = append(references, relation)+ }+ }+ require.Len(t, references, 1)+ require.Equal(t, referenced.ID, references[0].RelatedMemoID)++ spaceMemo := byContent["Shared with the team"]+ require.NotNil(t, spaceMemo)+ require.Nil(t, spaceMemo.SpaceID)+ require.Equal(t, store.Private, spaceMemo.Visibility)++ archived := byContent["Old note"]+ require.NotNil(t, archived)+ require.Equal(t, store.Archived, archived.RowStatus)+ require.Equal(t, store.Protected, archived.Visibility)++ attachments, err := ts.Store.ListAttachments(ctx, &store.FindAttachment{MemoID: &parent.ID})+ require.NoError(t, err)+ require.Len(t, attachments, 1)+ require.Equal(t, "white board.png", attachments[0].Filename)+ require.Equal(t, importer.ID, attachments[0].CreatorID)+ require.NotEqual(t, "photo0001", attachments[0].UID, "the exporter still owns the original attachment UID")+ blob, err := ts.Service.GetAttachmentBlob(ctx, attachments[0])+ require.NoError(t, err)+ require.Equal(t, fixture.photo, blob)+}++func TestPlanMemoArchiveImport(t *testing.T) {+ ts := NewTestService(t)+ defer ts.Cleanup()+ fixture := buildArchiveFixture(t, ts, "owner")+ archive := exportArchive(t, ts, fixture.user)+ ctx := context.Background()++ // Delete one memo so its UID is free, and let another account take one.+ _, err := ts.Service.DeleteMemo(fixture.userCtx, &v1pb.DeleteMemoRequest{Name: fixture.archived.Name})+ require.NoError(t, err)+ other, err := ts.CreateRegularUser(ctx, "other")+ require.NoError(t, err)+ otherCtx := ts.CreateUserContext(ctx, other.ID)+ stranger, err := ts.CreateRegularUser(ctx, "stranger")+ require.NoError(t, err)+ _, err = ts.Service.CreateMemo(ts.CreateUserContext(ctx, stranger.ID), &v1pb.CreateMemoRequest{+ MemoId: "archived001", Memo: &v1pb.Memo{Content: "took the uid", Visibility: v1pb.Visibility_PRIVATE},+ })+ require.NoError(t, err)++ plan, err := ts.Service.PlanMemoArchiveImport(fixture.userCtx, fixture.user, archive)+ require.NoError(t, err)+ require.Equal(t, int32(5), plan.Memos)+ require.Equal(t, int32(4), plan.Existing)+ require.Equal(t, int32(1), plan.Renamed)+ require.Zero(t, plan.New)++ plan, err = ts.Service.PlanMemoArchiveImport(otherCtx, other, archive)+ require.NoError(t, err)+ require.Zero(t, plan.Existing)+ require.Equal(t, int32(5), plan.Renamed)+ require.Zero(t, plan.New)+}++func TestImportMemoArchiveConflictPolicies(t *testing.T) {+ ts := NewTestService(t)+ defer ts.Cleanup()+ fixture := buildArchiveFixture(t, ts, "owner")+ data := exportArchiveBytes(t, ts, fixture.user)+ ctx := context.Background()+ openArchive := func() *memoarchive.Archive { return readArchive(t, data) }+ countOwn := func() int {+ memos, err := ts.Store.ListMemos(ctx, &store.FindMemo{CreatorID: &fixture.user.ID})+ require.NoError(t, err)+ return len(memos)+ }++ t.Run("skip is idempotent", func(t *testing.T) {+ report, err := ts.Service.ImportMemoArchive(fixture.userCtx, fixture.user, openArchive(), v1pb.ImportMemosRequest_SKIP)+ require.NoError(t, err)+ require.Equal(t, int32(5), report.Skipped)+ require.Zero(t, report.Created+report.Updated+report.Failed)+ require.Equal(t, 5, countOwn())+ })++ t.Run("replace updates in place", func(t *testing.T) {+ // Change the memo on the instance, then bring the archive back.+ _, err := ts.Service.UpdateMemo(fixture.userCtx, &v1pb.UpdateMemoRequest{+ Memo: &v1pb.Memo{Name: fixture.parent.Name, Content: "edited after export", Pinned: false},+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content", "pinned"}},+ })+ require.NoError(t, err)++ report, err := ts.Service.ImportMemoArchive(fixture.userCtx, fixture.user, openArchive(), v1pb.ImportMemosRequest_REPLACE)+ require.NoError(t, err)+ require.Equal(t, int32(5), report.Updated, "%v", report.Failures)+ require.Zero(t, report.Failed)+ require.Equal(t, 5, countOwn())++ uid := "parent00001"+ restored, err := ts.Store.GetMemo(ctx, &store.FindMemo{UID: &uid})+ require.NoError(t, err)+ require.Equal(t, "# Whiteboard\n\nSee the photo. No trailing newline", restored.Content)+ require.True(t, restored.Pinned)+ require.Equal(t, mustTime(t, "2026-03-02T14:20:47Z").Unix(), restored.UpdatedTs)+ attachments, err := ts.Store.ListAttachments(ctx, &store.FindAttachment{MemoID: &restored.ID})+ require.NoError(t, err)+ require.Len(t, attachments, 1, "the bound attachment is kept, not duplicated")+ require.Equal(t, "photo0001", attachments[0].UID)+ })++ t.Run("duplicate creates copies", func(t *testing.T) {+ report, err := ts.Service.ImportMemoArchive(fixture.userCtx, fixture.user, openArchive(), v1pb.ImportMemosRequest_DUPLICATE)+ require.NoError(t, err)+ require.Equal(t, int32(5), report.Created, "%v", report.Failures)+ require.Zero(t, report.Failed)+ require.Equal(t, 10, countOwn())++ memos, err := ts.Store.ListMemos(ctx, &store.FindMemo{CreatorID: &fixture.user.ID})+ require.NoError(t, err)+ var copies []*store.Memo+ for _, memo := range memos {+ if memo.Content == "A comment" && memo.UID != "comment0001" {+ copies = append(copies, memo)+ }+ }+ require.Len(t, copies, 1)+ require.NotNil(t, copies[0].ParentUID)+ require.NotEqual(t, "parent00001", *copies[0].ParentUID, "the copied comment threads under the copied parent")+ })+}++func userName(user *store.User) string {+ return apiv1.BuildUserName(user.Username)+}++func TestExportMemos(t *testing.T) {+ ts := NewTestService(t)+ defer ts.Cleanup()+ fixture := buildArchiveFixture(t, ts, "owner")+ ctx := context.Background()++ body, err := ts.Service.ExportMemos(fixture.userCtx, &v1pb.ExportMemosRequest{Name: userName(fixture.user)})+ require.NoError(t, err)+ require.Equal(t, memoarchive.MediaType, body.ContentType)+ require.Len(t, readArchive(t, body.Data).Memos, 5)++ other, err := ts.CreateRegularUser(ctx, "other")+ require.NoError(t, err)+ _, err = ts.Service.ExportMemos(ts.CreateUserContext(ctx, other.ID), &v1pb.ExportMemosRequest{Name: userName(fixture.user)})+ require.Equal(t, codes.PermissionDenied, status.Code(err))+ _, err = ts.Service.ExportMemos(ctx, &v1pb.ExportMemosRequest{Name: userName(fixture.user)})+ require.Equal(t, codes.Unauthenticated, status.Code(err))+}++func TestImportMemos(t *testing.T) {+ ts := NewTestService(t)+ defer ts.Cleanup()+ t.Cleanup(ts.Service.CloseUploads)+ fixture := buildArchiveFixture(t, ts, "owner")+ exported := exportArchiveBytes(t, ts, fixture.user)+ name := userName(fixture.user)+ importMemos := func(ctx context.Context, request *v1pb.ImportMemosRequest) (*v1pb.ImportMemosResponse, error) {+ request.Name = name+ return ts.Service.ImportMemos(ctx, request)+ }++ t.Run("one call stages, plans, then imports on a second finish", func(t *testing.T) {+ response, err := importMemos(fixture.userCtx, &v1pb.ImportMemosRequest{+ Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(exported))}},+ Data: exported,+ FinishWrite: true,+ ValidateOnly: true,+ })+ require.NoError(t, err)+ require.NotEmpty(t, response.UploadId)+ require.Equal(t, int64(len(exported)), response.CommittedSize)+ plan := response.GetPlan()+ require.NotNil(t, plan, "a validate-only finish returns the plan")+ require.Equal(t, "owner", plan.Exporter)+ require.Equal(t, int32(5), plan.Memos)+ require.Equal(t, int32(1), plan.Attachments)+ require.Equal(t, int32(5), plan.Existing)+ require.NotNil(t, plan.ExportTime)++ response, err = importMemos(fixture.userCtx, &v1pb.ImportMemosRequest{+ Upload: &v1pb.ImportMemosRequest_UploadId{UploadId: response.UploadId},+ WriteOffset: int64(len(exported)),+ FinishWrite: true,+ ConflictPolicy: v1pb.ImportMemosRequest_SKIP,+ })+ require.NoError(t, err)+ report := response.GetReport()+ require.NotNil(t, report, "a finishing call without validate_only imports")+ require.Equal(t, int32(5), report.Skipped)++ // A later call for an imported upload returns the same report.+ again, err := importMemos(fixture.userCtx, &v1pb.ImportMemosRequest{+ Upload: &v1pb.ImportMemosRequest_UploadId{UploadId: response.UploadId},+ WriteOffset: int64(len(exported)),+ FinishWrite: true,+ })+ require.NoError(t, err)+ require.Equal(t, int32(5), again.GetReport().Skipped)+ })++ t.Run("chunks arrive in order and import straight away", func(t *testing.T) {+ importer, err := ts.CreateRegularUser(context.Background(), "chunked")+ require.NoError(t, err)+ importerCtx := ts.CreateUserContext(context.Background(), importer.ID)+ half := len(exported) / 2+ first, err := ts.Service.ImportMemos(importerCtx, &v1pb.ImportMemosRequest{+ Name: userName(importer),+ Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(exported))}},+ Data: exported[:half],+ })+ require.NoError(t, err)+ require.Nil(t, first.Result)+ require.Equal(t, int64(half), first.CommittedSize)+ second, err := ts.Service.ImportMemos(importerCtx, &v1pb.ImportMemosRequest{+ Name: userName(importer),+ Upload: &v1pb.ImportMemosRequest_UploadId{UploadId: first.UploadId},+ WriteOffset: int64(half),+ Data: exported[half:],+ FinishWrite: true,+ })+ require.NoError(t, err)+ require.Equal(t, int32(5), second.GetReport().Created)+ })++ t.Run("rejects a file that is not an archive", func(t *testing.T) {+ garbage := []byte("not a zip")+ _, err := importMemos(fixture.userCtx, &v1pb.ImportMemosRequest{+ Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(garbage))}},+ Data: garbage,+ FinishWrite: true,+ })+ require.Equal(t, codes.InvalidArgument, status.Code(err))+ require.Contains(t, err.Error(), "invalid memo archive")+ })++ t.Run("refuses another account's upload id", func(t *testing.T) {+ response, err := importMemos(fixture.userCtx, &v1pb.ImportMemosRequest{+ Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(exported))}},+ })+ require.NoError(t, err)+ other, err := ts.CreateRegularUser(context.Background(), "intruder")+ require.NoError(t, err)+ _, err = ts.Service.ImportMemos(ts.CreateUserContext(context.Background(), other.ID), &v1pb.ImportMemosRequest{+ Name: userName(other),+ Upload: &v1pb.ImportMemosRequest_UploadId{UploadId: response.UploadId},+ })+ require.Equal(t, codes.NotFound, status.Code(err))+ })+}diff --git a/server/api/v1/upload_session.go b/server/api/v1/upload_session.gonew file mode 100644index 000000000..916349990--- /dev/null+++ b/server/api/v1/upload_session.go@@ -0,0 +1,264 @@+package v1++import (+ "crypto/rand"+ "crypto/sha256"+ "io"+ "os"+ "path/filepath"+ "sync"+ "time"++ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/status"+)++// Limits shared by every chunked upload RPC.+const (+ uploadChunkSize = 2 << 20+ uploadRequestLimit = 4 << 20+ uploadTTL = 30 * time.Minute+ uploadMaxSessions = 1024+ uploadMaxActive = 128+ uploadMaxActivePerUser = 8+)++// uploadSession is one chunked upload staged in a temporary file. Upload+// state is private to the process. A session holds the last chunk's digest,+// never its contents, plus a kind-specific state T.+type uploadSession[T any] struct {+ mu sync.Mutex+ ownerID int32+ path string+ totalSize int64+ committedSize int64+ // expireTime is zeroed to revoke an upload before its TTL elapses.+ expireTime time.Time+ // lastDigest identifies the most recently accepted chunk so a client can+ // safely resend it after losing the response.+ lastDigest [sha256.Size]byte+ complete bool+ state T+}++// write appends one chunk at writeOffset. With no data and finishWrite+// false it only reports progress. finishWrite requires the committed size to+// equal the total size once the data is written.+func (u *uploadSession[T]) write(writeOffset int64, data []byte, finishWrite bool) error {+ if len(data) == 0 {+ if finishWrite && writeOffset != u.committedSize {+ return status.Errorf(codes.OutOfRange, "write_offset must equal committed_size")+ }+ return nil+ }+ digest := sha256.Sum256(data)+ if u.committedSize > 0 && writeOffset+int64(len(data)) == u.committedSize && digest == u.lastDigest {+ return nil // A lost response can be retried without appending bytes twice.+ }+ if u.complete {+ return status.Errorf(codes.FailedPrecondition, "upload is already complete")+ }+ if writeOffset != u.committedSize {+ return status.Errorf(codes.OutOfRange, "write_offset must equal committed_size")+ }+ if int64(len(data)) > u.totalSize-u.committedSize {+ return status.Errorf(codes.InvalidArgument, "data exceeds total_size")+ }+ file, err := os.OpenFile(u.path, os.O_WRONLY, 0600)+ if err != nil {+ return status.Errorf(codes.Internal, "failed to open upload file: %v", err)+ }+ defer file.Close()+ n, err := file.WriteAt(data, u.committedSize)+ if err == nil && n != len(data) {+ err = io.ErrShortWrite+ }+ if err != nil {+ return status.Errorf(codes.Internal, "failed to write upload file: %v", err)+ }+ if err := file.Sync(); err != nil {+ return status.Errorf(codes.Internal, "failed to sync upload file: %v", err)+ }+ u.committedSize += int64(len(data))+ u.lastDigest = digest+ return nil+}++// uploadSessions tracks the sessions of one upload kind, sweeps expired ones+// and orphaned files under its temp prefix, and bounds how many are active.+type uploadSessions[T any] struct {+ mu sync.Mutex+ prefix string+ entries map[string]*uploadSession[T]+ stop chan struct{}+ done chan struct{}+ closed bool+}++func (m *uploadSessions[T]) startLocked(dir, prefix string) {+ if m.entries != nil {+ return+ }+ m.prefix = prefix+ m.entries = make(map[string]*uploadSession[T])+ m.stop = make(chan struct{})+ m.done = make(chan struct{})+ go func() {+ defer close(m.done)+ ticker := time.NewTicker(time.Minute)+ defer ticker.Stop()+ for {+ select {+ case <-m.stop:+ return+ case now := <-ticker.C:+ m.mu.Lock()+ m.sweepLocked(now, 0)+ m.removeOrphansLocked(dir, now)+ m.mu.Unlock()+ }+ }+ }()+}++// sweepLocked drops expired uploads and counts the unfinished ones, both in+// total and for ownerID. An upload locked by an in-flight request is+// unfinished by definition.+func (m *uploadSessions[T]) sweepLocked(now time.Time, ownerID int32) (owned, total int) {+ count := func(upload *uploadSession[T]) {+ total+++ if upload.ownerID == ownerID {+ owned+++ }+ }+ for id, upload := range m.entries {+ // Never hold the manager lock while waiting for a file write or finalize.+ if !upload.mu.TryLock() {+ count(upload)+ continue+ }+ if !now.Before(upload.expireTime) {+ os.Remove(upload.path)+ delete(m.entries, id)+ } else if !upload.complete {+ count(upload)+ }+ upload.mu.Unlock()+ }+ return owned, total+}++func (m *uploadSessions[T]) removeOrphansLocked(dir string, now time.Time) {+ tracked := make(map[string]bool, len(m.entries))+ for _, upload := range m.entries {+ tracked[upload.path] = true // path is immutable after insertion.+ }+ paths, _ := filepath.Glob(filepath.Join(dir, m.prefix+"*"))+ for _, path := range paths {+ if tracked[path] {+ continue+ }+ if info, err := os.Stat(path); err == nil && info.Mode().IsRegular() && now.Sub(info.ModTime()) >= uploadTTL {+ os.Remove(path)+ }+ }+}++// create registers a new session for ownerID with totalSize bytes to come,+// backed by a temp file under dir named with prefix, and returns its id.+func (m *uploadSessions[T]) create(dir, prefix string, ownerID int32, totalSize int64, state T) (string, *uploadSession[T], error) {+ m.mu.Lock()+ defer m.mu.Unlock()+ if m.closed {+ return "", nil, status.Errorf(codes.Unavailable, "server is shutting down")+ }+ m.startLocked(dir, prefix)+ owned, total := m.sweepLocked(time.Now(), ownerID)+ if owned >= uploadMaxActivePerUser {+ return "", nil, status.Errorf(codes.ResourceExhausted, "too many active uploads")+ }+ if len(m.entries) >= uploadMaxSessions || total >= uploadMaxActive {+ return "", nil, status.Errorf(codes.ResourceExhausted, "too many uploads")+ }+ file, err := os.CreateTemp(dir, prefix+"*")+ if err != nil {+ return "", nil, status.Errorf(codes.Internal, "failed to create upload file: %v", err)+ }+ if err := file.Close(); err != nil {+ os.Remove(file.Name())+ return "", nil, status.Errorf(codes.Internal, "failed to close upload file: %v", err)+ }+ upload := &uploadSession[T]{+ ownerID: ownerID,+ path: file.Name(),+ totalSize: totalSize,+ expireTime: time.Now().Add(uploadTTL),+ state: state,+ }+ id := rand.Text()+ m.entries[id] = upload+ return id, upload, nil+}++func (m *uploadSessions[T]) get(id string, ownerID int32) (*uploadSession[T], error) {+ m.mu.Lock()+ upload := m.entries[id]+ closed := m.closed+ m.mu.Unlock()+ if closed {+ return nil, status.Errorf(codes.Unavailable, "server is shutting down")+ }+ if upload == nil || upload.ownerID != ownerID {+ return nil, status.Errorf(codes.NotFound, "upload not found or expired")+ }+ return upload, nil+}++// resume looks up and locks the session for a continuing call. The caller+// unlocks it.+func (m *uploadSessions[T]) resume(id string, ownerID int32) (*uploadSession[T], error) {+ upload, err := m.get(id, ownerID)+ if err != nil {+ return nil, err+ }+ upload.mu.Lock()+ if !time.Now().Before(upload.expireTime) {+ upload.mu.Unlock()+ return nil, status.Errorf(codes.NotFound, "upload not found or expired")+ }+ return upload, nil+}++// close stops expiration work and removes pending upload files.+func (m *uploadSessions[T]) close() {+ m.mu.Lock()+ if m.closed {+ m.mu.Unlock()+ return+ }+ m.closed = true+ if m.stop != nil {+ close(m.stop)+ }+ done := m.done+ m.mu.Unlock()+ if done != nil {+ <-done+ }+ m.mu.Lock()+ defer m.mu.Unlock()+ for id, upload := range m.entries {+ upload.mu.Lock()+ upload.expireTime = time.Time{}+ os.Remove(upload.path)+ upload.mu.Unlock()+ delete(m.entries, id)+ }+}++// CloseUploads stops every upload manager and removes pending upload files.+// Call it after draining HTTP requests during server shutdown.+func (s *APIV1Service) CloseUploads() {+ s.attachmentUploads.close()+ s.memoImports.close()+}diff --git a/server/api/v1/user_service_memo_archive.go b/server/api/v1/user_service_memo_archive.gonew file mode 100644index 000000000..b785617cd--- /dev/null+++ b/server/api/v1/user_service_memo_archive.go@@ -0,0 +1,161 @@+package v1++import (+ "bytes"+ "context"+ "log/slog"+ "os"+ "time"++ "google.golang.org/genproto/googleapis/api/httpbody"+ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/status"++ "github.com/usememos/memos/core/memoarchive"+ "github.com/usememos/memos/internal/ratelimit"+ v1pb "github.com/usememos/memos/proto/gen/api/v1"+ "github.com/usememos/memos/store"+)++const (+ importMemosProcedure = "/memos.api.v1.UserService/ImportMemos"+ memoImportTempPrefix = ".memos-rpc-import-"+ // maxMemoImportBytes caps one staged archive.+ maxMemoImportBytes = 4 << 30+)++// memoImportState is what a staged archive carries besides its bytes: the+// report, once the finishing call has imported it.+type memoImportState struct {+ report *v1pb.MemoImportReport+}++type memoImports = uploadSessions[memoImportState]++// resolveArchiveOwner resolves users/{user} and asserts it is the caller.+func (s *APIV1Service) resolveArchiveOwner(ctx context.Context, name string) (*store.User, error) {+ user, err := ResolveUserByName(ctx, s.Store, name)+ if err != nil {+ return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err)+ }+ if user == nil {+ return nil, status.Errorf(codes.NotFound, "user not found")+ }+ if err := s.requireCallerIs(ctx, user); err != nil {+ return nil, err+ }+ return user, nil+}++// ExportMemos writes the caller's Memo Archive into the response body.+func (s *APIV1Service) ExportMemos(ctx context.Context, request *v1pb.ExportMemosRequest) (*httpbody.HttpBody, error) {+ user, err := s.resolveArchiveOwner(ctx, request.Name)+ if err != nil {+ return nil, err+ }+ if err := s.throttleAndCharge(ratelimit.ScopeArchiveUser, userKey(user.ID), 1); err != nil {+ return nil, err+ }+ var archive bytes.Buffer+ if err := s.ExportMemoArchive(ctx, user, &archive); err != nil {+ slog.Error("memo archive export failed", slog.Int("user", int(user.ID)), slog.Any("error", err))+ return nil, status.Error(codes.Internal, "failed to export memos")+ }+ return &httpbody.HttpBody{ContentType: memoarchive.MediaType, Data: archive.Bytes()}, nil+}++// ImportMemos stages an archive in chunks and, on the finishing call, plans+// or imports it. See the proto comment for the protocol.+func (s *APIV1Service) ImportMemos(ctx context.Context, request *v1pb.ImportMemosRequest) (*v1pb.ImportMemosResponse, error) {+ user, err := s.resolveArchiveOwner(ctx, request.Name)+ if err != nil {+ return nil, err+ }+ if len(request.Data) > uploadChunkSize {+ return nil, status.Errorf(codes.ResourceExhausted, "upload chunk exceeds the limit")+ }+ var id string+ var upload *uploadSession[memoImportState]+ switch u := request.Upload.(type) {+ case *v1pb.ImportMemosRequest_Spec:+ if err := s.throttleAndCharge(ratelimit.ScopeArchiveUser, userKey(user.ID), 1); err != nil {+ return nil, err+ }+ if u.Spec.TotalSize < 0 || u.Spec.TotalSize > maxMemoImportBytes {+ return nil, status.Errorf(codes.InvalidArgument, "invalid total_size")+ }+ if request.WriteOffset != 0 {+ return nil, status.Errorf(codes.OutOfRange, "write_offset must be 0 for a new upload")+ }+ if int64(len(request.Data)) > u.Spec.TotalSize {+ return nil, status.Errorf(codes.InvalidArgument, "data exceeds total_size")+ }+ id, upload, err = s.memoImports.create(s.Profile.Data, memoImportTempPrefix, user.ID, u.Spec.TotalSize, memoImportState{})+ if err != nil {+ return nil, err+ }+ upload.mu.Lock()+ case *v1pb.ImportMemosRequest_UploadId:+ id = u.UploadId+ upload, err = s.memoImports.resume(id, user.ID)+ if err != nil {+ return nil, err+ }+ default:+ return nil, status.Errorf(codes.InvalidArgument, "spec or upload_id is required")+ }+ defer upload.mu.Unlock()+ if err := ctx.Err(); err != nil {+ return nil, status.FromContextError(err).Err()+ }+ if err := upload.write(request.WriteOffset, request.Data, request.FinishWrite); err != nil {+ return nil, err+ }+ response := &v1pb.ImportMemosResponse{UploadId: id, CommittedSize: upload.committedSize, MaxChunkSize: uploadChunkSize}+ if upload.complete {+ response.Result = &v1pb.ImportMemosResponse_Report{Report: upload.state.report}+ } else if request.FinishWrite {+ if upload.committedSize != upload.totalSize {+ return nil, status.Errorf(codes.FailedPrecondition, "upload is incomplete")+ }+ if err := s.finishMemoImport(ctx, user, upload, request, response); err != nil {+ return nil, err+ }+ }+ upload.expireTime = time.Now().Add(uploadTTL)+ return response, nil+}++// finishMemoImport reads the staged archive and either plans or imports it,+// setting the response result. An import completes the session; a plan+// leaves it staged.+func (s *APIV1Service) finishMemoImport(ctx context.Context, user *store.User, upload *uploadSession[memoImportState], request *v1pb.ImportMemosRequest, response *v1pb.ImportMemosResponse) error {+ file, err := os.Open(upload.path)+ if err != nil {+ return status.Errorf(codes.Internal, "failed to open upload file: %v", err)+ }+ defer file.Close()+ archive, err := memoarchive.Read(file, upload.totalSize)+ if err != nil {+ return status.Errorf(codes.InvalidArgument, "invalid memo archive: %v", err)+ }+ if request.ValidateOnly {+ plan, err := s.PlanMemoArchiveImport(ctx, user, archive)+ if err != nil {+ slog.Error("memo archive plan failed", slog.Int("user", int(user.ID)), slog.Any("error", err))+ return status.Error(codes.Internal, "failed to inspect the archive")+ }+ response.Result = &v1pb.ImportMemosResponse_Plan{Plan: plan}+ return nil+ }+ report, err := s.ImportMemoArchive(ctx, user, archive, request.ConflictPolicy)+ if err != nil {+ slog.Error("memo archive import failed", slog.Int("user", int(user.ID)), slog.Any("error", err))+ return status.Error(codes.Internal, "failed to import memos")+ }+ upload.state.report = report+ upload.complete = true+ os.Remove(upload.path)+ response.Result = &v1pb.ImportMemosResponse_Report{Report: report}+ return nil+}diff --git a/server/api/v1/user_service_memo_views.go b/server/api/v1/user_service_memo_views.goindex 5b4cd0a99..6faf3430a 100644--- a/server/api/v1/user_service_memo_views.go+++ b/server/api/v1/user_service_memo_views.go@@ -57,9 +57,9 @@ func convertMemoViewFromStore(username string, memoView *storepb.MemoViewsUserSe}}-// authorizeMemoViewAccess resolves the owner of a memo view collection and asserts that-// the caller is that owner.-func (s *APIV1Service) authorizeMemoViewAccess(ctx context.Context, user *store.User) error {+// requireCallerIs asserts that the caller is user. Personal resources such as+// memo views and memo archives are never reachable by another account.+func (s *APIV1Service) requireCallerIs(ctx context.Context, user *store.User) error {currentUser, err := s.fetchCurrentUser(ctx)if err != nil {return status.Errorf(codes.Internal, "failed to get current user: %v", err)@@ -82,7 +82,7 @@ func (s *APIV1Service) ListMemoViews(ctx context.Context, request *v1pb.ListMemoif user == nil {return nil, status.Errorf(codes.NotFound, "user not found")}- if err := s.authorizeMemoViewAccess(ctx, user); err != nil {+ if err := s.requireCallerIs(ctx, user); err != nil {return nil, err}@@ -107,7 +107,7 @@ func (s *APIV1Service) GetMemoView(ctx context.Context, request *v1pb.GetMemoVieif err != nil {return nil, status.Errorf(codes.InvalidArgument, "invalid memo view name: %v", err)}- if err := s.authorizeMemoViewAccess(ctx, user); err != nil {+ if err := s.requireCallerIs(ctx, user); err != nil {return nil, err}@@ -133,7 +133,7 @@ func (s *APIV1Service) CreateMemoView(ctx context.Context, request *v1pb.CreateMif user == nil {return nil, status.Errorf(codes.NotFound, "user not found")}- if err := s.authorizeMemoViewAccess(ctx, user); err != nil {+ if err := s.requireCallerIs(ctx, user); err != nil {return nil, err}if err := s.throttleAndCharge(ratelimit.ScopeWriteUser, userKey(auth.GetUserID(ctx)), 1); err != nil {@@ -172,7 +172,7 @@ func (s *APIV1Service) UpdateMemoView(ctx context.Context, request *v1pb.UpdateMif err != nil {return nil, status.Errorf(codes.InvalidArgument, "invalid memo view name: %v", err)}- if err := s.authorizeMemoViewAccess(ctx, user); err != nil {+ if err := s.requireCallerIs(ctx, user); err != nil {return nil, err}if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 {@@ -223,7 +223,7 @@ func (s *APIV1Service) DeleteMemoView(ctx context.Context, request *v1pb.DeleteMif err != nil {return nil, status.Errorf(codes.InvalidArgument, "invalid memo view name: %v", err)}- if err := s.authorizeMemoViewAccess(ctx, user); err != nil {+ if err := s.requireCallerIs(ctx, user); err != nil {return nil, err}diff --git a/server/api/v1/v1.go b/server/api/v1/v1.goindex 75b7d9e9a..e15d2eeb1 100644--- a/server/api/v1/v1.go+++ b/server/api/v1/v1.go@@ -32,8 +32,8 @@ const MaxAPIRequestBytes = 256 << 20// requestBodyLimit returns the request body cap for a procedure. Chunked// uploads carry at most one chunk per call, so they get a much lower cap.func requestBodyLimit(procedure string) int64 {- if procedure == attachmentUploadProcedure {- return attachmentUploadRequestLimit+ if procedure == attachmentUploadProcedure || procedure == importMemosProcedure {+ return uploadRequestLimit}return MaxAPIRequestBytes}@@ -73,6 +73,7 @@ type APIV1Service struct {linkMetadataFetcher linkMetadataFetcherattachmentUploads attachmentUploads+ memoImports memoImports}// NewAPIV1Service creates an API v1 service with its shared dependencies.diff --git a/server/server.go b/server/server.goindex 531aea4c8..4d71f8366 100644--- a/server/server.go+++ b/server/server.go@@ -135,7 +135,7 @@ func (s *Server) Shutdown(ctx context.Context) {s.closeLongLivedConnections()s.shutdownHTTPServer(ctx)- s.apiV1Service.CloseAttachmentUploads()+ s.apiV1Service.CloseUploads()// Close database connection.if err := s.Store.Close(); err != nil {diff --git a/web/src/components/Settings/MemoArchiveSection.tsx b/web/src/components/Settings/MemoArchiveSection.tsxnew file mode 100644index 000000000..07763e0c2--- /dev/null+++ b/web/src/components/Settings/MemoArchiveSection.tsx@@ -0,0 +1,223 @@+import { timestampDate } from "@bufbuild/protobuf/wkt";+import { Code, ConnectError } from "@connectrpc/connect";+import dayjs from "dayjs";+import { DownloadIcon, UploadIcon } from "lucide-react";+import { useRef, useState } from "react";+import toast from "react-hot-toast";+import { Button } from "@/components/ui/button";+import { Label } from "@/components/ui/label";+import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";+import useCurrentUser from "@/hooks/useCurrentUser";+import { getErrorMessage } from "@/lib/error";+import { exportMemos, importStagedMemoArchive, type StagedMemoArchive, stageMemoArchive } from "@/lib/memo-archive";+import type { MemoImportIssue, MemoImportReport } from "@/types/proto/api/v1/user_service_pb";+import { ImportMemosRequest_ConflictPolicy } from "@/types/proto/api/v1/user_service_pb";+import { useTranslate } from "@/utils/i18n";+import SettingGroup from "./SettingGroup";+import { SettingList, SettingListItem, StatRow } from "./SettingList";+import SettingSection from "./SettingSection";++const POLICIES = [+ {+ value: ImportMemosRequest_ConflictPolicy.SKIP,+ label: "setting.memo-archive.policy-skip",+ description: "setting.memo-archive.policy-skip-description",+ },+ {+ value: ImportMemosRequest_ConflictPolicy.REPLACE,+ label: "setting.memo-archive.policy-replace",+ description: "setting.memo-archive.policy-replace-description",+ },+ {+ value: ImportMemosRequest_ConflictPolicy.DUPLICATE,+ label: "setting.memo-archive.policy-duplicate",+ description: "setting.memo-archive.policy-duplicate-description",+ },+] as const;++// The import walks through three stages: pick a file, review what the server+// says the archive would do, then read the report. The conflict policy is only+// asked for in the review stage, and only when some memos already exist.+type ImportStage =+ | { kind: "idle" }+ | { kind: "review"; file: File; staged: StagedMemoArchive; policy: ImportMemosRequest_ConflictPolicy }+ | { kind: "done"; report: MemoImportReport };++const IssueList = ({ issues, tone }: { issues: MemoImportIssue[]; tone: "warning" | "failure" }) => {+ if (issues.length === 0) return null;+ return (+ <ul className={`flex flex-col gap-1 text-xs ${tone === "failure" ? "text-destructive" : "text-muted-foreground"}`}>+ {issues.map((issue, index) => (+ <li key={`${tone}-${index}`}>{issue.memo ? `${issue.memo}: ${issue.message}` : issue.message}</li>+ ))}+ </ul>+ );+};++const MemoArchiveSection = () => {+ const t = useTranslate();+ const user = useCurrentUser();+ const fileInputRef = useRef<HTMLInputElement>(null);+ const [exporting, setExporting] = useState(false);+ const [busy, setBusy] = useState(false);+ const [stage, setStage] = useState<ImportStage>({ kind: "idle" });++ const handleExport = async () => {+ if (!user) return;+ setExporting(true);+ try {+ await exportMemos(user.name, user.username);+ toast.success(t("setting.memo-archive.export-success"));+ } catch (error) {+ toast.error(getErrorMessage(error, t("setting.memo-archive.export-failed")));+ } finally {+ setExporting(false);+ }+ };++ const handleFileChosen = async (event: React.ChangeEvent<HTMLInputElement>) => {+ const file = event.target.files?.[0];+ event.target.value = "";+ if (!file || !user) return;+ setBusy(true);+ try {+ const staged = await stageMemoArchive(user.name, file);+ setStage({ kind: "review", file, staged, policy: ImportMemosRequest_ConflictPolicy.SKIP });+ } catch (error) {+ toast.error(getErrorMessage(error, t("setting.memo-archive.import-failed")));+ } finally {+ setBusy(false);+ }+ };++ const handleImport = async () => {+ if (stage.kind !== "review" || !user) return;+ setBusy(true);+ try {+ const report = await importStagedMemoArchive(user.name, stage.staged, stage.policy);+ setStage({ kind: "done", report });+ toast.success(t("setting.memo-archive.import-success", { created: report.created, updated: report.updated }));+ } catch (error) {+ toast.error(getErrorMessage(error, t("setting.memo-archive.import-failed")));+ if (ConnectError.from(error).code === Code.NotFound) {+ // The staged upload expired; start over from the file picker.+ setStage({ kind: "idle" });+ }+ } finally {+ setBusy(false);+ }+ };++ if (!user) return null;++ return (+ <SettingSection title={t("setting.memo-archive.label")} description={t("setting.memo-archive.description")}>+ <SettingGroup title={t("setting.memo-archive.export-title")} description={t("setting.memo-archive.export-description")}>+ <SettingList>+ <SettingListItem label={t("setting.memo-archive.export-label")} description={t("setting.memo-archive.export-detail")}>+ <Button variant="outline" size="sm" disabled={exporting} onClick={handleExport}>+ <DownloadIcon className="w-4 h-4 mr-1.5" />+ {exporting ? t("setting.memo-archive.exporting") : t("setting.memo-archive.export-action")}+ </Button>+ </SettingListItem>+ </SettingList>+ </SettingGroup>++ <SettingGroup showSeparator title={t("setting.memo-archive.import-title")} description={t("setting.memo-archive.import-description")}>+ <input+ ref={fileInputRef}+ type="file"+ accept=".zip,application/zip,application/vnd.usememos.archive+zip"+ className="hidden"+ onChange={handleFileChosen}+ />++ {stage.kind === "idle" && (+ <SettingList>+ <SettingListItem label={t("setting.memo-archive.import-label")} description={t("setting.memo-archive.import-detail")}>+ <Button variant="outline" size="sm" disabled={busy} onClick={() => fileInputRef.current?.click()}>+ <UploadIcon className="w-4 h-4 mr-1.5" />+ {busy ? t("setting.memo-archive.reading") : t("setting.memo-archive.import-action")}+ </Button>+ </SettingListItem>+ </SettingList>+ )}++ {stage.kind === "review" && (+ <div className="flex flex-col gap-3">+ <SettingList>+ <StatRow label={t("setting.memo-archive.review-file")} value={stage.file.name} />+ <StatRow+ label={t("setting.memo-archive.review-exported")}+ value={`${stage.staged.plan.exporter} · ${+ stage.staged.plan.exportTime ? dayjs(timestampDate(stage.staged.plan.exportTime)).format("YYYY-MM-DD HH:mm") : ""+ }`}+ />+ <StatRow label={t("setting.memo-archive.review-memos")} value={String(stage.staged.plan.memos)} />+ <StatRow label={t("setting.memo-archive.review-attachments")} value={String(stage.staged.plan.attachments)} />+ <StatRow label={t("setting.memo-archive.review-new")} value={String(stage.staged.plan.new + stage.staged.plan.renamed)} />+ <StatRow label={t("setting.memo-archive.review-existing")} value={String(stage.staged.plan.existing)} />+ </SettingList>++ {stage.staged.plan.existing > 0 && (+ <div className="flex flex-col gap-2 rounded-lg border border-border p-3">+ <div className="text-sm font-medium">+ {t("setting.memo-archive.policy-question", { count: stage.staged.plan.existing })}+ </div>+ <RadioGroup+ value={String(stage.policy)}+ onValueChange={(value) => setStage({ ...stage, policy: Number(value) as ImportMemosRequest_ConflictPolicy })}+ className="flex flex-col gap-2"+ >+ {POLICIES.map((option) => (+ <div key={option.value} className="flex items-start gap-2">+ <RadioGroupItem value={String(option.value)} id={`memo-archive-policy-${option.value}`} className="mt-0.5" />+ <Label+ htmlFor={`memo-archive-policy-${option.value}`}+ className="flex cursor-pointer flex-col items-start gap-1 font-normal leading-5"+ >+ <span className="text-sm text-foreground">{t(option.label)}</span>+ <span className="text-xs text-muted-foreground">{t(option.description)}</span>+ </Label>+ </div>+ ))}+ </RadioGroup>+ </div>+ )}++ <IssueList issues={stage.staged.plan.warnings} tone="warning" />++ <div className="flex items-center justify-end gap-2">+ <Button variant="ghost" size="sm" disabled={busy} onClick={() => setStage({ kind: "idle" })}>+ {t("common.cancel")}+ </Button>+ <Button size="sm" disabled={busy} onClick={handleImport}>+ {busy ? t("setting.memo-archive.importing") : t("setting.memo-archive.import-confirm", { count: stage.staged.plan.memos })}+ </Button>+ </div>+ </div>+ )}++ {stage.kind === "done" && (+ <div className="flex flex-col gap-3">+ <SettingList>+ <StatRow label={t("setting.memo-archive.report-created")} value={String(stage.report.created)} />+ <StatRow label={t("setting.memo-archive.report-updated")} value={String(stage.report.updated)} />+ <StatRow label={t("setting.memo-archive.report-skipped")} value={String(stage.report.skipped)} />+ <StatRow label={t("setting.memo-archive.report-failed")} value={String(stage.report.failed)} />+ </SettingList>+ <IssueList issues={stage.report.failures} tone="failure" />+ <IssueList issues={stage.report.warnings} tone="warning" />+ <div className="flex items-center justify-end">+ <Button variant="outline" size="sm" onClick={() => setStage({ kind: "idle" })}>+ {t("setting.memo-archive.import-another")}+ </Button>+ </div>+ </div>+ )}+ </SettingGroup>+ </SettingSection>+ );+};++export default MemoArchiveSection;diff --git a/web/src/components/Settings/settingSections.ts b/web/src/components/Settings/settingSections.tsindex 5d639d2fa..6a5f13cfd 100644--- a/web/src/components/Settings/settingSections.ts+++ b/web/src/components/Settings/settingSections.ts@@ -1,4 +1,5 @@import {+ ArchiveIcon,AstroidIcon,BarChart3Icon,CogIcon,@@ -20,6 +21,7 @@ import AccessTokenSection from "@/components/Settings/AccessTokenSection";import AISection from "@/components/Settings/AISection";import InstanceSection from "@/components/Settings/InstanceSection";import MemberSection from "@/components/Settings/MemberSection";+import MemoArchiveSection from "@/components/Settings/MemoArchiveSection";import MemoRelatedSettings from "@/components/Settings/MemoRelatedSettings";import MyAccountSection from "@/components/Settings/MyAccountSection";import NotificationSection from "@/components/Settings/NotificationSection";@@ -34,6 +36,7 @@ import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb";export type SettingSectionKey =| "my-account"+ | "memo-archive"| "spaces"| "access-token"| "preference"@@ -67,6 +70,13 @@ export const SETTINGS_SECTIONS: SettingSectionDefinition[] = [icon: UserIcon,component: MyAccountSection,},+ {+ key: "memo-archive",+ scope: "basic",+ labelKey: "setting.memo-archive.label",+ icon: ArchiveIcon,+ component: MemoArchiveSection,+ },{key: "spaces",scope: "basic",diff --git a/web/src/lib/memo-archive.ts b/web/src/lib/memo-archive.tsnew file mode 100644index 000000000..e8e8f7468--- /dev/null+++ b/web/src/lib/memo-archive.ts@@ -0,0 +1,86 @@+import { create } from "@bufbuild/protobuf";+import { Code, ConnectError } from "@connectrpc/connect";+import { userServiceClient } from "@/connect";+import { downloadFileFromUrl } from "@/lib/browser";+import type { ImportMemosRequest, MemoImportPlan, MemoImportReport } from "@/types/proto/api/v1/user_service_pb";+import { ImportMemosRequest_ConflictPolicy, ImportMemosSpecSchema } from "@/types/proto/api/v1/user_service_pb";++const DEFAULT_CHUNK_SIZE = 2 * 1024 * 1024;++// exportMemos downloads the user's Memo Archive.+export async function exportMemos(userName: string, username: string): Promise<void> {+ const body = await userServiceClient.exportMemos({ name: userName });+ const stamp = new Date().toISOString().replace(/[-:]/g, "").replace(/\.\d+/, "");+ const url = URL.createObjectURL(new Blob([body.data as BlobPart], { type: body.contentType }));+ downloadFileFromUrl(url, `memos-archive-${username}-${stamp}.zip`);+ // Give the browser a tick to start the download before revoking.+ setTimeout(() => URL.revokeObjectURL(url), 1000);+}++export interface StagedMemoArchive {+ uploadId: string;+ size: number;+ plan: MemoImportPlan;+}++async function sendChunk(request: ImportMemosRequest, signal?: AbortSignal) {+ // Retrying the identical last write is safe even if its response was lost.+ for (let attempt = 0; ; attempt++) {+ try {+ return await userServiceClient.importMemos(request, { signal });+ } catch (error) {+ if (signal?.aborted || ConnectError.from(error).code !== Code.Unavailable || attempt >= 2) throw error;+ }+ }+}++// stageMemoArchive uploads the archive in chunks and finishes with+// validate_only, returning the staged upload and the server's plan.+export async function stageMemoArchive(userName: string, file: File, signal?: AbortSignal): Promise<StagedMemoArchive> {+ const spec = create(ImportMemosSpecSchema, { totalSize: BigInt(file.size) });+ const initial = await userServiceClient.importMemos({ name: userName, upload: { case: "spec", value: spec } }, { signal });+ if (!initial.uploadId || initial.committedSize !== 0n || initial.maxChunkSize <= 0) {+ throw new Error("Invalid upload initialization response");+ }+ const chunkSize = Math.min(initial.maxChunkSize, DEFAULT_CHUNK_SIZE);+ for (let offset = 0; ; ) {+ signal?.throwIfAborted();+ const end = Math.min(offset + chunkSize, file.size);+ const response = await sendChunk(+ {+ name: userName,+ upload: { case: "uploadId", value: initial.uploadId },+ writeOffset: BigInt(offset),+ data: new Uint8Array(await file.slice(offset, end).arrayBuffer()),+ finishWrite: end === file.size,+ validateOnly: true,+ } as ImportMemosRequest,+ signal,+ );+ if (response.committedSize !== BigInt(end)) {+ throw new Error("Unexpected upload offset");+ }+ if (end === file.size) {+ if (response.result.case !== "plan") throw new Error("Upload finished without a plan");+ return { uploadId: initial.uploadId, size: file.size, plan: response.result.value };+ }+ offset = end;+ }+}++// importStagedMemoArchive imports a staged archive with the chosen policy.+export async function importStagedMemoArchive(+ userName: string,+ staged: StagedMemoArchive,+ conflictPolicy: ImportMemosRequest_ConflictPolicy,+): Promise<MemoImportReport> {+ const response = await userServiceClient.importMemos({+ name: userName,+ upload: { case: "uploadId", value: staged.uploadId },+ writeOffset: BigInt(staged.size),+ finishWrite: true,+ conflictPolicy,+ });+ if (response.result.case !== "report") throw new Error("Import finished without a report");+ return response.result.value;+}diff --git a/web/src/locales/az.json b/web/src/locales/az.jsonindex 358afaf60..987457290 100644--- a/web/src/locales/az.json+++ b/web/src/locales/az.json@@ -740,6 +740,47 @@"title": "Qeydlə bağlı parametrlər","reactions-required": "Reaksiyalar siyahısı boş ola bilməz"},+ "memo-archive": {+ "description": "Qeydlərinizi və qoşmalarınızı tək bir arxiv faylı ilə Memos nüsxələri arasında köçürün.",+ "export-action": "İxrac et",+ "export-description": "Yaratdığınız bütün qeydləri, şərhlər, arxivlənmiş qeydlər və qoşma faylları daxil olmaqla, Memo Arxivi kimi yükləyin.",+ "export-detail": "Hər qeyd üçün bir Markdown faylı və bir JSON qeydi olan ZIP faylı.",+ "export-failed": "İxrac alınmadı.",+ "export-label": "Arxivi yüklə",+ "export-success": "Arxiviniz yüklənir.",+ "export-title": "İxrac",+ "exporting": "İxrac edilir…",+ "import-action": "Fayl seç",+ "import-another": "Başqa arxiv idxal et",+ "import-confirm": "{{count}} qeydi idxal et",+ "import-description": "Bu və ya başqa Memos nüsxəsindən Memo Arxivini idxal edin. Qeydlər identifikatorlarını saxlayır, buna görə eyni arxivi iki dəfə idxal etmək dublikat yaratmır.",+ "import-detail": "memos-archive-*.zip faylını seçin.",+ "import-failed": "İdxal alınmadı.",+ "import-label": "Arxivi yüklə",+ "import-success": "{{created}} yeni qeyd idxal edildi və {{updated}} qeyd yeniləndi.",+ "import-title": "İdxal",+ "importing": "İdxal edilir…",+ "label": "İxrac və idxal",+ "policy-duplicate": "Surətini yarat",+ "policy-duplicate-description": "Mövcud qeydləri saxla və arxiv versiyalarını yeni qeydlər kimi əlavə et.",+ "policy-question": "Bu qeydlərdən {{count}} ədədi artıq hesabınızda mövcuddur. Onlarla nə edilsin?",+ "policy-replace": "Arxivdəki ilə əvəz et",+ "policy-replace-description": "Onların məzmununu və parametrlərini arxivdəki ilə əvəz et.",+ "policy-skip": "Mənimkini saxla",+ "policy-skip-description": "Mövcud qeydləri olduğu kimi saxla.",+ "reading": "Arxiv oxunur…",+ "report-created": "Yaradıldı",+ "report-failed": "Alınmadı",+ "report-skipped": "Ötürüldü",+ "report-title": "Son idxal",+ "report-updated": "Yeniləndi",+ "review-attachments": "Qoşma faylları",+ "review-existing": "Artıq hesabınızdadır",+ "review-exported": "İxrac edən",+ "review-file": "Fayl",+ "review-memos": "Arxivdəki qeydlər",+ "review-new": "Yaradılacaq"+ },"my-account": {"label": "Hesabım"},diff --git a/web/src/locales/en.json b/web/src/locales/en.jsonindex db90e23dd..512646fe1 100644--- a/web/src/locales/en.json+++ b/web/src/locales/en.json@@ -740,6 +740,47 @@"title": "Memo related settings","reactions-required": "Reactions list must not be empty"},+ "memo-archive": {+ "description": "Move your memos and attachments between Memos instances with a single archive file.",+ "export-action": "Export",+ "export-description": "Download every memo you created, including comments, archived memos, and attachment files, as a Memo Archive.",+ "export-detail": "A ZIP file with one Markdown file and one JSON record per memo.",+ "export-failed": "Export failed.",+ "export-label": "Download archive",+ "export-success": "Your archive is downloading.",+ "export-title": "Export",+ "exporting": "Exporting…",+ "import-action": "Choose file",+ "import-another": "Import another archive",+ "import-confirm": "Import {{count}} memos",+ "import-description": "Import a Memo Archive from this or another Memos instance. Memos keep their identifiers, so importing the same archive twice does not create duplicates.",+ "import-detail": "Select a memos-archive-*.zip file.",+ "import-failed": "Import failed.",+ "import-label": "Upload archive",+ "import-success": "Imported {{created}} new and updated {{updated}} memos.",+ "import-title": "Import",+ "importing": "Importing…",+ "label": "Export & Import",+ "policy-duplicate": "Create a copy",+ "policy-duplicate-description": "Keep the existing memos and add the archive versions as new memos.",+ "policy-question": "{{count}} of these memos already exist in your account. What should happen to them?",+ "policy-replace": "Replace with the archive",+ "policy-replace-description": "Overwrite their content and settings with the archive.",+ "policy-skip": "Keep mine",+ "policy-skip-description": "Leave the existing memos as they are.",+ "reading": "Reading archive…",+ "report-created": "Created",+ "report-failed": "Failed",+ "report-skipped": "Skipped",+ "report-title": "Last import",+ "report-updated": "Updated",+ "review-attachments": "Attachment files",+ "review-existing": "Already in your account",+ "review-exported": "Exported by",+ "review-file": "File",+ "review-memos": "Memos in archive",+ "review-new": "Will be created"+ },"my-account": {"label": "My Account"},diff --git a/web/src/types/proto/api/v1/user_service_pb.ts b/web/src/types/proto/api/v1/user_service_pb.tsindex 20b358490..9ea4fe4a8 100644--- a/web/src/types/proto/api/v1/user_service_pb.ts+++ b/web/src/types/proto/api/v1/user_service_pb.ts@@ -11,6 +11,8 @@ import { file_api_v1_space_service } from "./space_service_pb";import { file_google_api_annotations } from "../../google/api/annotations_pb";import { file_google_api_client } from "../../google/api/client_pb";import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb";+import type { HttpBodySchema } from "../../google/api/httpbody_pb";+import { file_google_api_httpbody } from "../../google/api/httpbody_pb";import { file_google_api_resource } from "../../google/api/resource_pb";import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt";import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";@@ -22,7 +24,7 @@ import type { Message } from "@bufbuild/protobuf";* Describes the file api/v1/user_service.proto.*/export const file_api_v1_user_service: GenFile = /*@__PURE__*/- fileDesc("ChlhcGkvdjEvdXNlcl9zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEi1gMKBFVzZXISEQoEbmFtZRgBIAEoCUID4EEIEioKBHJvbGUYAiABKA4yFy5tZW1vcy5hcGkudjEuVXNlci5Sb2xlQgPgQQISFQoIdXNlcm5hbWUYAyABKAlCA+BBAhISCgVlbWFpbBgEIAEoCUID4EEBEhkKDGRpc3BsYXlfbmFtZRgFIAEoCUID4EEBEhcKCmF2YXRhcl91cmwYBiABKAlCA+BBARIYCgtkZXNjcmlwdGlvbhgHIAEoCUID4EEBEhUKCHBhc3N3b3JkGAggASgJQgPgQQQSJwoFc3RhdGUYCSABKA4yEy5tZW1vcy5hcGkudjEuU3RhdGVCA+BBAhI0CgtjcmVhdGVfdGltZRgKIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI0Cgt1cGRhdGVfdGltZRgLIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAyIxCgRSb2xlEhQKEFJPTEVfVU5TUEVDSUZJRUQQABIJCgVBRE1JThACEggKBFVTRVIQAzo36kE0ChFtZW1vcy5hcGkudjEvVXNlchIMdXNlcnMve3VzZXJ9GgRuYW1lKgV1c2VyczIEdXNlciJzChBMaXN0VXNlcnNSZXF1ZXN0EhYKC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WNhdGlvblJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiNdpBBG5hbWWC0+STAigqJi9hcGkvdjEve25hbWU9dXNlcnMvKi9ub3RpZmljYXRpb25zLyp9QqgBChBjb20ubWVtb3MuYXBpLnYxQhBVc2VyU2VydmljZVByb3RvUAFaMGdpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaS92MTthcGl2MaICA01BWKoCDE1lbW9zLkFwaS5WMcoCDE1lbW9zXEFwaVxWMeICGE1lbW9zXEFwaVxWMVxHUEJNZXRhZGF0YeoCDk1lbW9zOjpBcGk6OlYxYgZwcm90bzM", [file_api_v1_common, file_api_v1_space_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]);+ fileDesc("ChlhcGkvdjEvdXNlcl9zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEi1gMKBFVzZXISEQoEbmFtZRgBIAEoCUID4EEIEioKBHJvbGUYAiABKA4yFy5tZW1vcy5hcGkudjEuVXNlci5Sb2xlQgPgQQISFQoIdXNlcm5hbWUYAyABKAlCA+BBAhISCgVlbWFpbBgEIAEoCUID4EEBEhkKDGRpc3BsYXlfbmFtZRgFIAEoCUID4EEBEhcKCmF2YXRhcl91cmwYBiABKAlCA+BBARIYCgtkZXNjcmlwdGlvbhgHIAEoCUID4EEBEhUKCHBhc3N3b3JkGAggASgJQgPgQQQSJwoFc3RhdGUYCSABKA4yEy5tZW1vcy5hcGkudjEuU3RhdGVCA+BBAhI0CgtjcmVhdGVfdGltZRgKIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI0Cgt1cGRhdGVfdGltZRgLIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAyIxCgRSb2xlEhQKEFJPTEVfVU5TUEVDSUZJRUQQABIJC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QqgBChBjb20ubWVtb3MuYXBpLnYxQhBVc2VyU2VydmljZVByb3RvUAFaMGdpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaS92MTthcGl2MaICA01BWKoCDE1lbW9zLkFwaS5WMcoCDE1lbW9zXEFwaVxWMeICGE1lbW9zXEFwaVxWMVxHUEJNZXRhZGF0YeoCDk1lbW9zOjpBcGk6OlYxYgZwcm90bzM", [file_api_v1_common, file_api_v1_space_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_httpbody, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]);/*** @generated from message memos.api.v1.User@@ -497,6 +499,377 @@ export type UserStats_MemoTypeStats = Message<"memos.api.v1.UserStats.MemoTypeStexport const UserStats_MemoTypeStatsSchema: GenMessage<UserStats_MemoTypeStats> = /*@__PURE__*/messageDesc(file_api_v1_user_service, 9, 0);+/**+ * @generated from message memos.api.v1.ExportMemosRequest+ */+export type ExportMemosRequest = Message<"memos.api.v1.ExportMemosRequest"> & {+ /**+ * Required. The user whose memos are exported. Must be the caller.+ * Format: users/{user}+ *+ * @generated from field: string name = 1;+ */+ name: string;+};++/**+ * Describes the message memos.api.v1.ExportMemosRequest.+ * Use `create(ExportMemosRequestSchema)` to create a new message.+ */+export const ExportMemosRequestSchema: GenMessage<ExportMemosRequest> = /*@__PURE__*/+ messageDesc(file_api_v1_user_service, 10);++/**+ * @generated from message memos.api.v1.ImportMemosRequest+ */+export type ImportMemosRequest = Message<"memos.api.v1.ImportMemosRequest"> & {+ /**+ * Required. The user who receives the memos. Must be the caller.+ * Format: users/{user}+ *+ * @generated from field: string name = 1;+ */+ name: string;++ /**+ * Required. Start a new upload or continue an existing one.+ *+ * @generated from oneof memos.api.v1.ImportMemosRequest.upload+ */+ upload: {+ /**+ * Starts a new upload. The same call may also carry data and finish_write.+ *+ * @generated from field: memos.api.v1.ImportMemosSpec spec = 2;+ */+ value: ImportMemosSpec;+ case: "spec";+ } | {+ /**+ * Continues the upload identified by a previous response.+ *+ * @generated from field: string upload_id = 3;+ */+ value: string;+ case: "uploadId";+ } | { case: undefined; value?: undefined };++ /**+ * Required. Zero-based byte offset at which data is written. Must equal the+ * committed size, except when retrying the most recently accepted chunk+ * with identical bytes and offset, which is accepted without writing again.+ *+ * @generated from field: int64 write_offset = 4;+ */+ writeOffset: bigint;++ /**+ * Optional. Archive bytes, at most max_chunk_size long. With no data and+ * finish_write false, the call reports progress without writing, and+ * write_offset is ignored.+ *+ * @generated from field: bytes data = 5;+ */+ data: Uint8Array;++ /**+ * Optional. Finish the upload after writing data. The committed size must+ * then equal total_size. The archive is validated and, unless+ * validate_only is set, imported. Any later call for an imported upload+ * returns the same report.+ *+ * @generated from field: bool finish_write = 6;+ */+ finishWrite: boolean;++ /**+ * Optional. On a finishing call, validate the archive and return the plan+ * without importing. The upload stays staged so a later finishing call can+ * import it.+ *+ * @generated from field: bool validate_only = 7;+ */+ validateOnly: boolean;++ /**+ * Optional. Read on the finishing call that imports. Unspecified means SKIP.+ *+ * @generated from field: memos.api.v1.ImportMemosRequest.ConflictPolicy conflict_policy = 8;+ */+ conflictPolicy: ImportMemosRequest_ConflictPolicy;+};++/**+ * Describes the message memos.api.v1.ImportMemosRequest.+ * Use `create(ImportMemosRequestSchema)` to create a new message.+ */+export const ImportMemosRequestSchema: GenMessage<ImportMemosRequest> = /*@__PURE__*/+ messageDesc(file_api_v1_user_service, 11);++/**+ * What the importer does with a memo whose UID the user already holds.+ *+ * @generated from enum memos.api.v1.ImportMemosRequest.ConflictPolicy+ */+export enum ImportMemosRequest_ConflictPolicy {+ /**+ * @generated from enum value: CONFLICT_POLICY_UNSPECIFIED = 0;+ */+ CONFLICT_POLICY_UNSPECIFIED = 0,++ /**+ * Leave the existing memo untouched. This is the default.+ *+ * @generated from enum value: SKIP = 1;+ */+ SKIP = 1,++ /**+ * Update the existing memo's content and metadata from the archive.+ *+ * @generated from enum value: REPLACE = 2;+ */+ REPLACE = 2,++ /**+ * Keep the existing memo and create the archive version under a fresh UID.+ *+ * @generated from enum value: DUPLICATE = 3;+ */+ DUPLICATE = 3,+}++/**+ * Describes the enum memos.api.v1.ImportMemosRequest.ConflictPolicy.+ */+export const ImportMemosRequest_ConflictPolicySchema: GenEnum<ImportMemosRequest_ConflictPolicy> = /*@__PURE__*/+ enumDesc(file_api_v1_user_service, 11, 0);++/**+ * @generated from message memos.api.v1.ImportMemosSpec+ */+export type ImportMemosSpec = Message<"memos.api.v1.ImportMemosSpec"> & {+ /**+ * Optional. Total size of the archive in bytes.+ *+ * @generated from field: int64 total_size = 1;+ */+ totalSize: bigint;+};++/**+ * Describes the message memos.api.v1.ImportMemosSpec.+ * Use `create(ImportMemosSpecSchema)` to create a new message.+ */+export const ImportMemosSpecSchema: GenMessage<ImportMemosSpec> = /*@__PURE__*/+ messageDesc(file_api_v1_user_service, 12);++/**+ * @generated from message memos.api.v1.ImportMemosResponse+ */+export type ImportMemosResponse = Message<"memos.api.v1.ImportMemosResponse"> & {+ /**+ * Opaque ID for subsequent calls. This is not a resource name.+ *+ * @generated from field: string upload_id = 1;+ */+ uploadId: string;++ /**+ * Number of archive bytes committed so far.+ *+ * @generated from field: int64 committed_size = 2;+ */+ committedSize: bigint;++ /**+ * Maximum number of data bytes accepted in one call.+ *+ * @generated from field: int32 max_chunk_size = 3;+ */+ maxChunkSize: number;++ /**+ * Set once the upload has been finished.+ *+ * @generated from oneof memos.api.v1.ImportMemosResponse.result+ */+ result: {+ /**+ * What the import would do. Set by a finishing call with validate_only.+ *+ * @generated from field: memos.api.v1.MemoImportPlan plan = 4;+ */+ value: MemoImportPlan;+ case: "plan";+ } | {+ /**+ * What the import did. Set by a finishing call that imported.+ *+ * @generated from field: memos.api.v1.MemoImportReport report = 5;+ */+ value: MemoImportReport;+ case: "report";+ } | { case: undefined; value?: undefined };+};++/**+ * Describes the message memos.api.v1.ImportMemosResponse.+ * Use `create(ImportMemosResponseSchema)` to create a new message.+ */+export const ImportMemosResponseSchema: GenMessage<ImportMemosResponse> = /*@__PURE__*/+ messageDesc(file_api_v1_user_service, 13);++/**+ * MemoImportIssue is one warning or failure of an import, tied to the memo+ * UID from the archive when there is one.+ *+ * @generated from message memos.api.v1.MemoImportIssue+ */+export type MemoImportIssue = Message<"memos.api.v1.MemoImportIssue"> & {+ /**+ * The archive memo UID the issue concerns, if any.+ *+ * @generated from field: string memo = 1;+ */+ memo: string;++ /**+ * @generated from field: string message = 2;+ */+ message: string;+};++/**+ * Describes the message memos.api.v1.MemoImportIssue.+ * Use `create(MemoImportIssueSchema)` to create a new message.+ */+export const MemoImportIssueSchema: GenMessage<MemoImportIssue> = /*@__PURE__*/+ messageDesc(file_api_v1_user_service, 14);++/**+ * MemoImportPlan describes what importing a staged archive would do.+ *+ * @generated from message memos.api.v1.MemoImportPlan+ */+export type MemoImportPlan = Message<"memos.api.v1.MemoImportPlan"> & {+ /**+ * When the archive was written.+ *+ * @generated from field: google.protobuf.Timestamp export_time = 1;+ */+ exportTime?: Timestamp | undefined;++ /**+ * Username of the user who exported the archive.+ *+ * @generated from field: string exporter = 2;+ */+ exporter: string;++ /**+ * The software that wrote the archive.+ *+ * @generated from field: string generator = 3;+ */+ generator: string;++ /**+ * Number of memo records in the archive.+ *+ * @generated from field: int32 memos = 4;+ */+ memos: number;++ /**+ * Number of attachment files in the archive.+ *+ * @generated from field: int32 attachments = 5;+ */+ attachments: number;++ /**+ * Memos whose UID nobody on the instance holds.+ *+ * @generated from field: int32 new = 6;+ */+ new: number;++ /**+ * Memos the user already holds; the conflict policy applies to them.+ *+ * @generated from field: int32 existing = 7;+ */+ existing: number;++ /**+ * Memos whose UID another account holds; they are imported under fresh UIDs.+ *+ * @generated from field: int32 renamed = 8;+ */+ renamed: number;++ /**+ * Deviations the archive reader corrected while validating.+ *+ * @generated from field: repeated memos.api.v1.MemoImportIssue warnings = 9;+ */+ warnings: MemoImportIssue[];+};++/**+ * Describes the message memos.api.v1.MemoImportPlan.+ * Use `create(MemoImportPlanSchema)` to create a new message.+ */+export const MemoImportPlanSchema: GenMessage<MemoImportPlan> = /*@__PURE__*/+ messageDesc(file_api_v1_user_service, 15);++/**+ * MemoImportReport is the outcome of an import.+ *+ * @generated from message memos.api.v1.MemoImportReport+ */+export type MemoImportReport = Message<"memos.api.v1.MemoImportReport"> & {+ /**+ * @generated from field: int32 created = 1;+ */+ created: number;++ /**+ * @generated from field: int32 updated = 2;+ */+ updated: number;++ /**+ * @generated from field: int32 skipped = 3;+ */+ skipped: number;++ /**+ * @generated from field: int32 failed = 4;+ */+ failed: number;++ /**+ * @generated from field: repeated memos.api.v1.MemoImportIssue warnings = 5;+ */+ warnings: MemoImportIssue[];++ /**+ * One entry per failed memo, with the reason.+ *+ * @generated from field: repeated memos.api.v1.MemoImportIssue failures = 6;+ */+ failures: MemoImportIssue[];+};++/**+ * Describes the message memos.api.v1.MemoImportReport.+ * Use `create(MemoImportReportSchema)` to create a new message.+ */+export const MemoImportReportSchema: GenMessage<MemoImportReport> = /*@__PURE__*/+ messageDesc(file_api_v1_user_service, 16);+/*** @generated from message memos.api.v1.GetUserStatsRequest*/@@ -523,7 +896,7 @@ export type GetUserStatsRequest = Message<"memos.api.v1.GetUserStatsRequest"> &* Use `create(GetUserStatsRequestSchema)` to create a new message.*/export const GetUserStatsRequestSchema: GenMessage<GetUserStatsRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 10);+ messageDesc(file_api_v1_user_service, 17);/*** @generated from message memos.api.v1.ListAllUserStatsRequest@@ -550,7 +923,7 @@ export type ListAllUserStatsRequest = Message<"memos.api.v1.ListAllUserStatsRequ* Use `create(ListAllUserStatsRequestSchema)` to create a new message.*/export const ListAllUserStatsRequestSchema: GenMessage<ListAllUserStatsRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 11);+ messageDesc(file_api_v1_user_service, 18);/*** @generated from message memos.api.v1.ListAllUserStatsResponse@@ -569,7 +942,7 @@ export type ListAllUserStatsResponse = Message<"memos.api.v1.ListAllUserStatsRes* Use `create(ListAllUserStatsResponseSchema)` to create a new message.*/export const ListAllUserStatsResponseSchema: GenMessage<ListAllUserStatsResponse> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 12);+ messageDesc(file_api_v1_user_service, 19);/*** User settings message@@ -615,7 +988,7 @@ export type UserSetting = Message<"memos.api.v1.UserSetting"> & {* Use `create(UserSettingSchema)` to create a new message.*/export const UserSettingSchema: GenMessage<UserSetting> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 13);+ messageDesc(file_api_v1_user_service, 20);/*** General user settings configuration.@@ -659,7 +1032,7 @@ export type UserSetting_GeneralSetting = Message<"memos.api.v1.UserSetting.Gener* Use `create(UserSetting_GeneralSettingSchema)` to create a new message.*/export const UserSetting_GeneralSettingSchema: GenMessage<UserSetting_GeneralSetting> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 13, 0);+ messageDesc(file_api_v1_user_service, 20, 0);/*** Tag metadata for user-specific display rules.@@ -688,7 +1061,7 @@ export type UserSetting_TagMetadata = Message<"memos.api.v1.UserSetting.TagMetad* Use `create(UserSetting_TagMetadataSchema)` to create a new message.*/export const UserSetting_TagMetadataSchema: GenMessage<UserSetting_TagMetadata> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 13, 1);+ messageDesc(file_api_v1_user_service, 20, 1);/*** User-specific tag metadata.@@ -710,7 +1083,7 @@ export type UserSetting_TagsSetting = Message<"memos.api.v1.UserSetting.TagsSett* Use `create(UserSetting_TagsSettingSchema)` to create a new message.*/export const UserSetting_TagsSettingSchema: GenMessage<UserSetting_TagsSetting> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 13, 2);+ messageDesc(file_api_v1_user_service, 20, 2);/*** User webhooks configuration.@@ -731,7 +1104,7 @@ export type UserSetting_WebhooksSetting = Message<"memos.api.v1.UserSetting.Webh* Use `create(UserSetting_WebhooksSettingSchema)` to create a new message.*/export const UserSetting_WebhooksSettingSchema: GenMessage<UserSetting_WebhooksSetting> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 13, 3);+ messageDesc(file_api_v1_user_service, 20, 3);/*** Enumeration of user setting keys.@@ -770,7 +1143,7 @@ export enum UserSetting_Key {* Describes the enum memos.api.v1.UserSetting.Key.*/export const UserSetting_KeySchema: GenEnum<UserSetting_Key> = /*@__PURE__*/- enumDesc(file_api_v1_user_service, 13, 0);+ enumDesc(file_api_v1_user_service, 20, 0);/*** @generated from message memos.api.v1.GetUserSettingRequest@@ -790,7 +1163,7 @@ export type GetUserSettingRequest = Message<"memos.api.v1.GetUserSettingRequest"* Use `create(GetUserSettingRequestSchema)` to create a new message.*/export const GetUserSettingRequestSchema: GenMessage<GetUserSettingRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 14);+ messageDesc(file_api_v1_user_service, 21);/*** @generated from message memos.api.v1.UpdateUserSettingRequest@@ -816,7 +1189,7 @@ export type UpdateUserSettingRequest = Message<"memos.api.v1.UpdateUserSettingRe* Use `create(UpdateUserSettingRequestSchema)` to create a new message.*/export const UpdateUserSettingRequestSchema: GenMessage<UpdateUserSettingRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 15);+ messageDesc(file_api_v1_user_service, 22);/*** Request message for ListUserSettings method.@@ -856,7 +1229,7 @@ export type ListUserSettingsRequest = Message<"memos.api.v1.ListUserSettingsRequ* Use `create(ListUserSettingsRequestSchema)` to create a new message.*/export const ListUserSettingsRequestSchema: GenMessage<ListUserSettingsRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 16);+ messageDesc(file_api_v1_user_service, 23);/*** Response message for ListUserSettings method.@@ -885,7 +1258,7 @@ export type ListUserSettingsResponse = Message<"memos.api.v1.ListUserSettingsRes* Use `create(ListUserSettingsResponseSchema)` to create a new message.*/export const ListUserSettingsResponseSchema: GenMessage<ListUserSettingsResponse> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 17);+ messageDesc(file_api_v1_user_service, 24);/*** Saved memo view messages@@ -930,7 +1303,7 @@ export type MemoView = Message<"memos.api.v1.MemoView"> & {* Use `create(MemoViewSchema)` to create a new message.*/export const MemoViewSchema: GenMessage<MemoView> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 18);+ messageDesc(file_api_v1_user_service, 25);/*** @generated from message memos.api.v1.MemoView.Icon@@ -963,7 +1336,7 @@ export type MemoView_Icon = Message<"memos.api.v1.MemoView.Icon"> & {* Use `create(MemoView_IconSchema)` to create a new message.*/export const MemoView_IconSchema: GenMessage<MemoView_Icon> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 18, 0);+ messageDesc(file_api_v1_user_service, 25, 0);/*** @generated from message memos.api.v1.ListMemoViewsRequest@@ -983,7 +1356,7 @@ export type ListMemoViewsRequest = Message<"memos.api.v1.ListMemoViewsRequest">* Use `create(ListMemoViewsRequestSchema)` to create a new message.*/export const ListMemoViewsRequestSchema: GenMessage<ListMemoViewsRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 19);+ messageDesc(file_api_v1_user_service, 26);/*** @generated from message memos.api.v1.ListMemoViewsResponse@@ -1002,7 +1375,7 @@ export type ListMemoViewsResponse = Message<"memos.api.v1.ListMemoViewsResponse"* Use `create(ListMemoViewsResponseSchema)` to create a new message.*/export const ListMemoViewsResponseSchema: GenMessage<ListMemoViewsResponse> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 20);+ messageDesc(file_api_v1_user_service, 27);/*** @generated from message memos.api.v1.GetMemoViewRequest@@ -1022,7 +1395,7 @@ export type GetMemoViewRequest = Message<"memos.api.v1.GetMemoViewRequest"> & {* Use `create(GetMemoViewRequestSchema)` to create a new message.*/export const GetMemoViewRequestSchema: GenMessage<GetMemoViewRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 21);+ messageDesc(file_api_v1_user_service, 28);/*** @generated from message memos.api.v1.CreateMemoViewRequest@@ -1056,7 +1429,7 @@ export type CreateMemoViewRequest = Message<"memos.api.v1.CreateMemoViewRequest"* Use `create(CreateMemoViewRequestSchema)` to create a new message.*/export const CreateMemoViewRequestSchema: GenMessage<CreateMemoViewRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 22);+ messageDesc(file_api_v1_user_service, 29);/*** @generated from message memos.api.v1.UpdateMemoViewRequest@@ -1082,7 +1455,7 @@ export type UpdateMemoViewRequest = Message<"memos.api.v1.UpdateMemoViewRequest"* Use `create(UpdateMemoViewRequestSchema)` to create a new message.*/export const UpdateMemoViewRequestSchema: GenMessage<UpdateMemoViewRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 23);+ messageDesc(file_api_v1_user_service, 30);/*** @generated from message memos.api.v1.DeleteMemoViewRequest@@ -1102,7 +1475,7 @@ export type DeleteMemoViewRequest = Message<"memos.api.v1.DeleteMemoViewRequest"* Use `create(DeleteMemoViewRequestSchema)` to create a new message.*/export const DeleteMemoViewRequestSchema: GenMessage<DeleteMemoViewRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 24);+ messageDesc(file_api_v1_user_service, 31);/*** LinkedIdentity represents an SSO identity linked to a user account.@@ -1139,7 +1512,7 @@ export type LinkedIdentity = Message<"memos.api.v1.LinkedIdentity"> & {* Use `create(LinkedIdentitySchema)` to create a new message.*/export const LinkedIdentitySchema: GenMessage<LinkedIdentity> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 25);+ messageDesc(file_api_v1_user_service, 32);/*** @generated from message memos.api.v1.ListLinkedIdentitiesRequest@@ -1159,7 +1532,7 @@ export type ListLinkedIdentitiesRequest = Message<"memos.api.v1.ListLinkedIdenti* Use `create(ListLinkedIdentitiesRequestSchema)` to create a new message.*/export const ListLinkedIdentitiesRequestSchema: GenMessage<ListLinkedIdentitiesRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 26);+ messageDesc(file_api_v1_user_service, 33);/*** @generated from message memos.api.v1.ListLinkedIdentitiesResponse@@ -1178,7 +1551,7 @@ export type ListLinkedIdentitiesResponse = Message<"memos.api.v1.ListLinkedIdent* Use `create(ListLinkedIdentitiesResponseSchema)` to create a new message.*/export const ListLinkedIdentitiesResponseSchema: GenMessage<ListLinkedIdentitiesResponse> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 27);+ messageDesc(file_api_v1_user_service, 34);/*** @generated from message memos.api.v1.CreateLinkedIdentityRequest@@ -1227,7 +1600,7 @@ export type CreateLinkedIdentityRequest = Message<"memos.api.v1.CreateLinkedIden* Use `create(CreateLinkedIdentityRequestSchema)` to create a new message.*/export const CreateLinkedIdentityRequestSchema: GenMessage<CreateLinkedIdentityRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 28);+ messageDesc(file_api_v1_user_service, 35);/*** @generated from message memos.api.v1.GetLinkedIdentityRequest@@ -1247,7 +1620,7 @@ export type GetLinkedIdentityRequest = Message<"memos.api.v1.GetLinkedIdentityRe* Use `create(GetLinkedIdentityRequestSchema)` to create a new message.*/export const GetLinkedIdentityRequestSchema: GenMessage<GetLinkedIdentityRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 29);+ messageDesc(file_api_v1_user_service, 36);/*** @generated from message memos.api.v1.DeleteLinkedIdentityRequest@@ -1267,7 +1640,7 @@ export type DeleteLinkedIdentityRequest = Message<"memos.api.v1.DeleteLinkedIden* Use `create(DeleteLinkedIdentityRequestSchema)` to create a new message.*/export const DeleteLinkedIdentityRequestSchema: GenMessage<DeleteLinkedIdentityRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 30);+ messageDesc(file_api_v1_user_service, 37);/*** PersonalAccessToken represents a long-lived token for API/script access.@@ -1318,7 +1691,7 @@ export type PersonalAccessToken = Message<"memos.api.v1.PersonalAccessToken"> &* Use `create(PersonalAccessTokenSchema)` to create a new message.*/export const PersonalAccessTokenSchema: GenMessage<PersonalAccessToken> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 31);+ messageDesc(file_api_v1_user_service, 38);/*** @generated from message memos.api.v1.ListPersonalAccessTokensRequest@@ -1352,7 +1725,7 @@ export type ListPersonalAccessTokensRequest = Message<"memos.api.v1.ListPersonal* Use `create(ListPersonalAccessTokensRequestSchema)` to create a new message.*/export const ListPersonalAccessTokensRequestSchema: GenMessage<ListPersonalAccessTokensRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 32);+ messageDesc(file_api_v1_user_service, 39);/*** @generated from message memos.api.v1.ListPersonalAccessTokensResponse@@ -1378,7 +1751,7 @@ export type ListPersonalAccessTokensResponse = Message<"memos.api.v1.ListPersona* Use `create(ListPersonalAccessTokensResponseSchema)` to create a new message.*/export const ListPersonalAccessTokensResponseSchema: GenMessage<ListPersonalAccessTokensResponse> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 33);+ messageDesc(file_api_v1_user_service, 40);/*** @generated from message memos.api.v1.CreatePersonalAccessTokenRequest@@ -1412,7 +1785,7 @@ export type CreatePersonalAccessTokenRequest = Message<"memos.api.v1.CreatePerso* Use `create(CreatePersonalAccessTokenRequestSchema)` to create a new message.*/export const CreatePersonalAccessTokenRequestSchema: GenMessage<CreatePersonalAccessTokenRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 34);+ messageDesc(file_api_v1_user_service, 41);/*** @generated from message memos.api.v1.CreatePersonalAccessTokenResponse@@ -1439,7 +1812,7 @@ export type CreatePersonalAccessTokenResponse = Message<"memos.api.v1.CreatePers* Use `create(CreatePersonalAccessTokenResponseSchema)` to create a new message.*/export const CreatePersonalAccessTokenResponseSchema: GenMessage<CreatePersonalAccessTokenResponse> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 35);+ messageDesc(file_api_v1_user_service, 42);/*** @generated from message memos.api.v1.DeletePersonalAccessTokenRequest@@ -1459,7 +1832,7 @@ export type DeletePersonalAccessTokenRequest = Message<"memos.api.v1.DeletePerso* Use `create(DeletePersonalAccessTokenRequestSchema)` to create a new message.*/export const DeletePersonalAccessTokenRequestSchema: GenMessage<DeletePersonalAccessTokenRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 36);+ messageDesc(file_api_v1_user_service, 43);/*** UserWebhook represents a webhook owned by a user.@@ -1524,7 +1897,7 @@ export type UserWebhook = Message<"memos.api.v1.UserWebhook"> & {* Use `create(UserWebhookSchema)` to create a new message.*/export const UserWebhookSchema: GenMessage<UserWebhook> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 37);+ messageDesc(file_api_v1_user_service, 44);/*** @generated from message memos.api.v1.ListUserWebhooksRequest@@ -1544,7 +1917,7 @@ export type ListUserWebhooksRequest = Message<"memos.api.v1.ListUserWebhooksRequ* Use `create(ListUserWebhooksRequestSchema)` to create a new message.*/export const ListUserWebhooksRequestSchema: GenMessage<ListUserWebhooksRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 38);+ messageDesc(file_api_v1_user_service, 45);/*** @generated from message memos.api.v1.ListUserWebhooksResponse@@ -1563,7 +1936,7 @@ export type ListUserWebhooksResponse = Message<"memos.api.v1.ListUserWebhooksRes* Use `create(ListUserWebhooksResponseSchema)` to create a new message.*/export const ListUserWebhooksResponseSchema: GenMessage<ListUserWebhooksResponse> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 39);+ messageDesc(file_api_v1_user_service, 46);/*** @generated from message memos.api.v1.CreateUserWebhookRequest@@ -1590,7 +1963,7 @@ export type CreateUserWebhookRequest = Message<"memos.api.v1.CreateUserWebhookRe* Use `create(CreateUserWebhookRequestSchema)` to create a new message.*/export const CreateUserWebhookRequestSchema: GenMessage<CreateUserWebhookRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 40);+ messageDesc(file_api_v1_user_service, 47);/*** @generated from message memos.api.v1.UpdateUserWebhookRequest@@ -1616,7 +1989,7 @@ export type UpdateUserWebhookRequest = Message<"memos.api.v1.UpdateUserWebhookRe* Use `create(UpdateUserWebhookRequestSchema)` to create a new message.*/export const UpdateUserWebhookRequestSchema: GenMessage<UpdateUserWebhookRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 41);+ messageDesc(file_api_v1_user_service, 48);/*** @generated from message memos.api.v1.DeleteUserWebhookRequest@@ -1636,7 +2009,7 @@ export type DeleteUserWebhookRequest = Message<"memos.api.v1.DeleteUserWebhookRe* Use `create(DeleteUserWebhookRequestSchema)` to create a new message.*/export const DeleteUserWebhookRequestSchema: GenMessage<DeleteUserWebhookRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 42);+ messageDesc(file_api_v1_user_service, 49);/*** @generated from message memos.api.v1.GetUserWebhookSigningSecretRequest@@ -1656,7 +2029,7 @@ export type GetUserWebhookSigningSecretRequest = Message<"memos.api.v1.GetUserWe* Use `create(GetUserWebhookSigningSecretRequestSchema)` to create a new message.*/export const GetUserWebhookSigningSecretRequestSchema: GenMessage<GetUserWebhookSigningSecretRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 43);+ messageDesc(file_api_v1_user_service, 50);/*** @generated from message memos.api.v1.GetUserWebhookSigningSecretResponse@@ -1675,7 +2048,7 @@ export type GetUserWebhookSigningSecretResponse = Message<"memos.api.v1.GetUserW* Use `create(GetUserWebhookSigningSecretResponseSchema)` to create a new message.*/export const GetUserWebhookSigningSecretResponseSchema: GenMessage<GetUserWebhookSigningSecretResponse> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 44);+ messageDesc(file_api_v1_user_service, 51);/*** @generated from message memos.api.v1.UserNotification@@ -1754,7 +2127,7 @@ export type UserNotification = Message<"memos.api.v1.UserNotification"> & {* Use `create(UserNotificationSchema)` to create a new message.*/export const UserNotificationSchema: GenMessage<UserNotification> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 45);+ messageDesc(file_api_v1_user_service, 52);/*** @generated from message memos.api.v1.UserNotification.MemoCommentPayload@@ -1796,7 +2169,7 @@ export type UserNotification_MemoCommentPayload = Message<"memos.api.v1.UserNoti* Use `create(UserNotification_MemoCommentPayloadSchema)` to create a new message.*/export const UserNotification_MemoCommentPayloadSchema: GenMessage<UserNotification_MemoCommentPayload> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 45, 0);+ messageDesc(file_api_v1_user_service, 52, 0);/*** @generated from message memos.api.v1.UserNotification.MemoMentionPayload@@ -1838,7 +2211,7 @@ export type UserNotification_MemoMentionPayload = Message<"memos.api.v1.UserNoti* Use `create(UserNotification_MemoMentionPayloadSchema)` to create a new message.*/export const UserNotification_MemoMentionPayloadSchema: GenMessage<UserNotification_MemoMentionPayload> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 45, 1);+ messageDesc(file_api_v1_user_service, 52, 1);/*** @generated from message memos.api.v1.UserNotification.SpaceInvitationPayload@@ -1879,7 +2252,7 @@ export type UserNotification_SpaceInvitationPayload = Message<"memos.api.v1.User* Use `create(UserNotification_SpaceInvitationPayloadSchema)` to create a new message.*/export const UserNotification_SpaceInvitationPayloadSchema: GenMessage<UserNotification_SpaceInvitationPayload> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 45, 2);+ messageDesc(file_api_v1_user_service, 52, 2);/*** @generated from enum memos.api.v1.UserNotification.SpaceInvitationPayload.State@@ -1909,7 +2282,7 @@ export enum UserNotification_SpaceInvitationPayload_State {* Describes the enum memos.api.v1.UserNotification.SpaceInvitationPayload.State.*/export const UserNotification_SpaceInvitationPayload_StateSchema: GenEnum<UserNotification_SpaceInvitationPayload_State> = /*@__PURE__*/- enumDesc(file_api_v1_user_service, 45, 2, 0);+ enumDesc(file_api_v1_user_service, 52, 2, 0);/*** @generated from enum memos.api.v1.UserNotification.Status@@ -1935,7 +2308,7 @@ export enum UserNotification_Status {* Describes the enum memos.api.v1.UserNotification.Status.*/export const UserNotification_StatusSchema: GenEnum<UserNotification_Status> = /*@__PURE__*/- enumDesc(file_api_v1_user_service, 45, 0);+ enumDesc(file_api_v1_user_service, 52, 0);/*** @generated from enum memos.api.v1.UserNotification.Type@@ -1966,7 +2339,7 @@ export enum UserNotification_Type {* Describes the enum memos.api.v1.UserNotification.Type.*/export const UserNotification_TypeSchema: GenEnum<UserNotification_Type> = /*@__PURE__*/- enumDesc(file_api_v1_user_service, 45, 1);+ enumDesc(file_api_v1_user_service, 52, 1);/*** @generated from message memos.api.v1.ListUserNotificationsRequest@@ -2001,7 +2374,7 @@ export type ListUserNotificationsRequest = Message<"memos.api.v1.ListUserNotific* Use `create(ListUserNotificationsRequestSchema)` to create a new message.*/export const ListUserNotificationsRequestSchema: GenMessage<ListUserNotificationsRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 46);+ messageDesc(file_api_v1_user_service, 53);/*** @generated from message memos.api.v1.ListUserNotificationsResponse@@ -2023,7 +2396,7 @@ export type ListUserNotificationsResponse = Message<"memos.api.v1.ListUserNotifi* Use `create(ListUserNotificationsResponseSchema)` to create a new message.*/export const ListUserNotificationsResponseSchema: GenMessage<ListUserNotificationsResponse> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 47);+ messageDesc(file_api_v1_user_service, 54);/*** @generated from message memos.api.v1.UpdateUserNotificationRequest@@ -2045,7 +2418,7 @@ export type UpdateUserNotificationRequest = Message<"memos.api.v1.UpdateUserNoti* Use `create(UpdateUserNotificationRequestSchema)` to create a new message.*/export const UpdateUserNotificationRequestSchema: GenMessage<UpdateUserNotificationRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 48);+ messageDesc(file_api_v1_user_service, 55);/*** @generated from message memos.api.v1.DeleteUserNotificationRequest@@ -2064,7 +2437,7 @@ export type DeleteUserNotificationRequest = Message<"memos.api.v1.DeleteUserNoti* Use `create(DeleteUserNotificationRequestSchema)` to create a new message.*/export const DeleteUserNotificationRequestSchema: GenMessage<DeleteUserNotificationRequest> = /*@__PURE__*/- messageDesc(file_api_v1_user_service, 49);+ messageDesc(file_api_v1_user_service, 56);/*** @generated from service memos.api.v1.UserService@@ -2151,6 +2524,35 @@ export const UserService: GenService<{input: typeof GetUserStatsRequestSchema;output: typeof UserStatsSchema;},+ /**+ * ExportMemos writes every memo the user created, with comments, archived+ * memos, and attachment files, as a Memo Archive (a ZIP file, see+ * docs/design/memo-archive-format.md). Only the user may export their own+ * memos. The body is the archive; content_type is its media type.+ *+ * @generated from rpc memos.api.v1.UserService.ExportMemos+ */+ exportMemos: {+ methodKind: "unary";+ input: typeof ExportMemosRequestSchema;+ output: typeof HttpBodySchema;+ },+ /**+ * ImportMemos uploads a Memo Archive in bounded chunks and imports it into+ * the user's memos. The first call carries the spec and returns an+ * upload_id; later calls carry that upload_id. A finishing call with+ * validate_only returns the plan and keeps the archive staged; a finishing+ * call without it imports and returns the report. Uploads are bound to the+ * authenticated user, expire after 30 minutes of inactivity, and do not+ * survive a server restart.+ *+ * @generated from rpc memos.api.v1.UserService.ImportMemos+ */+ importMemos: {+ methodKind: "unary";+ input: typeof ImportMemosRequestSchema;+ output: typeof ImportMemosResponseSchema;+ },/*** GetUserSetting returns the user setting.*diff --git a/web/src/types/proto/google/api/httpbody_pb.ts b/web/src/types/proto/google/api/httpbody_pb.tsnew file mode 100644index 000000000..c87fe386a--- /dev/null+++ b/web/src/types/proto/google/api/httpbody_pb.ts@@ -0,0 +1,108 @@+// Copyright 2025 Google LLC+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++// @generated by protoc-gen-es v2.12.1 with parameter "target=ts"+// @generated from file google/api/httpbody.proto (package google.api, syntax proto3)+/* eslint-disable */++import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";+import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";+import type { Any } from "@bufbuild/protobuf/wkt";+import { file_google_protobuf_any } from "@bufbuild/protobuf/wkt";+import type { Message } from "@bufbuild/protobuf";++/**+ * Describes the file google/api/httpbody.proto.+ */+export const file_google_api_httpbody: GenFile = /*@__PURE__*/+ fileDesc("Chlnb29nbGUvYXBpL2h0dHBib2R5LnByb3RvEgpnb29nbGUuYXBpIlgKCEh0dHBCb2R5EhQKDGNvbnRlbnRfdHlwZRgBIAEoCRIMCgRkYXRhGAIgASgMEigKCmV4dGVuc2lvbnMYAyADKAsyFC5nb29nbGUucHJvdG9idWYuQW55QqUBCg5jb20uZ29vZ2xlLmFwaUINSHR0cGJvZHlQcm90b1ABWjtnb29nbGUuZ29sYW5nLm9yZy9nZW5wcm90by9nb29nbGVhcGlzL2FwaS9odHRwYm9keTtodHRwYm9keaICA0dBWKoCCkdvb2dsZS5BcGnKAgpHb29nbGVcQXBp4gIWR29vZ2xlXEFwaVxHUEJNZXRhZGF0YeoCC0dvb2dsZTo6QXBpYgZwcm90bzM", [file_google_protobuf_any]);++/**+ * Message that represents an arbitrary HTTP body. It should only be used for+ * payload formats that can't be represented as JSON, such as raw binary or+ * an HTML page.+ *+ *+ * This message can be used both in streaming and non-streaming API methods in+ * the request as well as the response.+ *+ * It can be used as a top-level request field, which is convenient if one+ * wants to extract parameters from either the URL or HTTP template into the+ * request fields and also want access to the raw HTTP body.+ *+ * Example:+ *+ * message GetResourceRequest {+ * // A unique request id.+ * string request_id = 1;+ *+ * // The raw HTTP body is bound to this field.+ * google.api.HttpBody http_body = 2;+ *+ * }+ *+ * service ResourceService {+ * rpc GetResource(GetResourceRequest)+ * returns (google.api.HttpBody);+ * rpc UpdateResource(google.api.HttpBody)+ * returns (google.protobuf.Empty);+ *+ * }+ *+ * Example with streaming methods:+ *+ * service CaldavService {+ * rpc GetCalendar(stream google.api.HttpBody)+ * returns (stream google.api.HttpBody);+ * rpc UpdateCalendar(stream google.api.HttpBody)+ * returns (stream google.api.HttpBody);+ *+ * }+ *+ * Use of this type only changes how the request and response bodies are+ * handled, all other features will continue to work unchanged.+ *+ * @generated from message google.api.HttpBody+ */+export type HttpBody = Message<"google.api.HttpBody"> & {+ /**+ * The HTTP Content-Type header value specifying the content type of the body.+ *+ * @generated from field: string content_type = 1;+ */+ contentType: string;++ /**+ * The HTTP request/response body as raw binary.+ *+ * @generated from field: bytes data = 2;+ */+ data: Uint8Array;++ /**+ * Application specific response metadata. Must be set in the first response+ * for streaming APIs.+ *+ * @generated from field: repeated google.protobuf.Any extensions = 3;+ */+ extensions: Any[];+};++/**+ * Describes the message google.api.HttpBody.+ * Use `create(HttpBodySchema)` to create a new message.+ */+export const HttpBodySchema: GenMessage<HttpBody> = /*@__PURE__*/+ messageDesc(file_google_api_httpbody, 0);+