mirror of https://github.com/usememos/memos.git
refactor: deprecate old filter
This commit is contained in:
parent
7098721617
commit
6e45e9f8b6
|
|
@ -310,10 +310,6 @@ message ListMemosRequest {
|
||||||
|
|
||||||
// Optional. If true, show deleted memos in the response.
|
// Optional. If true, show deleted memos in the response.
|
||||||
bool show_deleted = 7 [(google.api.field_behavior) = OPTIONAL];
|
bool show_deleted = 7 [(google.api.field_behavior) = OPTIONAL];
|
||||||
|
|
||||||
// [Deprecated] Old filter contains some specific conditions to filter memos.
|
|
||||||
// Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"
|
|
||||||
string old_filter = 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListMemosResponse {
|
message ListMemosResponse {
|
||||||
|
|
|
||||||
|
|
@ -575,10 +575,7 @@ type ListMemosRequest struct {
|
||||||
// Refer to `Shortcut.filter`.
|
// Refer to `Shortcut.filter`.
|
||||||
Filter string `protobuf:"bytes,6,opt,name=filter,proto3" json:"filter,omitempty"`
|
Filter string `protobuf:"bytes,6,opt,name=filter,proto3" json:"filter,omitempty"`
|
||||||
// Optional. If true, show deleted memos in the response.
|
// Optional. If true, show deleted memos in the response.
|
||||||
ShowDeleted bool `protobuf:"varint,7,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"`
|
ShowDeleted bool `protobuf:"varint,7,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"`
|
||||||
// [Deprecated] Old filter contains some specific conditions to filter memos.
|
|
||||||
// Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"
|
|
||||||
OldFilter string `protobuf:"bytes,8,opt,name=old_filter,json=oldFilter,proto3" json:"old_filter,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
@ -662,13 +659,6 @@ func (x *ListMemosRequest) GetShowDeleted() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ListMemosRequest) GetOldFilter() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.OldFilter
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type ListMemosResponse struct {
|
type ListMemosResponse struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
// The list of memos.
|
// The list of memos.
|
||||||
|
|
@ -2074,7 +2064,7 @@ const file_api_v1_memo_service_proto_rawDesc = "" +
|
||||||
"\amemo_id\x18\x02 \x01(\tB\x03\xe0A\x01R\x06memoId\x12(\n" +
|
"\amemo_id\x18\x02 \x01(\tB\x03\xe0A\x01R\x06memoId\x12(\n" +
|
||||||
"\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12\"\n" +
|
"\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12\"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"request_id\x18\x04 \x01(\tB\x03\xe0A\x01R\trequestId\"\xbf\x02\n" +
|
"request_id\x18\x04 \x01(\tB\x03\xe0A\x01R\trequestId\"\xa0\x02\n" +
|
||||||
"\x10ListMemosRequest\x121\n" +
|
"\x10ListMemosRequest\x121\n" +
|
||||||
"\x06parent\x18\x01 \x01(\tB\x19\xe0A\x01\xfaA\x13\n" +
|
"\x06parent\x18\x01 \x01(\tB\x19\xe0A\x01\xfaA\x13\n" +
|
||||||
"\x11memos.api.v1/UserR\x06parent\x12 \n" +
|
"\x11memos.api.v1/UserR\x06parent\x12 \n" +
|
||||||
|
|
@ -2084,9 +2074,7 @@ const file_api_v1_memo_service_proto_rawDesc = "" +
|
||||||
"\x05state\x18\x04 \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x01R\x05state\x12\x1e\n" +
|
"\x05state\x18\x04 \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x01R\x05state\x12\x1e\n" +
|
||||||
"\border_by\x18\x05 \x01(\tB\x03\xe0A\x01R\aorderBy\x12\x1b\n" +
|
"\border_by\x18\x05 \x01(\tB\x03\xe0A\x01R\aorderBy\x12\x1b\n" +
|
||||||
"\x06filter\x18\x06 \x01(\tB\x03\xe0A\x01R\x06filter\x12&\n" +
|
"\x06filter\x18\x06 \x01(\tB\x03\xe0A\x01R\x06filter\x12&\n" +
|
||||||
"\fshow_deleted\x18\a \x01(\bB\x03\xe0A\x01R\vshowDeleted\x12\x1d\n" +
|
"\fshow_deleted\x18\a \x01(\bB\x03\xe0A\x01R\vshowDeleted\"\x84\x01\n" +
|
||||||
"\n" +
|
|
||||||
"old_filter\x18\b \x01(\tR\toldFilter\"\x84\x01\n" +
|
|
||||||
"\x11ListMemosResponse\x12(\n" +
|
"\x11ListMemosResponse\x12(\n" +
|
||||||
"\x05memos\x18\x01 \x03(\v2\x12.memos.api.v1.MemoR\x05memos\x12&\n" +
|
"\x05memos\x18\x01 \x03(\v2\x12.memos.api.v1.MemoR\x05memos\x12&\n" +
|
||||||
"\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" +
|
"\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" +
|
||||||
|
|
|
||||||
|
|
@ -680,13 +680,6 @@ paths:
|
||||||
description: Optional. If true, show deleted memos in the response.
|
description: Optional. If true, show deleted memos in the response.
|
||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
- name: oldFilter
|
|
||||||
in: query
|
|
||||||
description: |-
|
|
||||||
[Deprecated] Old filter contains some specific conditions to filter memos.
|
|
||||||
Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
|
|
@ -1667,13 +1660,6 @@ paths:
|
||||||
description: Optional. If true, show deleted memos in the response.
|
description: Optional. If true, show deleted memos in the response.
|
||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
- name: oldFilter
|
|
||||||
in: query
|
|
||||||
description: |-
|
|
||||||
[Deprecated] Old filter contains some specific conditions to filter memos.
|
|
||||||
Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
|
|
|
||||||
|
|
@ -99,13 +99,6 @@ func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosReq
|
||||||
// Exclude comments by default.
|
// Exclude comments by default.
|
||||||
ExcludeComments: true,
|
ExcludeComments: true,
|
||||||
}
|
}
|
||||||
// Handle deprecated old_filter for backward compatibility
|
|
||||||
if request.OldFilter != "" && request.Filter == "" {
|
|
||||||
//nolint:staticcheck // SA1019: Using deprecated field for backward compatibility
|
|
||||||
if err := s.buildMemoFindWithFilter(ctx, memoFind, request.OldFilter); err != nil {
|
|
||||||
return nil, status.Errorf(codes.InvalidArgument, "failed to build find memos with filter: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if request.Parent != "" && request.Parent != "users/-" {
|
if request.Parent != "" && request.Parent != "users/-" {
|
||||||
userID, err := ExtractUserIDFromName(request.Parent)
|
userID, err := ExtractUserIDFromName(request.Parent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -1,168 +1 @@
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/google/cel-go/cel"
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
exprv1 "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
|
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"google.golang.org/grpc/status"
|
|
||||||
|
|
||||||
"github.com/usememos/memos/store"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (s *APIV1Service) buildMemoFindWithFilter(ctx context.Context, find *store.FindMemo, filter string) error {
|
|
||||||
if find.PayloadFind == nil {
|
|
||||||
find.PayloadFind = &store.FindMemoPayload{}
|
|
||||||
}
|
|
||||||
if filter != "" {
|
|
||||||
filterExpr, err := parseMemoFilter(filter)
|
|
||||||
if err != nil {
|
|
||||||
return status.Errorf(codes.InvalidArgument, "invalid filter: %v", err)
|
|
||||||
}
|
|
||||||
if len(filterExpr.ContentSearch) > 0 {
|
|
||||||
find.ContentSearch = filterExpr.ContentSearch
|
|
||||||
}
|
|
||||||
if filterExpr.TagSearch != nil {
|
|
||||||
if find.PayloadFind == nil {
|
|
||||||
find.PayloadFind = &store.FindMemoPayload{}
|
|
||||||
}
|
|
||||||
find.PayloadFind.TagSearch = filterExpr.TagSearch
|
|
||||||
}
|
|
||||||
if filterExpr.DisplayTimeAfter != nil {
|
|
||||||
workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return status.Errorf(codes.Internal, "failed to get workspace memo related setting")
|
|
||||||
}
|
|
||||||
if workspaceMemoRelatedSetting.DisplayWithUpdateTime {
|
|
||||||
find.UpdatedTsAfter = filterExpr.DisplayTimeAfter
|
|
||||||
} else {
|
|
||||||
find.CreatedTsAfter = filterExpr.DisplayTimeAfter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if filterExpr.DisplayTimeBefore != nil {
|
|
||||||
workspaceMemoRelatedSetting, err := s.Store.GetWorkspaceMemoRelatedSetting(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return status.Errorf(codes.Internal, "failed to get workspace memo related setting")
|
|
||||||
}
|
|
||||||
if workspaceMemoRelatedSetting.DisplayWithUpdateTime {
|
|
||||||
find.UpdatedTsBefore = filterExpr.DisplayTimeBefore
|
|
||||||
} else {
|
|
||||||
find.CreatedTsBefore = filterExpr.DisplayTimeBefore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if filterExpr.Pinned {
|
|
||||||
pinned := true
|
|
||||||
find.Pinned = &pinned
|
|
||||||
}
|
|
||||||
if filterExpr.HasLink {
|
|
||||||
find.PayloadFind.HasLink = true
|
|
||||||
}
|
|
||||||
if filterExpr.HasTaskList {
|
|
||||||
find.PayloadFind.HasTaskList = true
|
|
||||||
}
|
|
||||||
if filterExpr.HasCode {
|
|
||||||
find.PayloadFind.HasCode = true
|
|
||||||
}
|
|
||||||
if filterExpr.HasIncompleteTasks {
|
|
||||||
find.PayloadFind.HasIncompleteTasks = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// MemoFilterCELAttributes are the CEL attributes.
|
|
||||||
var MemoFilterCELAttributes = []cel.EnvOption{
|
|
||||||
cel.Variable("content_search", cel.ListType(cel.StringType)),
|
|
||||||
cel.Variable("tag_search", cel.ListType(cel.StringType)),
|
|
||||||
cel.Variable("display_time_before", cel.IntType),
|
|
||||||
cel.Variable("display_time_after", cel.IntType),
|
|
||||||
cel.Variable("pinned", cel.BoolType),
|
|
||||||
cel.Variable("has_link", cel.BoolType),
|
|
||||||
cel.Variable("has_task_list", cel.BoolType),
|
|
||||||
cel.Variable("has_code", cel.BoolType),
|
|
||||||
cel.Variable("has_incomplete_tasks", cel.BoolType),
|
|
||||||
}
|
|
||||||
|
|
||||||
type MemoFilter struct {
|
|
||||||
ContentSearch []string
|
|
||||||
TagSearch []string
|
|
||||||
DisplayTimeBefore *int64
|
|
||||||
DisplayTimeAfter *int64
|
|
||||||
Pinned bool
|
|
||||||
HasLink bool
|
|
||||||
HasTaskList bool
|
|
||||||
HasCode bool
|
|
||||||
HasIncompleteTasks bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseMemoFilter(expression string) (*MemoFilter, error) {
|
|
||||||
e, err := cel.NewEnv(MemoFilterCELAttributes...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
ast, issues := e.Compile(expression)
|
|
||||||
if issues != nil {
|
|
||||||
return nil, errors.Errorf("found issue %v", issues)
|
|
||||||
}
|
|
||||||
filter := &MemoFilter{}
|
|
||||||
parsedExpr, err := cel.AstToParsedExpr(ast)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
callExpr := parsedExpr.GetExpr().GetCallExpr()
|
|
||||||
findMemoField(callExpr, filter)
|
|
||||||
return filter, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func findMemoField(callExpr *exprv1.Expr_Call, filter *MemoFilter) {
|
|
||||||
if len(callExpr.Args) == 2 {
|
|
||||||
idExpr := callExpr.Args[0].GetIdentExpr()
|
|
||||||
if idExpr != nil {
|
|
||||||
if idExpr.Name == "content_search" {
|
|
||||||
contentSearch := []string{}
|
|
||||||
for _, expr := range callExpr.Args[1].GetListExpr().GetElements() {
|
|
||||||
value := expr.GetConstExpr().GetStringValue()
|
|
||||||
contentSearch = append(contentSearch, value)
|
|
||||||
}
|
|
||||||
filter.ContentSearch = contentSearch
|
|
||||||
} else if idExpr.Name == "tag_search" {
|
|
||||||
tagSearch := []string{}
|
|
||||||
for _, expr := range callExpr.Args[1].GetListExpr().GetElements() {
|
|
||||||
value := expr.GetConstExpr().GetStringValue()
|
|
||||||
tagSearch = append(tagSearch, value)
|
|
||||||
}
|
|
||||||
filter.TagSearch = tagSearch
|
|
||||||
} else if idExpr.Name == "display_time_before" {
|
|
||||||
displayTimeBefore := callExpr.Args[1].GetConstExpr().GetInt64Value()
|
|
||||||
filter.DisplayTimeBefore = &displayTimeBefore
|
|
||||||
} else if idExpr.Name == "display_time_after" {
|
|
||||||
displayTimeAfter := callExpr.Args[1].GetConstExpr().GetInt64Value()
|
|
||||||
filter.DisplayTimeAfter = &displayTimeAfter
|
|
||||||
} else if idExpr.Name == "pinned" {
|
|
||||||
value := callExpr.Args[1].GetConstExpr().GetBoolValue()
|
|
||||||
filter.Pinned = value
|
|
||||||
} else if idExpr.Name == "has_link" {
|
|
||||||
value := callExpr.Args[1].GetConstExpr().GetBoolValue()
|
|
||||||
filter.HasLink = value
|
|
||||||
} else if idExpr.Name == "has_task_list" {
|
|
||||||
value := callExpr.Args[1].GetConstExpr().GetBoolValue()
|
|
||||||
filter.HasTaskList = value
|
|
||||||
} else if idExpr.Name == "has_code" {
|
|
||||||
value := callExpr.Args[1].GetConstExpr().GetBoolValue()
|
|
||||||
filter.HasCode = value
|
|
||||||
} else if idExpr.Name == "has_incomplete_tasks" {
|
|
||||||
value := callExpr.Args[1].GetConstExpr().GetBoolValue()
|
|
||||||
filter.HasIncompleteTasks = value
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, arg := range callExpr.Args {
|
|
||||||
callExpr := arg.GetCallExpr()
|
|
||||||
if callExpr != nil {
|
|
||||||
findMemoField(callExpr, filter)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,12 @@ const AddMemoRelationPopover = (props: Props) => {
|
||||||
try {
|
try {
|
||||||
const conditions = [];
|
const conditions = [];
|
||||||
if (searchText) {
|
if (searchText) {
|
||||||
conditions.push(`content_search == [${JSON.stringify(searchText)}]`);
|
conditions.push(`content.contains("${searchText}")`);
|
||||||
}
|
}
|
||||||
const { memos } = await memoServiceClient.listMemos({
|
const { memos } = await memoServiceClient.listMemos({
|
||||||
parent: user.name,
|
parent: user.name,
|
||||||
|
filter: conditions.length > 0 ? conditions.join(" AND ") : undefined,
|
||||||
pageSize: DEFAULT_LIST_MEMOS_PAGE_SIZE,
|
pageSize: DEFAULT_LIST_MEMOS_PAGE_SIZE,
|
||||||
oldFilter: conditions.length > 0 ? conditions.join(" && ") : undefined,
|
|
||||||
});
|
});
|
||||||
setFetchedMemos(memos);
|
setFetchedMemos(memos);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ interface Props {
|
||||||
state?: State;
|
state?: State;
|
||||||
orderBy?: string;
|
orderBy?: string;
|
||||||
filter?: string;
|
filter?: string;
|
||||||
oldFilter?: string;
|
|
||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,7 +52,6 @@ const PagedMemoList = observer((props: Props) => {
|
||||||
state: props.state || State.NORMAL,
|
state: props.state || State.NORMAL,
|
||||||
orderBy: props.orderBy || "display_time desc",
|
orderBy: props.orderBy || "display_time desc",
|
||||||
filter: props.filter || "",
|
filter: props.filter || "",
|
||||||
oldFilter: props.oldFilter || "",
|
|
||||||
pageSize: props.pageSize || DEFAULT_LIST_MEMOS_PAGE_SIZE,
|
pageSize: props.pageSize || DEFAULT_LIST_MEMOS_PAGE_SIZE,
|
||||||
pageToken,
|
pageToken,
|
||||||
});
|
});
|
||||||
|
|
@ -103,7 +101,7 @@ const PagedMemoList = observer((props: Props) => {
|
||||||
// Initial load and reload when props change
|
// Initial load and reload when props change
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
refreshList();
|
refreshList();
|
||||||
}, [props.owner, props.state, props.orderBy, props.filter, props.oldFilter, props.pageSize]);
|
}, [props.owner, props.state, props.orderBy, props.filter, props.pageSize]);
|
||||||
|
|
||||||
// Auto-fetch more content when list changes and page isn't full
|
// Auto-fetch more content when list changes and page isn't full
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -12,25 +12,17 @@ import { Memo } from "@/types/proto/api/v1/memo_service";
|
||||||
const Archived = observer(() => {
|
const Archived = observer(() => {
|
||||||
const user = useCurrentUser();
|
const user = useCurrentUser();
|
||||||
|
|
||||||
const memoListFilter = useMemo(() => {
|
const memoFitler = useMemo(() => {
|
||||||
const conditions = [];
|
const conditions = [];
|
||||||
const contentSearch: string[] = [];
|
|
||||||
const tagSearch: string[] = [];
|
|
||||||
for (const filter of memoFilterStore.filters) {
|
for (const filter of memoFilterStore.filters) {
|
||||||
if (filter.factor === "contentSearch") {
|
if (filter.factor === "contentSearch") {
|
||||||
contentSearch.push(`"${filter.value}"`);
|
conditions.push(`content.contains("${filter.value}")`);
|
||||||
} else if (filter.factor === "tagSearch") {
|
} else if (filter.factor === "tagSearch") {
|
||||||
tagSearch.push(`"${filter.value}"`);
|
conditions.push(`tag in ["${filter.value}"]`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (contentSearch.length > 0) {
|
return conditions.length > 0 ? conditions.join(" && ") : undefined;
|
||||||
conditions.push(`content_search == [${contentSearch.join(", ")}]`);
|
}, [memoFilterStore.filters]);
|
||||||
}
|
|
||||||
if (tagSearch.length > 0) {
|
|
||||||
conditions.push(`tag_search == [${tagSearch.join(", ")}]`);
|
|
||||||
}
|
|
||||||
return conditions.join(" && ");
|
|
||||||
}, [user, memoFilterStore.filters]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PagedMemoList
|
<PagedMemoList
|
||||||
|
|
@ -47,7 +39,7 @@ const Archived = observer(() => {
|
||||||
owner={user.name}
|
owner={user.name}
|
||||||
state={State.ARCHIVED}
|
state={State.ARCHIVED}
|
||||||
orderBy={viewStore.state.orderByTimeAsc ? "display_time asc" : "display_time desc"}
|
orderBy={viewStore.state.orderByTimeAsc ? "display_time asc" : "display_time desc"}
|
||||||
oldFilter={memoListFilter}
|
filter={memoFitler}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -20,39 +20,33 @@ const Home = observer(() => {
|
||||||
const user = useCurrentUser();
|
const user = useCurrentUser();
|
||||||
const selectedShortcut = userStore.state.shortcuts.find((shortcut) => getShortcutId(shortcut.name) === memoFilterStore.shortcut);
|
const selectedShortcut = userStore.state.shortcuts.find((shortcut) => getShortcutId(shortcut.name) === memoFilterStore.shortcut);
|
||||||
|
|
||||||
const memoListFilter = useMemo(() => {
|
const memoFilter = useMemo(() => {
|
||||||
const conditions = [];
|
const conditions = [];
|
||||||
const contentSearch: string[] = [];
|
if (selectedShortcut?.filter) {
|
||||||
const tagSearch: string[] = [];
|
conditions.push(selectedShortcut.filter);
|
||||||
|
}
|
||||||
for (const filter of memoFilterStore.filters) {
|
for (const filter of memoFilterStore.filters) {
|
||||||
if (filter.factor === "contentSearch") {
|
if (filter.factor === "contentSearch") {
|
||||||
contentSearch.push(`"${filter.value}"`);
|
conditions.push(`content.contains("${filter.value}")`);
|
||||||
} else if (filter.factor === "tagSearch") {
|
} else if (filter.factor === "tagSearch") {
|
||||||
tagSearch.push(`"${filter.value}"`);
|
conditions.push(`tag in ["${filter.value}"]`);
|
||||||
} else if (filter.factor === "pinned") {
|
} else if (filter.factor === "pinned") {
|
||||||
conditions.push(`pinned == true`);
|
conditions.push(`pinned`);
|
||||||
} else if (filter.factor === "property.hasLink") {
|
} else if (filter.factor === "property.hasLink") {
|
||||||
conditions.push(`has_link == true`);
|
conditions.push(`has_link`);
|
||||||
} else if (filter.factor === "property.hasTaskList") {
|
} else if (filter.factor === "property.hasTaskList") {
|
||||||
conditions.push(`has_task_list == true`);
|
conditions.push(`has_task_list`);
|
||||||
} else if (filter.factor === "property.hasCode") {
|
} else if (filter.factor === "property.hasCode") {
|
||||||
conditions.push(`has_code == true`);
|
conditions.push(`has_code`);
|
||||||
} else if (filter.factor === "displayTime") {
|
} else if (filter.factor === "displayTime") {
|
||||||
const filterDate = new Date(filter.value);
|
const filterDate = new Date(filter.value);
|
||||||
const filterUtcTimestamp = filterDate.getTime() + filterDate.getTimezoneOffset() * 60 * 1000;
|
const filterUtcTimestamp = filterDate.getTime() + filterDate.getTimezoneOffset() * 60 * 1000;
|
||||||
const timestampAfter = filterUtcTimestamp / 1000;
|
const timestampAfter = filterUtcTimestamp / 1000;
|
||||||
conditions.push(`display_time_after == ${timestampAfter}`);
|
conditions.push(`created_ts >= ${timestampAfter} AND created_ts < ${timestampAfter + 60 * 60 * 24}`);
|
||||||
conditions.push(`display_time_before == ${timestampAfter + 60 * 60 * 24}`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (contentSearch.length > 0) {
|
return conditions.length > 0 ? conditions.join(" && ") : undefined;
|
||||||
conditions.push(`content_search == [${contentSearch.join(", ")}]`);
|
}, [memoFilterStore.filters, selectedShortcut?.filter]);
|
||||||
}
|
|
||||||
if (tagSearch.length > 0) {
|
|
||||||
conditions.push(`tag_search == [${tagSearch.join(", ")}]`);
|
|
||||||
}
|
|
||||||
return conditions.join(" && ");
|
|
||||||
}, [user, memoFilterStore.filters, viewStore.state.orderByTimeAsc]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full min-h-full bg-background text-foreground">
|
<div className="w-full min-h-full bg-background text-foreground">
|
||||||
|
|
@ -69,8 +63,7 @@ const Home = observer(() => {
|
||||||
}
|
}
|
||||||
owner={user.name}
|
owner={user.name}
|
||||||
orderBy={viewStore.state.orderByTimeAsc ? "display_time asc" : "display_time desc"}
|
orderBy={viewStore.state.orderByTimeAsc ? "display_time asc" : "display_time desc"}
|
||||||
filter={selectedShortcut?.filter || ""}
|
filter={memoFilter}
|
||||||
oldFilter={memoListFilter}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -41,28 +41,20 @@ const UserProfile = observer(() => {
|
||||||
});
|
});
|
||||||
}, [params.username]);
|
}, [params.username]);
|
||||||
|
|
||||||
const memoListFilter = useMemo(() => {
|
const memoFilter = useMemo(() => {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return "";
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const conditions = [];
|
const conditions = [];
|
||||||
const contentSearch: string[] = [];
|
|
||||||
const tagSearch: string[] = [];
|
|
||||||
for (const filter of memoFilterStore.filters) {
|
for (const filter of memoFilterStore.filters) {
|
||||||
if (filter.factor === "contentSearch") {
|
if (filter.factor === "contentSearch") {
|
||||||
contentSearch.push(`"${filter.value}"`);
|
conditions.push(`content.contains("${filter.value}")`);
|
||||||
} else if (filter.factor === "tagSearch") {
|
} else if (filter.factor === "tagSearch") {
|
||||||
tagSearch.push(`"${filter.value}"`);
|
conditions.push(`tag in ["${filter.value}"]`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (contentSearch.length > 0) {
|
return conditions.length > 0 ? conditions.join(" && ") : undefined;
|
||||||
conditions.push(`content_search == [${contentSearch.join(", ")}]`);
|
|
||||||
}
|
|
||||||
if (tagSearch.length > 0) {
|
|
||||||
conditions.push(`tag_search == [${tagSearch.join(", ")}]`);
|
|
||||||
}
|
|
||||||
return conditions.join(" && ");
|
|
||||||
}, [user, memoFilterStore.filters]);
|
}, [user, memoFilterStore.filters]);
|
||||||
|
|
||||||
const handleCopyProfileLink = () => {
|
const handleCopyProfileLink = () => {
|
||||||
|
|
@ -110,7 +102,7 @@ const UserProfile = observer(() => {
|
||||||
}
|
}
|
||||||
owner={user.name}
|
owner={user.name}
|
||||||
orderBy={viewStore.state.orderByTimeAsc ? "display_time asc" : "display_time desc"}
|
orderBy={viewStore.state.orderByTimeAsc ? "display_time asc" : "display_time desc"}
|
||||||
oldFilter={memoListFilter}
|
filter={memoFilter}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
|
|
@ -212,11 +212,6 @@ export interface ListMemosRequest {
|
||||||
filter: string;
|
filter: string;
|
||||||
/** Optional. If true, show deleted memos in the response. */
|
/** Optional. If true, show deleted memos in the response. */
|
||||||
showDeleted: boolean;
|
showDeleted: boolean;
|
||||||
/**
|
|
||||||
* [Deprecated] Old filter contains some specific conditions to filter memos.
|
|
||||||
* Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"
|
|
||||||
*/
|
|
||||||
oldFilter: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListMemosResponse {
|
export interface ListMemosResponse {
|
||||||
|
|
@ -1103,7 +1098,6 @@ function createBaseListMemosRequest(): ListMemosRequest {
|
||||||
orderBy: "",
|
orderBy: "",
|
||||||
filter: "",
|
filter: "",
|
||||||
showDeleted: false,
|
showDeleted: false,
|
||||||
oldFilter: "",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1130,9 +1124,6 @@ export const ListMemosRequest: MessageFns<ListMemosRequest> = {
|
||||||
if (message.showDeleted !== false) {
|
if (message.showDeleted !== false) {
|
||||||
writer.uint32(56).bool(message.showDeleted);
|
writer.uint32(56).bool(message.showDeleted);
|
||||||
}
|
}
|
||||||
if (message.oldFilter !== "") {
|
|
||||||
writer.uint32(66).string(message.oldFilter);
|
|
||||||
}
|
|
||||||
return writer;
|
return writer;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1199,14 +1190,6 @@ export const ListMemosRequest: MessageFns<ListMemosRequest> = {
|
||||||
message.showDeleted = reader.bool();
|
message.showDeleted = reader.bool();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 8: {
|
|
||||||
if (tag !== 66) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
message.oldFilter = reader.string();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ((tag & 7) === 4 || tag === 0) {
|
if ((tag & 7) === 4 || tag === 0) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1228,7 +1211,6 @@ export const ListMemosRequest: MessageFns<ListMemosRequest> = {
|
||||||
message.orderBy = object.orderBy ?? "";
|
message.orderBy = object.orderBy ?? "";
|
||||||
message.filter = object.filter ?? "";
|
message.filter = object.filter ?? "";
|
||||||
message.showDeleted = object.showDeleted ?? false;
|
message.showDeleted = object.showDeleted ?? false;
|
||||||
message.oldFilter = object.oldFilter ?? "";
|
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export enum Edition {
|
||||||
EDITION_2024 = "EDITION_2024",
|
EDITION_2024 = "EDITION_2024",
|
||||||
/**
|
/**
|
||||||
* EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be
|
* EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be
|
||||||
* used or relied on outside of tests.
|
* used or relyed on outside of tests.
|
||||||
*/
|
*/
|
||||||
EDITION_1_TEST_ONLY = "EDITION_1_TEST_ONLY",
|
EDITION_1_TEST_ONLY = "EDITION_1_TEST_ONLY",
|
||||||
EDITION_2_TEST_ONLY = "EDITION_2_TEST_ONLY",
|
EDITION_2_TEST_ONLY = "EDITION_2_TEST_ONLY",
|
||||||
|
|
@ -177,19 +177,11 @@ export interface FileDescriptorProto {
|
||||||
* The supported values are "proto2", "proto3", and "editions".
|
* The supported values are "proto2", "proto3", and "editions".
|
||||||
*
|
*
|
||||||
* If `edition` is present, this value must be "editions".
|
* If `edition` is present, this value must be "editions".
|
||||||
* WARNING: This field should only be used by protobuf plugins or special
|
|
||||||
* cases like the proto compiler. Other uses are discouraged and
|
|
||||||
* developers should rely on the protoreflect APIs for their client language.
|
|
||||||
*/
|
*/
|
||||||
syntax?:
|
syntax?:
|
||||||
| string
|
| string
|
||||||
| undefined;
|
| undefined;
|
||||||
/**
|
/** The edition of the proto file. */
|
||||||
* The edition of the proto file.
|
|
||||||
* WARNING: This field should only be used by protobuf plugins or special
|
|
||||||
* cases like the proto compiler. Other uses are discouraged and
|
|
||||||
* developers should rely on the protoreflect APIs for their client language.
|
|
||||||
*/
|
|
||||||
edition?: Edition | undefined;
|
edition?: Edition | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -836,12 +828,7 @@ export interface FileOptions {
|
||||||
rubyPackage?:
|
rubyPackage?:
|
||||||
| string
|
| string
|
||||||
| undefined;
|
| undefined;
|
||||||
/**
|
/** Any features defined in the specific edition. */
|
||||||
* Any features defined in the specific edition.
|
|
||||||
* WARNING: This field should only be used by protobuf plugins or special
|
|
||||||
* cases like the proto compiler. Other uses are discouraged and
|
|
||||||
* developers should rely on the protoreflect APIs for their client language.
|
|
||||||
*/
|
|
||||||
features?:
|
features?:
|
||||||
| FeatureSet
|
| FeatureSet
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
@ -979,12 +966,7 @@ export interface MessageOptions {
|
||||||
deprecatedLegacyJsonFieldConflicts?:
|
deprecatedLegacyJsonFieldConflicts?:
|
||||||
| boolean
|
| boolean
|
||||||
| undefined;
|
| undefined;
|
||||||
/**
|
/** Any features defined in the specific edition. */
|
||||||
* Any features defined in the specific edition.
|
|
||||||
* WARNING: This field should only be used by protobuf plugins or special
|
|
||||||
* cases like the proto compiler. Other uses are discouraged and
|
|
||||||
* developers should rely on the protoreflect APIs for their client language.
|
|
||||||
*/
|
|
||||||
features?:
|
features?:
|
||||||
| FeatureSet
|
| FeatureSet
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
@ -994,13 +976,12 @@ export interface MessageOptions {
|
||||||
|
|
||||||
export interface FieldOptions {
|
export interface FieldOptions {
|
||||||
/**
|
/**
|
||||||
* NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
|
|
||||||
* The ctype option instructs the C++ code generator to use a different
|
* The ctype option instructs the C++ code generator to use a different
|
||||||
* representation of the field than it normally would. See the specific
|
* representation of the field than it normally would. See the specific
|
||||||
* options below. This option is only implemented to support use of
|
* options below. This option is only implemented to support use of
|
||||||
* [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
|
* [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
|
||||||
* type "bytes" in the open source release.
|
* type "bytes" in the open source release -- sorry, we'll try to include
|
||||||
* TODO: make ctype actually deprecated.
|
* other types in a future version!
|
||||||
*/
|
*/
|
||||||
ctype?:
|
ctype?:
|
||||||
| FieldOptions_CType
|
| FieldOptions_CType
|
||||||
|
|
@ -1089,12 +1070,7 @@ export interface FieldOptions {
|
||||||
retention?: FieldOptions_OptionRetention | undefined;
|
retention?: FieldOptions_OptionRetention | undefined;
|
||||||
targets: FieldOptions_OptionTargetType[];
|
targets: FieldOptions_OptionTargetType[];
|
||||||
editionDefaults: FieldOptions_EditionDefault[];
|
editionDefaults: FieldOptions_EditionDefault[];
|
||||||
/**
|
/** Any features defined in the specific edition. */
|
||||||
* Any features defined in the specific edition.
|
|
||||||
* WARNING: This field should only be used by protobuf plugins or special
|
|
||||||
* cases like the proto compiler. Other uses are discouraged and
|
|
||||||
* developers should rely on the protoreflect APIs for their client language.
|
|
||||||
*/
|
|
||||||
features?: FeatureSet | undefined;
|
features?: FeatureSet | undefined;
|
||||||
featureSupport?:
|
featureSupport?:
|
||||||
| FieldOptions_FeatureSupport
|
| FieldOptions_FeatureSupport
|
||||||
|
|
@ -1193,7 +1169,11 @@ export function fieldOptions_JSTypeToNumber(object: FieldOptions_JSType): number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */
|
/**
|
||||||
|
* If set to RETENTION_SOURCE, the option will be omitted from the binary.
|
||||||
|
* Note: as of January 2023, support for this is in progress and does not yet
|
||||||
|
* have an effect (b/264593489).
|
||||||
|
*/
|
||||||
export enum FieldOptions_OptionRetention {
|
export enum FieldOptions_OptionRetention {
|
||||||
RETENTION_UNKNOWN = "RETENTION_UNKNOWN",
|
RETENTION_UNKNOWN = "RETENTION_UNKNOWN",
|
||||||
RETENTION_RUNTIME = "RETENTION_RUNTIME",
|
RETENTION_RUNTIME = "RETENTION_RUNTIME",
|
||||||
|
|
@ -1236,7 +1216,8 @@ export function fieldOptions_OptionRetentionToNumber(object: FieldOptions_Option
|
||||||
/**
|
/**
|
||||||
* This indicates the types of entities that the field may apply to when used
|
* This indicates the types of entities that the field may apply to when used
|
||||||
* as an option. If it is unset, then the field may be freely used as an
|
* as an option. If it is unset, then the field may be freely used as an
|
||||||
* option on any kind of entity.
|
* option on any kind of entity. Note: as of January 2023, support for this is
|
||||||
|
* in progress and does not yet have an effect (b/264593489).
|
||||||
*/
|
*/
|
||||||
export enum FieldOptions_OptionTargetType {
|
export enum FieldOptions_OptionTargetType {
|
||||||
TARGET_TYPE_UNKNOWN = "TARGET_TYPE_UNKNOWN",
|
TARGET_TYPE_UNKNOWN = "TARGET_TYPE_UNKNOWN",
|
||||||
|
|
@ -1360,12 +1341,7 @@ export interface FieldOptions_FeatureSupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OneofOptions {
|
export interface OneofOptions {
|
||||||
/**
|
/** Any features defined in the specific edition. */
|
||||||
* Any features defined in the specific edition.
|
|
||||||
* WARNING: This field should only be used by protobuf plugins or special
|
|
||||||
* cases like the proto compiler. Other uses are discouraged and
|
|
||||||
* developers should rely on the protoreflect APIs for their client language.
|
|
||||||
*/
|
|
||||||
features?:
|
features?:
|
||||||
| FeatureSet
|
| FeatureSet
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
@ -1403,12 +1379,7 @@ export interface EnumOptions {
|
||||||
deprecatedLegacyJsonFieldConflicts?:
|
deprecatedLegacyJsonFieldConflicts?:
|
||||||
| boolean
|
| boolean
|
||||||
| undefined;
|
| undefined;
|
||||||
/**
|
/** Any features defined in the specific edition. */
|
||||||
* Any features defined in the specific edition.
|
|
||||||
* WARNING: This field should only be used by protobuf plugins or special
|
|
||||||
* cases like the proto compiler. Other uses are discouraged and
|
|
||||||
* developers should rely on the protoreflect APIs for their client language.
|
|
||||||
*/
|
|
||||||
features?:
|
features?:
|
||||||
| FeatureSet
|
| FeatureSet
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
@ -1426,12 +1397,7 @@ export interface EnumValueOptions {
|
||||||
deprecated?:
|
deprecated?:
|
||||||
| boolean
|
| boolean
|
||||||
| undefined;
|
| undefined;
|
||||||
/**
|
/** Any features defined in the specific edition. */
|
||||||
* Any features defined in the specific edition.
|
|
||||||
* WARNING: This field should only be used by protobuf plugins or special
|
|
||||||
* cases like the proto compiler. Other uses are discouraged and
|
|
||||||
* developers should rely on the protoreflect APIs for their client language.
|
|
||||||
*/
|
|
||||||
features?:
|
features?:
|
||||||
| FeatureSet
|
| FeatureSet
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
@ -1452,12 +1418,7 @@ export interface EnumValueOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ServiceOptions {
|
export interface ServiceOptions {
|
||||||
/**
|
/** Any features defined in the specific edition. */
|
||||||
* Any features defined in the specific edition.
|
|
||||||
* WARNING: This field should only be used by protobuf plugins or special
|
|
||||||
* cases like the proto compiler. Other uses are discouraged and
|
|
||||||
* developers should rely on the protoreflect APIs for their client language.
|
|
||||||
*/
|
|
||||||
features?:
|
features?:
|
||||||
| FeatureSet
|
| FeatureSet
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
@ -1485,12 +1446,7 @@ export interface MethodOptions {
|
||||||
idempotencyLevel?:
|
idempotencyLevel?:
|
||||||
| MethodOptions_IdempotencyLevel
|
| MethodOptions_IdempotencyLevel
|
||||||
| undefined;
|
| undefined;
|
||||||
/**
|
/** Any features defined in the specific edition. */
|
||||||
* Any features defined in the specific edition.
|
|
||||||
* WARNING: This field should only be used by protobuf plugins or special
|
|
||||||
* cases like the proto compiler. Other uses are discouraged and
|
|
||||||
* developers should rely on the protoreflect APIs for their client language.
|
|
||||||
*/
|
|
||||||
features?:
|
features?:
|
||||||
| FeatureSet
|
| FeatureSet
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
@ -1593,7 +1549,6 @@ export interface FeatureSet {
|
||||||
utf8Validation?: FeatureSet_Utf8Validation | undefined;
|
utf8Validation?: FeatureSet_Utf8Validation | undefined;
|
||||||
messageEncoding?: FeatureSet_MessageEncoding | undefined;
|
messageEncoding?: FeatureSet_MessageEncoding | undefined;
|
||||||
jsonFormat?: FeatureSet_JsonFormat | undefined;
|
jsonFormat?: FeatureSet_JsonFormat | undefined;
|
||||||
enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum FeatureSet_FieldPresence {
|
export enum FeatureSet_FieldPresence {
|
||||||
|
|
@ -1836,45 +1791,6 @@ export function featureSet_JsonFormatToNumber(object: FeatureSet_JsonFormat): nu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum FeatureSet_EnforceNamingStyle {
|
|
||||||
ENFORCE_NAMING_STYLE_UNKNOWN = "ENFORCE_NAMING_STYLE_UNKNOWN",
|
|
||||||
STYLE2024 = "STYLE2024",
|
|
||||||
STYLE_LEGACY = "STYLE_LEGACY",
|
|
||||||
UNRECOGNIZED = "UNRECOGNIZED",
|
|
||||||
}
|
|
||||||
|
|
||||||
export function featureSet_EnforceNamingStyleFromJSON(object: any): FeatureSet_EnforceNamingStyle {
|
|
||||||
switch (object) {
|
|
||||||
case 0:
|
|
||||||
case "ENFORCE_NAMING_STYLE_UNKNOWN":
|
|
||||||
return FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN;
|
|
||||||
case 1:
|
|
||||||
case "STYLE2024":
|
|
||||||
return FeatureSet_EnforceNamingStyle.STYLE2024;
|
|
||||||
case 2:
|
|
||||||
case "STYLE_LEGACY":
|
|
||||||
return FeatureSet_EnforceNamingStyle.STYLE_LEGACY;
|
|
||||||
case -1:
|
|
||||||
case "UNRECOGNIZED":
|
|
||||||
default:
|
|
||||||
return FeatureSet_EnforceNamingStyle.UNRECOGNIZED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function featureSet_EnforceNamingStyleToNumber(object: FeatureSet_EnforceNamingStyle): number {
|
|
||||||
switch (object) {
|
|
||||||
case FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN:
|
|
||||||
return 0;
|
|
||||||
case FeatureSet_EnforceNamingStyle.STYLE2024:
|
|
||||||
return 1;
|
|
||||||
case FeatureSet_EnforceNamingStyle.STYLE_LEGACY:
|
|
||||||
return 2;
|
|
||||||
case FeatureSet_EnforceNamingStyle.UNRECOGNIZED:
|
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A compiled specification for the defaults of a set of features. These
|
* A compiled specification for the defaults of a set of features. These
|
||||||
* messages are generated from FeatureSet extensions and can be used to seed
|
* messages are generated from FeatureSet extensions and can be used to seed
|
||||||
|
|
@ -4998,7 +4914,6 @@ function createBaseFeatureSet(): FeatureSet {
|
||||||
utf8Validation: FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN,
|
utf8Validation: FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN,
|
||||||
messageEncoding: FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN,
|
messageEncoding: FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN,
|
||||||
jsonFormat: FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN,
|
jsonFormat: FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN,
|
||||||
enforceNamingStyle: FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5033,12 +4948,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
|
||||||
if (message.jsonFormat !== undefined && message.jsonFormat !== FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN) {
|
if (message.jsonFormat !== undefined && message.jsonFormat !== FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN) {
|
||||||
writer.uint32(48).int32(featureSet_JsonFormatToNumber(message.jsonFormat));
|
writer.uint32(48).int32(featureSet_JsonFormatToNumber(message.jsonFormat));
|
||||||
}
|
}
|
||||||
if (
|
|
||||||
message.enforceNamingStyle !== undefined &&
|
|
||||||
message.enforceNamingStyle !== FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN
|
|
||||||
) {
|
|
||||||
writer.uint32(56).int32(featureSet_EnforceNamingStyleToNumber(message.enforceNamingStyle));
|
|
||||||
}
|
|
||||||
return writer;
|
return writer;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -5097,14 +5006,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
|
||||||
message.jsonFormat = featureSet_JsonFormatFromJSON(reader.int32());
|
message.jsonFormat = featureSet_JsonFormatFromJSON(reader.int32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 7: {
|
|
||||||
if (tag !== 56) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
message.enforceNamingStyle = featureSet_EnforceNamingStyleFromJSON(reader.int32());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ((tag & 7) === 4 || tag === 0) {
|
if ((tag & 7) === 4 || tag === 0) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -5126,8 +5027,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
|
||||||
message.utf8Validation = object.utf8Validation ?? FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN;
|
message.utf8Validation = object.utf8Validation ?? FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN;
|
||||||
message.messageEncoding = object.messageEncoding ?? FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN;
|
message.messageEncoding = object.messageEncoding ?? FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN;
|
||||||
message.jsonFormat = object.jsonFormat ?? FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN;
|
message.jsonFormat = object.jsonFormat ?? FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN;
|
||||||
message.enforceNamingStyle = object.enforceNamingStyle ??
|
|
||||||
FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN;
|
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue