Skip to content

armgit / memos

Public Imported from GitHub
0

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.

chore: generate ts definition (#2156)

boojack19e7731abb4b
diff --git a/cmd/memos.go b/cmd/memos.go
index 06a6c919d..edcbd9740 100644
--- a/cmd/memos.go
+++ b/cmd/memos.go
@@ -10,11 +10,12 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
-
+ "github.com/usememos/memos/common/log"
"github.com/usememos/memos/server"
_profile "github.com/usememos/memos/server/profile"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store/db"
+ "go.uber.org/zap"
)
const (
@@ -42,7 +43,7 @@ var (
db := db.NewDB(profile)
if err := db.Open(ctx); err != nil {
cancel()
- fmt.Printf("failed to open db, error: %+v\n", err)
+ log.Error("failed to open db", zap.Error(err))
return
}
@@ -50,7 +51,7 @@ var (
s, err := server.NewServer(ctx, profile, store)
if err != nil {
cancel()
- fmt.Printf("failed to create server, error: %+v\n", err)
+ log.Error("failed to create server", zap.Error(err))
return
}
@@ -61,16 +62,16 @@ var (
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
sig := <-c
- fmt.Printf("%s received.\n", sig.String())
+ log.Info(fmt.Sprintf("%s received.\n", sig.String()))
s.Shutdown(ctx)
cancel()
}()
- println(greetingBanner)
- fmt.Printf("Version %s has started at :%d\n", profile.Version, profile.Port)
+ printGreetings()
+
if err := s.Start(ctx); err != nil {
if err != http.ErrServerClosed {
- fmt.Printf("failed to start server, error: %+v\n", err)
+ log.Error("failed to start server", zap.Error(err))
cancel()
}
}
@@ -82,6 +83,7 @@ var (
)
func Execute() error {
+ defer log.Sync()
return rootCmd.Execute()
}
@@ -127,3 +129,13 @@ func initConfig() {
println("version:", profile.Version)
println("---")
}
+
+func printGreetings() {
+ fmt.Print(greetingBanner)
+ fmt.Printf("Version %s has been started on port %d\n", profile.Version, profile.Port)
+ fmt.Println("---")
+ fmt.Println("See more in:")
+ fmt.Printf("👉Website: %s\n", "https://usememos.com")
+ fmt.Printf("👉GitHub: %s\n", "https://github.com/usememos/memos")
+ fmt.Println("---")
+}
diff --git a/common/log/logger.go b/common/log/logger.go
index 26762a5df..c83952141 100644
--- a/common/log/logger.go
+++ b/common/log/logger.go
@@ -1,4 +1,3 @@
-// Package log implements a simple logging package.
package log
import (
diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml
index 55c806234..776a3bd85 100644
--- a/proto/buf.gen.yaml
+++ b/proto/buf.gen.yaml
@@ -18,6 +18,9 @@ plugins:
out: gen
opt:
- paths=source_relative
+ # Build the TypeScript definitions for the web.
+ - plugin: buf.build/bufbuild/es:v1.3.0
+ out: ../web/src/types/proto
- plugin: buf.build/community/pseudomuto-doc:v1.5.1
out: gen
opt:
diff --git a/server/backup.go b/server/backup.go
index 25780a6fc..6eaded62b 100644
--- a/server/backup.go
+++ b/server/backup.go
@@ -25,7 +25,7 @@ func NewBackupRunner(store *store.Store) *BackupRunner {
func (r *BackupRunner) Run(ctx context.Context) {
intervalStr := r.Store.GetSystemSettingValueWithDefault(&ctx, apiv1.SystemSettingAutoBackupIntervalName.String(), "")
if intervalStr == "" {
- log.Info("no SystemSettingAutoBackupIntervalName setting, disable auto backup")
+ log.Debug("no SystemSettingAutoBackupIntervalName setting, disable auto backup")
return
}
diff --git a/web/src/types/proto/api/v2/common_pb.d.ts b/web/src/types/proto/api/v2/common_pb.d.ts
new file mode 100644
index 000000000..4d8214e59
--- /dev/null
+++ b/web/src/types/proto/api/v2/common_pb.d.ts
@@ -0,0 +1,25 @@
+// @generated by protoc-gen-es v1.3.0
+// @generated from file api/v2/common.proto (package memos.api.v2, syntax proto3)
+/* eslint-disable */
+// @ts-nocheck
+
+/**
+ * @generated from enum memos.api.v2.RowStatus
+ */
+export declare enum RowStatus {
+ /**
+ * @generated from enum value: ROW_STATUS_UNSPECIFIED = 0;
+ */
+ ROW_STATUS_UNSPECIFIED = 0,
+
+ /**
+ * @generated from enum value: ACTIVE = 1;
+ */
+ ACTIVE = 1,
+
+ /**
+ * @generated from enum value: ARCHIVED = 2;
+ */
+ ARCHIVED = 2,
+}
+
diff --git a/web/src/types/proto/api/v2/common_pb.js b/web/src/types/proto/api/v2/common_pb.js
new file mode 100644
index 000000000..b4cb85a8f
--- /dev/null
+++ b/web/src/types/proto/api/v2/common_pb.js
@@ -0,0 +1,19 @@
+// @generated by protoc-gen-es v1.3.0
+// @generated from file api/v2/common.proto (package memos.api.v2, syntax proto3)
+/* eslint-disable */
+// @ts-nocheck
+
+import { proto3 } from "@bufbuild/protobuf";
+
+/**
+ * @generated from enum memos.api.v2.RowStatus
+ */
+export const RowStatus = proto3.makeEnum(
+ "memos.api.v2.RowStatus",
+ [
+ {no: 0, name: "ROW_STATUS_UNSPECIFIED"},
+ {no: 1, name: "ACTIVE"},
+ {no: 2, name: "ARCHIVED"},
+ ],
+);
+
diff --git a/web/src/types/proto/api/v2/memo_service_pb.d.ts b/web/src/types/proto/api/v2/memo_service_pb.d.ts
new file mode 100644
index 000000000..45b935b35
--- /dev/null
+++ b/web/src/types/proto/api/v2/memo_service_pb.d.ts
@@ -0,0 +1,206 @@
+// @generated by protoc-gen-es v1.3.0
+// @generated from file api/v2/memo_service.proto (package memos.api.v2, syntax proto3)
+/* eslint-disable */
+// @ts-nocheck
+
+import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
+import { Message, proto3 } from "@bufbuild/protobuf";
+import type { RowStatus } from "./common_pb.js";
+
+/**
+ * @generated from enum memos.api.v2.Visibility
+ */
+export declare enum Visibility {
+ /**
+ * @generated from enum value: VISIBILITY_UNSPECIFIED = 0;
+ */
+ VISIBILITY_UNSPECIFIED = 0,
+
+ /**
+ * @generated from enum value: PRIVATE = 1;
+ */
+ PRIVATE = 1,
+
+ /**
+ * @generated from enum value: PROTECTED = 2;
+ */
+ PROTECTED = 2,
+
+ /**
+ * @generated from enum value: PUBLIC = 3;
+ */
+ PUBLIC = 3,
+}
+
+/**
+ * @generated from message memos.api.v2.Memo
+ */
+export declare class Memo extends Message<Memo> {
+ /**
+ * @generated from field: int32 id = 1;
+ */
+ id: number;
+
+ /**
+ * @generated from field: memos.api.v2.RowStatus row_status = 2;
+ */
+ rowStatus: RowStatus;
+
+ /**
+ * @generated from field: int32 creator_id = 3;
+ */
+ creatorId: number;
+
+ /**
+ * @generated from field: int64 created_ts = 4;
+ */
+ createdTs: bigint;
+
+ /**
+ * @generated from field: int64 updated_ts = 5;
+ */
+ updatedTs: bigint;
+
+ /**
+ * @generated from field: string content = 6;
+ */
+ content: string;
+
+ /**
+ * @generated from field: memos.api.v2.Visibility visibility = 7;
+ */
+ visibility: Visibility;
+
+ /**
+ * @generated from field: bool pinned = 8;
+ */
+ pinned: boolean;
+
+ constructor(data?: PartialMessage<Memo>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.Memo";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Memo;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Memo;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Memo;
+
+ static equals(a: Memo | PlainMessage<Memo> | undefined, b: Memo | PlainMessage<Memo> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.ListMemosRequest
+ */
+export declare class ListMemosRequest extends Message<ListMemosRequest> {
+ /**
+ * @generated from field: int32 page = 1;
+ */
+ page: number;
+
+ /**
+ * @generated from field: int32 page_size = 2;
+ */
+ pageSize: number;
+
+ /**
+ * Filter is used to filter memos returned in the list.
+ *
+ * @generated from field: string filter = 3;
+ */
+ filter: string;
+
+ constructor(data?: PartialMessage<ListMemosRequest>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.ListMemosRequest";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListMemosRequest;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListMemosRequest;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListMemosRequest;
+
+ static equals(a: ListMemosRequest | PlainMessage<ListMemosRequest> | undefined, b: ListMemosRequest | PlainMessage<ListMemosRequest> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.ListMemosResponse
+ */
+export declare class ListMemosResponse extends Message<ListMemosResponse> {
+ /**
+ * @generated from field: repeated memos.api.v2.Memo memos = 1;
+ */
+ memos: Memo[];
+
+ /**
+ * @generated from field: int32 total = 2;
+ */
+ total: number;
+
+ constructor(data?: PartialMessage<ListMemosResponse>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.ListMemosResponse";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListMemosResponse;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListMemosResponse;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListMemosResponse;
+
+ static equals(a: ListMemosResponse | PlainMessage<ListMemosResponse> | undefined, b: ListMemosResponse | PlainMessage<ListMemosResponse> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.GetMemoRequest
+ */
+export declare class GetMemoRequest extends Message<GetMemoRequest> {
+ /**
+ * @generated from field: int32 id = 1;
+ */
+ id: number;
+
+ constructor(data?: PartialMessage<GetMemoRequest>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.GetMemoRequest";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetMemoRequest;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetMemoRequest;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetMemoRequest;
+
+ static equals(a: GetMemoRequest | PlainMessage<GetMemoRequest> | undefined, b: GetMemoRequest | PlainMessage<GetMemoRequest> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.GetMemoResponse
+ */
+export declare class GetMemoResponse extends Message<GetMemoResponse> {
+ /**
+ * @generated from field: memos.api.v2.Memo memo = 1;
+ */
+ memo?: Memo;
+
+ constructor(data?: PartialMessage<GetMemoResponse>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.GetMemoResponse";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetMemoResponse;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetMemoResponse;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetMemoResponse;
+
+ static equals(a: GetMemoResponse | PlainMessage<GetMemoResponse> | undefined, b: GetMemoResponse | PlainMessage<GetMemoResponse> | undefined): boolean;
+}
+
diff --git a/web/src/types/proto/api/v2/memo_service_pb.js b/web/src/types/proto/api/v2/memo_service_pb.js
new file mode 100644
index 000000000..c77c4cf47
--- /dev/null
+++ b/web/src/types/proto/api/v2/memo_service_pb.js
@@ -0,0 +1,81 @@
+// @generated by protoc-gen-es v1.3.0
+// @generated from file api/v2/memo_service.proto (package memos.api.v2, syntax proto3)
+/* eslint-disable */
+// @ts-nocheck
+
+import { proto3 } from "@bufbuild/protobuf";
+import { RowStatus } from "./common_pb.js";
+
+/**
+ * @generated from enum memos.api.v2.Visibility
+ */
+export const Visibility = proto3.makeEnum(
+ "memos.api.v2.Visibility",
+ [
+ {no: 0, name: "VISIBILITY_UNSPECIFIED"},
+ {no: 1, name: "PRIVATE"},
+ {no: 2, name: "PROTECTED"},
+ {no: 3, name: "PUBLIC"},
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.Memo
+ */
+export const Memo = proto3.makeMessageType(
+ "memos.api.v2.Memo",
+ () => [
+ { no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
+ { no: 2, name: "row_status", kind: "enum", T: proto3.getEnumType(RowStatus) },
+ { no: 3, name: "creator_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
+ { no: 4, name: "created_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
+ { no: 5, name: "updated_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
+ { no: 6, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ { no: 7, name: "visibility", kind: "enum", T: proto3.getEnumType(Visibility) },
+ { no: 8, name: "pinned", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.ListMemosRequest
+ */
+export const ListMemosRequest = proto3.makeMessageType(
+ "memos.api.v2.ListMemosRequest",
+ () => [
+ { no: 1, name: "page", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
+ { no: 2, name: "page_size", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
+ { no: 3, name: "filter", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.ListMemosResponse
+ */
+export const ListMemosResponse = proto3.makeMessageType(
+ "memos.api.v2.ListMemosResponse",
+ () => [
+ { no: 1, name: "memos", kind: "message", T: Memo, repeated: true },
+ { no: 2, name: "total", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.GetMemoRequest
+ */
+export const GetMemoRequest = proto3.makeMessageType(
+ "memos.api.v2.GetMemoRequest",
+ () => [
+ { no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.GetMemoResponse
+ */
+export const GetMemoResponse = proto3.makeMessageType(
+ "memos.api.v2.GetMemoResponse",
+ () => [
+ { no: 1, name: "memo", kind: "message", T: Memo },
+ ],
+);
+
diff --git a/web/src/types/proto/api/v2/system_service_pb.d.ts b/web/src/types/proto/api/v2/system_service_pb.d.ts
new file mode 100644
index 000000000..1f10cb55d
--- /dev/null
+++ b/web/src/types/proto/api/v2/system_service_pb.d.ts
@@ -0,0 +1,105 @@
+// @generated by protoc-gen-es v1.3.0
+// @generated from file api/v2/system_service.proto (package memos.api.v2, syntax proto3)
+/* eslint-disable */
+// @ts-nocheck
+
+import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
+import { Message, proto3 } from "@bufbuild/protobuf";
+
+/**
+ * @generated from message memos.api.v2.SystemInfo
+ */
+export declare class SystemInfo extends Message<SystemInfo> {
+ /**
+ * @generated from field: string version = 1;
+ */
+ version: string;
+
+ /**
+ * @generated from field: string mode = 2;
+ */
+ mode: string;
+
+ /**
+ * @generated from field: bool allow_registration = 3;
+ */
+ allowRegistration: boolean;
+
+ /**
+ * @generated from field: bool disable_password_login = 4;
+ */
+ disablePasswordLogin: boolean;
+
+ /**
+ * @generated from field: string additional_script = 5;
+ */
+ additionalScript: string;
+
+ /**
+ * @generated from field: string additional_style = 6;
+ */
+ additionalStyle: string;
+
+ /**
+ * @generated from field: int64 db_size = 7;
+ */
+ dbSize: bigint;
+
+ constructor(data?: PartialMessage<SystemInfo>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.SystemInfo";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SystemInfo;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SystemInfo;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SystemInfo;
+
+ static equals(a: SystemInfo | PlainMessage<SystemInfo> | undefined, b: SystemInfo | PlainMessage<SystemInfo> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.GetSystemInfoRequest
+ */
+export declare class GetSystemInfoRequest extends Message<GetSystemInfoRequest> {
+ constructor(data?: PartialMessage<GetSystemInfoRequest>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.GetSystemInfoRequest";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetSystemInfoRequest;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetSystemInfoRequest;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetSystemInfoRequest;
+
+ static equals(a: GetSystemInfoRequest | PlainMessage<GetSystemInfoRequest> | undefined, b: GetSystemInfoRequest | PlainMessage<GetSystemInfoRequest> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.GetSystemInfoResponse
+ */
+export declare class GetSystemInfoResponse extends Message<GetSystemInfoResponse> {
+ /**
+ * @generated from field: memos.api.v2.SystemInfo system_info = 1;
+ */
+ systemInfo?: SystemInfo;
+
+ constructor(data?: PartialMessage<GetSystemInfoResponse>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.GetSystemInfoResponse";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetSystemInfoResponse;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetSystemInfoResponse;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetSystemInfoResponse;
+
+ static equals(a: GetSystemInfoResponse | PlainMessage<GetSystemInfoResponse> | undefined, b: GetSystemInfoResponse | PlainMessage<GetSystemInfoResponse> | undefined): boolean;
+}
+
diff --git a/web/src/types/proto/api/v2/system_service_pb.js b/web/src/types/proto/api/v2/system_service_pb.js
new file mode 100644
index 000000000..6c8fd74e0
--- /dev/null
+++ b/web/src/types/proto/api/v2/system_service_pb.js
@@ -0,0 +1,41 @@
+// @generated by protoc-gen-es v1.3.0
+// @generated from file api/v2/system_service.proto (package memos.api.v2, syntax proto3)
+/* eslint-disable */
+// @ts-nocheck
+
+import { proto3 } from "@bufbuild/protobuf";
+
+/**
+ * @generated from message memos.api.v2.SystemInfo
+ */
+export const SystemInfo = proto3.makeMessageType(
+ "memos.api.v2.SystemInfo",
+ () => [
+ { no: 1, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ { no: 2, name: "mode", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ { no: 3, name: "allow_registration", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
+ { no: 4, name: "disable_password_login", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
+ { no: 5, name: "additional_script", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ { no: 6, name: "additional_style", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ { no: 7, name: "db_size", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.GetSystemInfoRequest
+ */
+export const GetSystemInfoRequest = proto3.makeMessageType(
+ "memos.api.v2.GetSystemInfoRequest",
+ [],
+);
+
+/**
+ * @generated from message memos.api.v2.GetSystemInfoResponse
+ */
+export const GetSystemInfoResponse = proto3.makeMessageType(
+ "memos.api.v2.GetSystemInfoResponse",
+ () => [
+ { no: 1, name: "system_info", kind: "message", T: SystemInfo },
+ ],
+);
+
diff --git a/web/src/types/proto/api/v2/tag_service_pb.d.ts b/web/src/types/proto/api/v2/tag_service_pb.d.ts
new file mode 100644
index 000000000..fb8aa26ac
--- /dev/null
+++ b/web/src/types/proto/api/v2/tag_service_pb.d.ts
@@ -0,0 +1,85 @@
+// @generated by protoc-gen-es v1.3.0
+// @generated from file api/v2/tag_service.proto (package memos.api.v2, syntax proto3)
+/* eslint-disable */
+// @ts-nocheck
+
+import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
+import { Message, proto3 } from "@bufbuild/protobuf";
+
+/**
+ * @generated from message memos.api.v2.Tag
+ */
+export declare class Tag extends Message<Tag> {
+ /**
+ * @generated from field: string name = 1;
+ */
+ name: string;
+
+ /**
+ * @generated from field: int32 creator_id = 2;
+ */
+ creatorId: number;
+
+ constructor(data?: PartialMessage<Tag>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.Tag";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Tag;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Tag;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Tag;
+
+ static equals(a: Tag | PlainMessage<Tag> | undefined, b: Tag | PlainMessage<Tag> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.ListTagsRequest
+ */
+export declare class ListTagsRequest extends Message<ListTagsRequest> {
+ /**
+ * @generated from field: int32 creator_id = 1;
+ */
+ creatorId: number;
+
+ constructor(data?: PartialMessage<ListTagsRequest>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.ListTagsRequest";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListTagsRequest;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListTagsRequest;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListTagsRequest;
+
+ static equals(a: ListTagsRequest | PlainMessage<ListTagsRequest> | undefined, b: ListTagsRequest | PlainMessage<ListTagsRequest> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.ListTagsResponse
+ */
+export declare class ListTagsResponse extends Message<ListTagsResponse> {
+ /**
+ * @generated from field: repeated memos.api.v2.Tag tags = 1;
+ */
+ tags: Tag[];
+
+ constructor(data?: PartialMessage<ListTagsResponse>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.ListTagsResponse";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListTagsResponse;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListTagsResponse;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListTagsResponse;
+
+ static equals(a: ListTagsResponse | PlainMessage<ListTagsResponse> | undefined, b: ListTagsResponse | PlainMessage<ListTagsResponse> | undefined): boolean;
+}
+
diff --git a/web/src/types/proto/api/v2/tag_service_pb.js b/web/src/types/proto/api/v2/tag_service_pb.js
new file mode 100644
index 000000000..475546b4a
--- /dev/null
+++ b/web/src/types/proto/api/v2/tag_service_pb.js
@@ -0,0 +1,38 @@
+// @generated by protoc-gen-es v1.3.0
+// @generated from file api/v2/tag_service.proto (package memos.api.v2, syntax proto3)
+/* eslint-disable */
+// @ts-nocheck
+
+import { proto3 } from "@bufbuild/protobuf";
+
+/**
+ * @generated from message memos.api.v2.Tag
+ */
+export const Tag = proto3.makeMessageType(
+ "memos.api.v2.Tag",
+ () => [
+ { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ { no: 2, name: "creator_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.ListTagsRequest
+ */
+export const ListTagsRequest = proto3.makeMessageType(
+ "memos.api.v2.ListTagsRequest",
+ () => [
+ { no: 1, name: "creator_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.ListTagsResponse
+ */
+export const ListTagsResponse = proto3.makeMessageType(
+ "memos.api.v2.ListTagsResponse",
+ () => [
+ { no: 1, name: "tags", kind: "message", T: Tag, repeated: true },
+ ],
+);
+
diff --git a/web/src/types/proto/api/v2/user_service_pb.d.ts b/web/src/types/proto/api/v2/user_service_pb.d.ts
new file mode 100644
index 000000000..7f01c0c5d
--- /dev/null
+++ b/web/src/types/proto/api/v2/user_service_pb.d.ts
@@ -0,0 +1,268 @@
+// @generated by protoc-gen-es v1.3.0
+// @generated from file api/v2/user_service.proto (package memos.api.v2, syntax proto3)
+/* eslint-disable */
+// @ts-nocheck
+
+import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
+import { Message, proto3 } from "@bufbuild/protobuf";
+import type { RowStatus } from "./common_pb.js";
+import type { Visibility } from "./memo_service_pb.js";
+
+/**
+ * @generated from enum memos.api.v2.Role
+ */
+export declare enum Role {
+ /**
+ * @generated from enum value: ROLE_UNSPECIFIED = 0;
+ */
+ ROLE_UNSPECIFIED = 0,
+
+ /**
+ * @generated from enum value: HOST = 1;
+ */
+ HOST = 1,
+
+ /**
+ * @generated from enum value: ADMIN = 2;
+ */
+ ADMIN = 2,
+
+ /**
+ * @generated from enum value: USER = 3;
+ */
+ USER = 3,
+}
+
+/**
+ * @generated from message memos.api.v2.User
+ */
+export declare class User extends Message<User> {
+ /**
+ * @generated from field: int32 id = 1;
+ */
+ id: number;
+
+ /**
+ * @generated from field: memos.api.v2.RowStatus row_status = 2;
+ */
+ rowStatus: RowStatus;
+
+ /**
+ * @generated from field: int64 created_ts = 3;
+ */
+ createdTs: bigint;
+
+ /**
+ * @generated from field: int64 updated_ts = 4;
+ */
+ updatedTs: bigint;
+
+ /**
+ * @generated from field: string username = 5;
+ */
+ username: string;
+
+ /**
+ * @generated from field: memos.api.v2.Role role = 6;
+ */
+ role: Role;
+
+ /**
+ * @generated from field: string email = 7;
+ */
+ email: string;
+
+ /**
+ * @generated from field: string nickname = 8;
+ */
+ nickname: string;
+
+ /**
+ * @generated from field: string open_id = 9;
+ */
+ openId: string;
+
+ /**
+ * @generated from field: string avatar_url = 10;
+ */
+ avatarUrl: string;
+
+ constructor(data?: PartialMessage<User>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.User";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): User;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): User;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): User;
+
+ static equals(a: User | PlainMessage<User> | undefined, b: User | PlainMessage<User> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.GetUserRequest
+ */
+export declare class GetUserRequest extends Message<GetUserRequest> {
+ /**
+ * @generated from field: string name = 1;
+ */
+ name: string;
+
+ constructor(data?: PartialMessage<GetUserRequest>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.GetUserRequest";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetUserRequest;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetUserRequest;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetUserRequest;
+
+ static equals(a: GetUserRequest | PlainMessage<GetUserRequest> | undefined, b: GetUserRequest | PlainMessage<GetUserRequest> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.GetUserResponse
+ */
+export declare class GetUserResponse extends Message<GetUserResponse> {
+ /**
+ * @generated from field: memos.api.v2.User user = 1;
+ */
+ user?: User;
+
+ constructor(data?: PartialMessage<GetUserResponse>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.GetUserResponse";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetUserResponse;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetUserResponse;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetUserResponse;
+
+ static equals(a: GetUserResponse | PlainMessage<GetUserResponse> | undefined, b: GetUserResponse | PlainMessage<GetUserResponse> | undefined): boolean;
+}
+
+/**
+ * @generated from message memos.api.v2.UserSetting
+ */
+export declare class UserSetting extends Message<UserSetting> {
+ /**
+ * The user id of the setting.
+ *
+ * @generated from field: int32 user_id = 1;
+ */
+ userId: number;
+
+ /**
+ * The key of the setting.
+ *
+ * @generated from field: memos.api.v2.UserSetting.Key key = 2;
+ */
+ key: UserSetting_Key;
+
+ /**
+ * The value of the setting.
+ *
+ * @generated from field: memos.api.v2.UserSettingValue value = 3;
+ */
+ value?: UserSettingValue;
+
+ constructor(data?: PartialMessage<UserSetting>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.UserSetting";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserSetting;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserSetting;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserSetting;
+
+ static equals(a: UserSetting | PlainMessage<UserSetting> | undefined, b: UserSetting | PlainMessage<UserSetting> | undefined): boolean;
+}
+
+/**
+ * @generated from enum memos.api.v2.UserSetting.Key
+ */
+export declare enum UserSetting_Key {
+ /**
+ * @generated from enum value: KEY_UNSPECIFIED = 0;
+ */
+ KEY_UNSPECIFIED = 0,
+
+ /**
+ * The preferred locale.
+ *
+ * @generated from enum value: LOCALE = 1;
+ */
+ LOCALE = 1,
+
+ /**
+ * The preferred appearance.
+ *
+ * @generated from enum value: APPEARANCE = 2;
+ */
+ APPEARANCE = 2,
+
+ /**
+ * The default visibility of the memo when creating a new memo.
+ *
+ * @generated from enum value: MEMO_VISIBILITY = 3;
+ */
+ MEMO_VISIBILITY = 3,
+
+ /**
+ * User's telegram id
+ *
+ * @generated from enum value: TELEGRAM_USER_ID = 4;
+ */
+ TELEGRAM_USER_ID = 4,
+}
+
+/**
+ * @generated from message memos.api.v2.UserSettingValue
+ */
+export declare class UserSettingValue extends Message<UserSettingValue> {
+ /**
+ * @generated from oneof memos.api.v2.UserSettingValue.value
+ */
+ value: {
+ /**
+ * Default value as a string.
+ *
+ * @generated from field: string string_value = 1;
+ */
+ value: string;
+ case: "stringValue";
+ } | {
+ /**
+ * @generated from field: memos.api.v2.Visibility visibility_value = 2;
+ */
+ value: Visibility;
+ case: "visibilityValue";
+ } | { case: undefined; value?: undefined };
+
+ constructor(data?: PartialMessage<UserSettingValue>);
+
+ static readonly runtime: typeof proto3;
+ static readonly typeName = "memos.api.v2.UserSettingValue";
+ static readonly fields: FieldList;
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserSettingValue;
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserSettingValue;
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserSettingValue;
+
+ static equals(a: UserSettingValue | PlainMessage<UserSettingValue> | undefined, b: UserSettingValue | PlainMessage<UserSettingValue> | undefined): boolean;
+}
+
diff --git a/web/src/types/proto/api/v2/user_service_pb.js b/web/src/types/proto/api/v2/user_service_pb.js
new file mode 100644
index 000000000..c08be8011
--- /dev/null
+++ b/web/src/types/proto/api/v2/user_service_pb.js
@@ -0,0 +1,98 @@
+// @generated by protoc-gen-es v1.3.0
+// @generated from file api/v2/user_service.proto (package memos.api.v2, syntax proto3)
+/* eslint-disable */
+// @ts-nocheck
+
+import { proto3 } from "@bufbuild/protobuf";
+import { RowStatus } from "./common_pb.js";
+import { Visibility } from "./memo_service_pb.js";
+
+/**
+ * @generated from enum memos.api.v2.Role
+ */
+export const Role = proto3.makeEnum(
+ "memos.api.v2.Role",
+ [
+ {no: 0, name: "ROLE_UNSPECIFIED"},
+ {no: 1, name: "HOST"},
+ {no: 2, name: "ADMIN"},
+ {no: 3, name: "USER"},
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.User
+ */
+export const User = proto3.makeMessageType(
+ "memos.api.v2.User",
+ () => [
+ { no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
+ { no: 2, name: "row_status", kind: "enum", T: proto3.getEnumType(RowStatus) },
+ { no: 3, name: "created_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
+ { no: 4, name: "updated_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
+ { no: 5, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ { no: 6, name: "role", kind: "enum", T: proto3.getEnumType(Role) },
+ { no: 7, name: "email", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ { no: 8, name: "nickname", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ { no: 9, name: "open_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ { no: 10, name: "avatar_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.GetUserRequest
+ */
+export const GetUserRequest = proto3.makeMessageType(
+ "memos.api.v2.GetUserRequest",
+ () => [
+ { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.GetUserResponse
+ */
+export const GetUserResponse = proto3.makeMessageType(
+ "memos.api.v2.GetUserResponse",
+ () => [
+ { no: 1, name: "user", kind: "message", T: User },
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.UserSetting
+ */
+export const UserSetting = proto3.makeMessageType(
+ "memos.api.v2.UserSetting",
+ () => [
+ { no: 1, name: "user_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
+ { no: 2, name: "key", kind: "enum", T: proto3.getEnumType(UserSetting_Key) },
+ { no: 3, name: "value", kind: "message", T: UserSettingValue },
+ ],
+);
+
+/**
+ * @generated from enum memos.api.v2.UserSetting.Key
+ */
+export const UserSetting_Key = proto3.makeEnum(
+ "memos.api.v2.UserSetting.Key",
+ [
+ {no: 0, name: "KEY_UNSPECIFIED"},
+ {no: 1, name: "LOCALE"},
+ {no: 2, name: "APPEARANCE"},
+ {no: 3, name: "MEMO_VISIBILITY"},
+ {no: 4, name: "TELEGRAM_USER_ID"},
+ ],
+);
+
+/**
+ * @generated from message memos.api.v2.UserSettingValue
+ */
+export const UserSettingValue = proto3.makeMessageType(
+ "memos.api.v2.UserSettingValue",
+ () => [
+ { no: 1, name: "string_value", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "value" },
+ { no: 2, name: "visibility_value", kind: "enum", T: proto3.getEnumType(Visibility), oneof: "value" },
+ ],
+);
+