Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: totally migrate to cel batch api (#8500)
ecmadaod5792275e86c
diff --git a/backend/api/v1/cel_service.go b/backend/api/v1/cel_service.goindex 256169a2f7..3e83edc68f 100644--- a/backend/api/v1/cel_service.go+++ b/backend/api/v1/cel_service.go@@ -22,25 +22,6 @@ func NewCelService() *CelService {return &CelService{}}-// Parse parses a CEL expression.-func (*CelService) Parse(_ context.Context, request *v1pb.ParseRequest) (*v1pb.ParseResponse, error) {- e, err := cel.NewEnv(common.QueryExportPolicyCELAttributes...)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to create CEL environment: %v", err)- }- ast, issues := e.Parse(request.Expression)- if issues != nil && issues.Err() != nil {- return nil, status.Errorf(codes.InvalidArgument, "failed to parse expression: %v", issues.Err())- }- expr, err := cel.AstToParsedExpr(ast)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to convert ast to parsed expression: %v", err)- }- return &v1pb.ParseResponse{- Expression: expr,- }, nil-}-// Parse parses a CEL expression.func (*CelService) BatchParse(_ context.Context, request *v1pb.BatchParseRequest) (*v1pb.BatchParseResponse, error) {e, err := cel.NewEnv(common.QueryExportPolicyCELAttributes...)@@ -62,18 +43,6 @@ func (*CelService) BatchParse(_ context.Context, request *v1pb.BatchParseRequestreturn resp, nil}-// Deparse deparses a parsed CEL expression.-func (*CelService) Deparse(_ context.Context, request *v1pb.DeparseRequest) (*v1pb.DeparseResponse, error) {- ast := cel.ParsedExprToAst(request.Expression)- expressionStr, err := cel.AstToString(ast)- if err != nil {- return nil, status.Errorf(codes.InvalidArgument, "failed to deparse expression: %v", err)- }- return &v1pb.DeparseResponse{- Expression: expressionStr,- }, nil-}-// Deparse deparses a parsed CEL expression.func (*CelService) BatchDeparse(_ context.Context, request *v1pb.BatchDeparseRequest) (*v1pb.BatchDeparseResponse, error) {resp := &v1pb.BatchDeparseResponse{}diff --git a/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskDialog/RiskForm.vue b/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskDialog/RiskForm.vueindex 4ed5117992..5530b06b26 100644--- a/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskDialog/RiskForm.vue+++ b/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskDialog/RiskForm.vue@@ -110,8 +110,8 @@ import {import { Expr } from "@/types/proto/google/type/expr";import { Risk } from "@/types/proto/v1/risk_service";import {- convertCELStringToParsedExpr,- convertParsedExprToCELString,+ batchConvertCELStringToParsedExpr,+ batchConvertParsedExprToCELString,} from "@/utils";import {getFactorList,@@ -149,12 +149,18 @@ const mode = computed(() => context.dialog.value?.mode ?? "CREATE");const resolveLocalState = async () => {const risk = cloneDeep(context.dialog.value!.risk);- const parsedExpr = await convertCELStringToParsedExpr(- risk.condition?.expression ?? ""- );++ let expr = CELExpr.fromJSON({});+ if (risk.condition?.expression) {+ const parsedExprs = await batchConvertCELStringToParsedExpr([+ risk.condition.expression,+ ]);+ expr = parsedExprs[0].expr ?? CELExpr.fromJSON({});+ }+state.value = {risk,- expr: wrapAsGroup(resolveCELExpr(parsedExpr.expr ?? CELExpr.fromJSON({}))),+ expr: wrapAsGroup(resolveCELExpr(expr)),};};@@ -183,13 +189,13 @@ const handleUpsert = async () => {const risk = cloneDeep(state.value.risk);- const expression = await convertParsedExprToCELString(+ const expressions = await batchConvertParsedExprToCELString([ParsedExpr.fromJSON({expr: buildCELExpr(state.value.expr),- })- );+ }),+ ]);risk.condition = Expr.fromJSON({- expression,+ expression: expressions[0],});emit("save", risk);};diff --git a/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskDialog/RuleTemplateTable.vue b/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskDialog/RuleTemplateTable.vueindex 9d7e7edd73..4795f0217f 100644--- a/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskDialog/RuleTemplateTable.vue+++ b/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskDialog/RuleTemplateTable.vue@@ -50,7 +50,7 @@ import { buildCELExpr, ConditionGroupExpr } from "@/plugins/cel";import { ParsedExpr } from "@/types/proto/google/api/expr/v1alpha1/syntax";import { Expr } from "@/types/proto/google/type/expr";import { Risk, Risk_Source } from "@/types/proto/v1/risk_service";-import { convertParsedExprToCELString, defer } from "@/utils";+import { batchConvertParsedExprToCELString, defer } from "@/utils";import { useRiskCenterContext } from "../context";import ViewTemplate from "./ViewTemplate.vue";import {@@ -133,13 +133,13 @@ const applyTemplate = async (template: RuleTemplate) => {const { expr, source, level } = template;const title = titleOfTemplate(template);const { mode } = dialog.value!;- const expression = await convertParsedExprToCELString(+ const expressions = await batchConvertParsedExprToCELString([ParsedExpr.fromJSON({expr: buildCELExpr(expr),- })- );+ }),+ ]);const overrides: Partial<Risk> = {- condition: Expr.fromJSON({ expression }),+ condition: Expr.fromJSON({ expression: expressions[0] }),level,title,};diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vueindex 7606df6fdb..a7e145ddb5 100644--- a/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue@@ -61,7 +61,7 @@ import {import { ParsedExpr } from "@/types/proto/google/api/expr/v1alpha1/syntax";import { Expr } from "@/types/proto/google/type/expr";import { DatabaseGroup, SchemaGroup } from "@/types/proto/v1/project_service";-import { convertParsedExprToCELString, projectV1Slug } from "@/utils";+import { batchConvertParsedExprToCELString, projectV1Slug } from "@/utils";import { buildDatabaseGroupExpr } from "@/utils/databaseGroup/cel";import DatabaseGroupForm from "./DatabaseGroupForm.vue";import { ResourceType } from "./common/ExprEditor/context";@@ -206,7 +206,7 @@ const doConfirm = async () => {const environment = environmentStore.getEnvironmentByUID(formState.environmentId || "");- const celString = await convertParsedExprToCELString(+ const celStrings = await batchConvertParsedExprToCELString([ParsedExpr.fromJSON({expr: buildCELExpr(buildDatabaseGroupExpr({@@ -214,8 +214,8 @@ const doConfirm = async () => {conditionGroupExpr: formState.expr,})),- })- );+ }),+ ]);const resourceId = formState.resourceId;await dbGroupStore.createDatabaseGroup({projectName: props.project.name,@@ -223,7 +223,7 @@ const doConfirm = async () => {name: `${props.project.name}/databaseGroups/${resourceId}`,databasePlaceholder: formState.placeholder,databaseExpr: Expr.fromJSON({- expression: celString || "true",+ expression: celStrings[0] || "true",}),},databaseGroupId: resourceId,@@ -232,7 +232,7 @@ const doConfirm = async () => {const environment = environmentStore.getEnvironmentByUID(formState.environmentId || "");- const celString = await convertParsedExprToCELString(+ const celStrings = await batchConvertParsedExprToCELString([ParsedExpr.fromJSON({expr: buildCELExpr(buildDatabaseGroupExpr({@@ -240,13 +240,13 @@ const doConfirm = async () => {conditionGroupExpr: formState.expr,})),- })- );+ }),+ ]);await dbGroupStore.updateDatabaseGroup({...props.databaseGroup!,databasePlaceholder: formState.placeholder,databaseExpr: Expr.fromJSON({- expression: celString,+ expression: celStrings[0],}),});}@@ -256,11 +256,11 @@ const doConfirm = async () => {return;}- const celString = await convertParsedExprToCELString(+ const celStrings = await batchConvertParsedExprToCELString([ParsedExpr.fromJSON({expr: buildCELExpr(formState.expr),- })- );+ }),+ ]);const resourceId = formState.resourceId;await dbGroupStore.createSchemaGroup({dbGroupName: formState.selectedDatabaseGroupId,@@ -268,22 +268,22 @@ const doConfirm = async () => {name: `${formState.selectedDatabaseGroupId}/schemaGroups/${resourceId}`,tablePlaceholder: formState.placeholder,tableExpr: Expr.fromJSON({- expression: celString || "true",+ expression: celStrings[0] || "true",}),},schemaGroupId: resourceId,});} else {- const celString = await convertParsedExprToCELString(+ const celStrings = await batchConvertParsedExprToCELString([ParsedExpr.fromJSON({expr: buildCELExpr(formState.expr),- })- );+ }),+ ]);await dbGroupStore.updateSchemaGroup({...props.databaseGroup!,tablePlaceholder: formState.placeholder,tableExpr: Expr.fromJSON({- expression: celString,+ expression: celStrings[0],}),});}diff --git a/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue b/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vueindex 529c55f3e4..828bf64768 100644--- a/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue+++ b/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue@@ -92,8 +92,8 @@ import { Expr } from "@/types/proto/google/type/expr";import { MaskingLevel, maskingLevelToJSON } from "@/types/proto/v1/common";import { MaskingRulePolicy_MaskingRule } from "@/types/proto/v1/org_policy_service";import {- convertCELStringToParsedExpr,- convertParsedExprToCELString,+ batchConvertCELStringToParsedExpr,+ batchConvertParsedExprToCELString,} from "@/utils";import { factorSupportDropdown, factorOperatorOverrideMap } from "./utils";@@ -129,15 +129,17 @@ const state = reactive<LocalState>({});const resetLocalState = async (rule: MaskingRulePolicy_MaskingRule) => {- const parsedExpr = await convertCELStringToParsedExpr(- rule.condition?.expression ?? ""- );+ let expr = CELExpr.fromJSON({});+ if (rule.condition?.expression) {+ const parsedExprs = await batchConvertCELStringToParsedExpr([+ rule.condition.expression,+ ]);+ expr = parsedExprs[0].expr ?? CELExpr.fromJSON({});+ }state.dirty = false;state.title = rule.condition?.title ?? "";- state.expr = wrapAsGroup(- resolveCELExpr(parsedExpr.expr ?? CELExpr.fromJSON({}))- );+ state.expr = wrapAsGroup(resolveCELExpr(expr));state.maskingLevel = rule.maskingLevel;};@@ -179,16 +181,16 @@ const isValid = computed(() => {});const onConfirm = async () => {- const expression = await convertParsedExprToCELString(+ const expressions = await batchConvertParsedExprToCELString([ParsedExpr.fromJSON({expr: buildCELExpr(state.expr),- })- );+ }),+ ]);emit("confirm", {...props.maskingRule,maskingLevel: state.maskingLevel,condition: Expr.fromJSON({- expression,+ expression: expressions[0],title: state.title,}),});diff --git a/frontend/src/store/modules/dbGroup.ts b/frontend/src/store/modules/dbGroup.tsindex aedd6399d3..6a2d50dc6d 100644--- a/frontend/src/store/modules/dbGroup.ts+++ b/frontend/src/store/modules/dbGroup.ts@@ -21,7 +21,7 @@ import { Expr } from "@/types/proto/google/type/expr";import { Environment } from "@/types/proto/v1/environment_service";import { DatabaseGroup, SchemaGroup } from "@/types/proto/v1/project_service";import {- convertParsedExprToCELString,+ batchConvertParsedExprToCELString,batchConvertCELStringToParsedExpr,} from "@/utils";import { getEnvironmentIdAndConditionExpr } from "@/utils/databaseGroup/cel";@@ -232,7 +232,7 @@ export const useDBGroupStore = defineStore("db-group", () => {const environment =useEnvironmentV1Store().getEnvironmentByUID(environmentId);- const celString = await convertParsedExprToCELString(+ const celStrings = await batchConvertParsedExprToCELString([ParsedExpr.fromJSON({expr: buildCELExpr(buildDatabaseGroupExpr({@@ -240,8 +240,8 @@ export const useDBGroupStore = defineStore("db-group", () => {conditionGroupExpr: expr,})),- })- );+ }),+ ]);const validateOnlyResourceId = `creating-database-group-${Date.now()}`;@@ -251,7 +251,7 @@ export const useDBGroupStore = defineStore("db-group", () => {name: `${projectName}/${databaseGroupNamePrefix}${validateOnlyResourceId}`,databasePlaceholder: validateOnlyResourceId,databaseExpr: Expr.fromJSON({- expression: celString,+ expression: celStrings[0],}),},databaseGroupId: validateOnlyResourceId,@@ -408,11 +408,11 @@ export const useDBGroupStore = defineStore("db-group", () => {databaseGroupName: string;expr: ConditionGroupExpr;}) => {- const celString = await convertParsedExprToCELString(+ const celStrings = await batchConvertParsedExprToCELString([ParsedExpr.fromJSON({expr: buildCELExpr(expr),- })- );+ }),+ ]);const validateOnlyResourceId = `creating-schema-group-${Date.now()}`;const parent = `${projectName}/${databaseGroupNamePrefix}${databaseGroupName}`;@@ -423,7 +423,7 @@ export const useDBGroupStore = defineStore("db-group", () => {name: `${databaseGroupName}/${schemaGroupNamePrefix}${validateOnlyResourceId}`,tablePlaceholder: validateOnlyResourceId,tableExpr: Expr.fromJSON({- expression: celString || "true",+ expression: celStrings[0] || "true",}),},schemaGroupId: validateOnlyResourceId,diff --git a/frontend/src/types/proto/v1/cel_service.ts b/frontend/src/types/proto/v1/cel_service.tsindex afbd642f41..e120914403 100644--- a/frontend/src/types/proto/v1/cel_service.ts+++ b/frontend/src/types/proto/v1/cel_service.ts@@ -4,94 +4,22 @@ import { ParsedExpr } from "../google/api/expr/v1alpha1/syntax";export const protobufPackage = "bytebase.v1";-export interface ParseRequest {- expression: string;-}-export interface BatchParseRequest {expressions: string[];}-export interface ParseResponse {- expression: ParsedExpr | undefined;-}-export interface BatchParseResponse {expressions: ParsedExpr[];}-export interface DeparseRequest {- expression: ParsedExpr | undefined;-}-export interface BatchDeparseRequest {expressions: ParsedExpr[];}-export interface DeparseResponse {- expression: string;-}-export interface BatchDeparseResponse {expressions: string[];}-function createBaseParseRequest(): ParseRequest {- return { expression: "" };-}--export const ParseRequest = {- encode(message: ParseRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- if (message.expression !== "") {- writer.uint32(10).string(message.expression);- }- return writer;- },-- decode(input: _m0.Reader | Uint8Array, length?: number): ParseRequest {- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseParseRequest();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1:- if (tag !== 10) {- break;- }-- message.expression = reader.string();- continue;- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skipType(tag & 7);- }- return message;- },-- fromJSON(object: any): ParseRequest {- return { expression: isSet(object.expression) ? String(object.expression) : "" };- },-- toJSON(message: ParseRequest): unknown {- const obj: any = {};- message.expression !== undefined && (obj.expression = message.expression);- return obj;- },-- create(base?: DeepPartial<ParseRequest>): ParseRequest {- return ParseRequest.fromPartial(base ?? {});- },-- fromPartial(object: DeepPartial<ParseRequest>): ParseRequest {- const message = createBaseParseRequest();- message.expression = object.expression ?? "";- return message;- },-};-function createBaseBatchParseRequest(): BatchParseRequest {return { expressions: [] };}@@ -152,65 +80,6 @@ export const BatchParseRequest = {},};-function createBaseParseResponse(): ParseResponse {- return { expression: undefined };-}--export const ParseResponse = {- encode(message: ParseResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- if (message.expression !== undefined) {- ParsedExpr.encode(message.expression, writer.uint32(10).fork()).ldelim();- }- return writer;- },-- decode(input: _m0.Reader | Uint8Array, length?: number): ParseResponse {- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseParseResponse();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1:- if (tag !== 10) {- break;- }-- message.expression = ParsedExpr.decode(reader, reader.uint32());- continue;- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skipType(tag & 7);- }- return message;- },-- fromJSON(object: any): ParseResponse {- return { expression: isSet(object.expression) ? ParsedExpr.fromJSON(object.expression) : undefined };- },-- toJSON(message: ParseResponse): unknown {- const obj: any = {};- message.expression !== undefined &&- (obj.expression = message.expression ? ParsedExpr.toJSON(message.expression) : undefined);- return obj;- },-- create(base?: DeepPartial<ParseResponse>): ParseResponse {- return ParseResponse.fromPartial(base ?? {});- },-- fromPartial(object: DeepPartial<ParseResponse>): ParseResponse {- const message = createBaseParseResponse();- message.expression = (object.expression !== undefined && object.expression !== null)- ? ParsedExpr.fromPartial(object.expression)- : undefined;- return message;- },-};-function createBaseBatchParseResponse(): BatchParseResponse {return { expressions: [] };}@@ -273,65 +142,6 @@ export const BatchParseResponse = {},};-function createBaseDeparseRequest(): DeparseRequest {- return { expression: undefined };-}--export const DeparseRequest = {- encode(message: DeparseRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- if (message.expression !== undefined) {- ParsedExpr.encode(message.expression, writer.uint32(10).fork()).ldelim();- }- return writer;- },-- decode(input: _m0.Reader | Uint8Array, length?: number): DeparseRequest {- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseDeparseRequest();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1:- if (tag !== 10) {- break;- }-- message.expression = ParsedExpr.decode(reader, reader.uint32());- continue;- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skipType(tag & 7);- }- return message;- },-- fromJSON(object: any): DeparseRequest {- return { expression: isSet(object.expression) ? ParsedExpr.fromJSON(object.expression) : undefined };- },-- toJSON(message: DeparseRequest): unknown {- const obj: any = {};- message.expression !== undefined &&- (obj.expression = message.expression ? ParsedExpr.toJSON(message.expression) : undefined);- return obj;- },-- create(base?: DeepPartial<DeparseRequest>): DeparseRequest {- return DeparseRequest.fromPartial(base ?? {});- },-- fromPartial(object: DeepPartial<DeparseRequest>): DeparseRequest {- const message = createBaseDeparseRequest();- message.expression = (object.expression !== undefined && object.expression !== null)- ? ParsedExpr.fromPartial(object.expression)- : undefined;- return message;- },-};-function createBaseBatchDeparseRequest(): BatchDeparseRequest {return { expressions: [] };}@@ -394,62 +204,6 @@ export const BatchDeparseRequest = {},};-function createBaseDeparseResponse(): DeparseResponse {- return { expression: "" };-}--export const DeparseResponse = {- encode(message: DeparseResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- if (message.expression !== "") {- writer.uint32(10).string(message.expression);- }- return writer;- },-- decode(input: _m0.Reader | Uint8Array, length?: number): DeparseResponse {- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseDeparseResponse();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1:- if (tag !== 10) {- break;- }-- message.expression = reader.string();- continue;- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skipType(tag & 7);- }- return message;- },-- fromJSON(object: any): DeparseResponse {- return { expression: isSet(object.expression) ? String(object.expression) : "" };- },-- toJSON(message: DeparseResponse): unknown {- const obj: any = {};- message.expression !== undefined && (obj.expression = message.expression);- return obj;- },-- create(base?: DeepPartial<DeparseResponse>): DeparseResponse {- return DeparseResponse.fromPartial(base ?? {});- },-- fromPartial(object: DeepPartial<DeparseResponse>): DeparseResponse {- const message = createBaseDeparseResponse();- message.expression = object.expression ?? "";- return message;- },-};-function createBaseBatchDeparseResponse(): BatchDeparseResponse {return { expressions: [] };}@@ -515,20 +269,6 @@ export const CelServiceDefinition = {name: "CelService",fullName: "bytebase.v1.CelService",methods: {- parse: {- name: "Parse",- requestType: ParseRequest,- requestStream: false,- responseType: ParseResponse,- responseStream: false,- options: {- _unknownFields: {- 578365826: [- new Uint8Array([18, 58, 1, 42, 34, 13, 47, 118, 49, 47, 99, 101, 108, 47, 112, 97, 114, 115, 101]),- ],- },- },- },batchParse: {name: "BatchParse",requestType: BatchParseRequest,@@ -568,42 +308,6 @@ export const CelServiceDefinition = {},},},- deparse: {- name: "Deparse",- requestType: DeparseRequest,- requestStream: false,- responseType: DeparseResponse,- responseStream: false,- options: {- _unknownFields: {- 578365826: [- new Uint8Array([- 20,- 58,- 1,- 42,- 34,- 15,- 47,- 118,- 49,- 47,- 99,- 101,- 108,- 47,- 100,- 101,- 112,- 97,- 114,- 115,- 101,- ]),- ],- },- },- },batchDeparse: {name: "BatchDeparse",requestType: BatchDeparseRequest,@@ -654,7 +358,3 @@ export type DeepPartial<T> = T extends Builtin ? T: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }: Partial<T>;--function isSet(value: any): boolean {- return value !== null && value !== undefined;-}diff --git a/frontend/src/utils/databaseGroup/cel.ts b/frontend/src/utils/databaseGroup/cel.tsindex 5a64c791e0..600b105616 100644--- a/frontend/src/utils/databaseGroup/cel.ts+++ b/frontend/src/utils/databaseGroup/cel.ts@@ -5,7 +5,8 @@ import {resolveCELExpr,wrapAsGroup,} from "@/plugins/cel";-import { convertCELStringToParsedExpr } from "@/utils";+import { Expr } from "@/types/proto/google/api/expr/v1alpha1/syntax";+import { batchConvertCELStringToParsedExpr } from "@/utils";interface DatabaseGroupExpr {environmentId: string;@@ -37,13 +38,17 @@ export const buildDatabaseGroupExpr = (};export const convertCELStringToExpr = async (cel: string) => {- const celExpr = await convertCELStringToParsedExpr(cel);+ let expr: Expr | undefined;+ if (cel) {+ const celExpr = await batchConvertCELStringToParsedExpr([cel]);+ expr = celExpr[0].expr;+ }- if (!celExpr || !celExpr.expr) {+ if (!expr) {return emptySimpleExpr();}- return wrapAsGroup(resolveCELExpr(celExpr.expr));+ return wrapAsGroup(resolveCELExpr(expr));};export const getEnvironmentIdAndConditionExpr = (diff --git a/frontend/src/utils/issue/cel.ts b/frontend/src/utils/issue/cel.tsindex 5a3b3db951..b140dfc593 100644--- a/frontend/src/utils/issue/cel.ts+++ b/frontend/src/utils/issue/cel.ts@@ -1,8 +1,8 @@import { cloneDeep, last } from "lodash-es";-import { celServiceClient } from "@/grpcweb";import { SimpleExpr, resolveCELExpr } from "@/plugins/cel";import { DatabaseResource } from "@/types";import { Expr } from "@/types/proto/google/api/expr/v1alpha1/syntax";+import { batchConvertCELStringToParsedExpr } from "@/utils";interface DatabaseLevelCondition {database: string[];@@ -168,20 +168,17 @@ const convertToCELString = (export const convertFromCELString = async (cel: string): Promise<ConditionExpression> => {- const { expression: celExpr } = await celServiceClient.parse(- {- expression: cel,- },- {- silent: true,- }- );+ let expr: Expr | undefined;+ if (cel) {+ const celExpr = await batchConvertCELStringToParsedExpr([cel]);+ expr = celExpr[0].expr;+ }- if (!celExpr || !celExpr.expr) {+ if (!expr) {return {};}- const simpleExpr = resolveCELExpr(celExpr.expr);+ const simpleExpr = resolveCELExpr(expr);const conditionExpression: ConditionExpression = {databaseResources: [],};diff --git a/frontend/src/utils/v1/cel.ts b/frontend/src/utils/v1/cel.tsindex 1b55632e1e..0ca6c1ef2b 100644--- a/frontend/src/utils/v1/cel.ts+++ b/frontend/src/utils/v1/cel.ts@@ -39,45 +39,3 @@ export const batchConvertParsedExprToCELString = async (return Array.from({ length: parsedExprList.length }).map((_) => "");}};--export const convertCELStringToParsedExpr = async (- cel: string-): Promise<ParsedExpr> => {- if (cel === "") {- return ParsedExpr.fromJSON({});- }-- try {- const response = await celServiceClient.parse(- {- expression: cel,- },- {- silent: true,- }- );-- return response.expression ?? ParsedExpr.fromJSON({});- } catch (error) {- console.error(error);- return ParsedExpr.fromJSON({});- }-};--export const convertParsedExprToCELString = async (- parsedExpr: ParsedExpr-): Promise<string> => {- if (!parsedExpr.expr) return "";- try {- const response = await celServiceClient.deparse(- {- expression: parsedExpr,- },- { silent: true }- );- return response.expression;- } catch (error) {- console.error(error);- return "";- }-};diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex f98925fe19..c8e919f7da 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -109,10 +109,6 @@- [BatchDeparseResponse](#bytebase-v1-BatchDeparseResponse)- [BatchParseRequest](#bytebase-v1-BatchParseRequest)- [BatchParseResponse](#bytebase-v1-BatchParseResponse)- - [DeparseRequest](#bytebase-v1-DeparseRequest)- - [DeparseResponse](#bytebase-v1-DeparseResponse)- - [ParseRequest](#bytebase-v1-ParseRequest)- - [ParseResponse](#bytebase-v1-ParseResponse)- [CelService](#bytebase-v1-CelService)@@ -2095,66 +2091,6 @@ When paginating, all other parameters provided to `ListBookmarks` must match the--<a name="bytebase-v1-DeparseRequest"></a>--### DeparseRequest----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| expression | [google.api.expr.v1alpha1.ParsedExpr](#google-api-expr-v1alpha1-ParsedExpr) | | |-------<a name="bytebase-v1-DeparseResponse"></a>--### DeparseResponse----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| expression | [string](#string) | | |-------<a name="bytebase-v1-ParseRequest"></a>--### ParseRequest----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| expression | [string](#string) | | |-------<a name="bytebase-v1-ParseResponse"></a>--### ParseResponse----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| expression | [google.api.expr.v1alpha1.ParsedExpr](#google-api-expr-v1alpha1-ParsedExpr) | | |-----@@ -2169,9 +2105,7 @@ When paginating, all other parameters provided to `ListBookmarks` must match the| Method Name | Request Type | Response Type | Description || ----------- | ------------ | ------------- | ------------|-| Parse | [ParseRequest](#bytebase-v1-ParseRequest) | [ParseResponse](#bytebase-v1-ParseResponse) | || BatchParse | [BatchParseRequest](#bytebase-v1-BatchParseRequest) | [BatchParseResponse](#bytebase-v1-BatchParseResponse) | |-| Deparse | [DeparseRequest](#bytebase-v1-DeparseRequest) | [DeparseResponse](#bytebase-v1-DeparseResponse) | || BatchDeparse | [BatchDeparseRequest](#bytebase-v1-BatchDeparseRequest) | [BatchDeparseResponse](#bytebase-v1-BatchDeparseResponse) | |diff --git a/proto/generated-go/v1/cel_service.pb.go b/proto/generated-go/v1/cel_service.pb.goindex 4cf085f1c9..331d2332cd 100644--- a/proto/generated-go/v1/cel_service.pb.go+++ b/proto/generated-go/v1/cel_service.pb.go@@ -22,53 +22,6 @@ const (_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20))-type ParseRequest struct {- state protoimpl.MessageState- sizeCache protoimpl.SizeCache- unknownFields protoimpl.UnknownFields-- Expression string `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`-}--func (x *ParseRequest) Reset() {- *x = ParseRequest{}- if protoimpl.UnsafeEnabled {- mi := &file_v1_cel_service_proto_msgTypes[0]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)- }-}--func (x *ParseRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ParseRequest) ProtoMessage() {}--func (x *ParseRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_cel_service_proto_msgTypes[0]- if protoimpl.UnsafeEnabled && x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use ParseRequest.ProtoReflect.Descriptor instead.-func (*ParseRequest) Descriptor() ([]byte, []int) {- return file_v1_cel_service_proto_rawDescGZIP(), []int{0}-}--func (x *ParseRequest) GetExpression() string {- if x != nil {- return x.Expression- }- return ""-}-type BatchParseRequest struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -80,7 +33,7 @@ type BatchParseRequest struct {func (x *BatchParseRequest) Reset() {*x = BatchParseRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_cel_service_proto_msgTypes[1]+ mi := &file_v1_cel_service_proto_msgTypes[0]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -93,7 +46,7 @@ func (x *BatchParseRequest) String() string {func (*BatchParseRequest) ProtoMessage() {}func (x *BatchParseRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_cel_service_proto_msgTypes[1]+ mi := &file_v1_cel_service_proto_msgTypes[0]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -106,7 +59,7 @@ func (x *BatchParseRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use BatchParseRequest.ProtoReflect.Descriptor instead.func (*BatchParseRequest) Descriptor() ([]byte, []int) {- return file_v1_cel_service_proto_rawDescGZIP(), []int{1}+ return file_v1_cel_service_proto_rawDescGZIP(), []int{0}}func (x *BatchParseRequest) GetExpressions() []string {@@ -116,53 +69,6 @@ func (x *BatchParseRequest) GetExpressions() []string {return nil}-type ParseResponse struct {- state protoimpl.MessageState- sizeCache protoimpl.SizeCache- unknownFields protoimpl.UnknownFields-- Expression *v1alpha1.ParsedExpr `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`-}--func (x *ParseResponse) Reset() {- *x = ParseResponse{}- if protoimpl.UnsafeEnabled {- mi := &file_v1_cel_service_proto_msgTypes[2]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)- }-}--func (x *ParseResponse) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ParseResponse) ProtoMessage() {}--func (x *ParseResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_cel_service_proto_msgTypes[2]- if protoimpl.UnsafeEnabled && x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use ParseResponse.ProtoReflect.Descriptor instead.-func (*ParseResponse) Descriptor() ([]byte, []int) {- return file_v1_cel_service_proto_rawDescGZIP(), []int{2}-}--func (x *ParseResponse) GetExpression() *v1alpha1.ParsedExpr {- if x != nil {- return x.Expression- }- return nil-}-type BatchParseResponse struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -174,7 +80,7 @@ type BatchParseResponse struct {func (x *BatchParseResponse) Reset() {*x = BatchParseResponse{}if protoimpl.UnsafeEnabled {- mi := &file_v1_cel_service_proto_msgTypes[3]+ mi := &file_v1_cel_service_proto_msgTypes[1]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -187,7 +93,7 @@ func (x *BatchParseResponse) String() string {func (*BatchParseResponse) ProtoMessage() {}func (x *BatchParseResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_cel_service_proto_msgTypes[3]+ mi := &file_v1_cel_service_proto_msgTypes[1]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -200,7 +106,7 @@ func (x *BatchParseResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use BatchParseResponse.ProtoReflect.Descriptor instead.func (*BatchParseResponse) Descriptor() ([]byte, []int) {- return file_v1_cel_service_proto_rawDescGZIP(), []int{3}+ return file_v1_cel_service_proto_rawDescGZIP(), []int{1}}func (x *BatchParseResponse) GetExpressions() []*v1alpha1.ParsedExpr {@@ -210,53 +116,6 @@ func (x *BatchParseResponse) GetExpressions() []*v1alpha1.ParsedExpr {return nil}-type DeparseRequest struct {- state protoimpl.MessageState- sizeCache protoimpl.SizeCache- unknownFields protoimpl.UnknownFields-- Expression *v1alpha1.ParsedExpr `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`-}--func (x *DeparseRequest) Reset() {- *x = DeparseRequest{}- if protoimpl.UnsafeEnabled {- mi := &file_v1_cel_service_proto_msgTypes[4]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)- }-}--func (x *DeparseRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*DeparseRequest) ProtoMessage() {}--func (x *DeparseRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_cel_service_proto_msgTypes[4]- if protoimpl.UnsafeEnabled && x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use DeparseRequest.ProtoReflect.Descriptor instead.-func (*DeparseRequest) Descriptor() ([]byte, []int) {- return file_v1_cel_service_proto_rawDescGZIP(), []int{4}-}--func (x *DeparseRequest) GetExpression() *v1alpha1.ParsedExpr {- if x != nil {- return x.Expression- }- return nil-}-type BatchDeparseRequest struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -268,7 +127,7 @@ type BatchDeparseRequest struct {func (x *BatchDeparseRequest) Reset() {*x = BatchDeparseRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_cel_service_proto_msgTypes[5]+ mi := &file_v1_cel_service_proto_msgTypes[2]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -281,7 +140,7 @@ func (x *BatchDeparseRequest) String() string {func (*BatchDeparseRequest) ProtoMessage() {}func (x *BatchDeparseRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_cel_service_proto_msgTypes[5]+ mi := &file_v1_cel_service_proto_msgTypes[2]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -294,7 +153,7 @@ func (x *BatchDeparseRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use BatchDeparseRequest.ProtoReflect.Descriptor instead.func (*BatchDeparseRequest) Descriptor() ([]byte, []int) {- return file_v1_cel_service_proto_rawDescGZIP(), []int{5}+ return file_v1_cel_service_proto_rawDescGZIP(), []int{2}}func (x *BatchDeparseRequest) GetExpressions() []*v1alpha1.ParsedExpr {@@ -304,53 +163,6 @@ func (x *BatchDeparseRequest) GetExpressions() []*v1alpha1.ParsedExpr {return nil}-type DeparseResponse struct {- state protoimpl.MessageState- sizeCache protoimpl.SizeCache- unknownFields protoimpl.UnknownFields-- Expression string `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`-}--func (x *DeparseResponse) Reset() {- *x = DeparseResponse{}- if protoimpl.UnsafeEnabled {- mi := &file_v1_cel_service_proto_msgTypes[6]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)- }-}--func (x *DeparseResponse) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*DeparseResponse) ProtoMessage() {}--func (x *DeparseResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_cel_service_proto_msgTypes[6]- if protoimpl.UnsafeEnabled && x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use DeparseResponse.ProtoReflect.Descriptor instead.-func (*DeparseResponse) Descriptor() ([]byte, []int) {- return file_v1_cel_service_proto_rawDescGZIP(), []int{6}-}--func (x *DeparseResponse) GetExpression() string {- if x != nil {- return x.Expression- }- return ""-}-type BatchDeparseResponse struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -362,7 +174,7 @@ type BatchDeparseResponse struct {func (x *BatchDeparseResponse) Reset() {*x = BatchDeparseResponse{}if protoimpl.UnsafeEnabled {- mi := &file_v1_cel_service_proto_msgTypes[7]+ mi := &file_v1_cel_service_proto_msgTypes[3]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -375,7 +187,7 @@ func (x *BatchDeparseResponse) String() string {func (*BatchDeparseResponse) ProtoMessage() {}func (x *BatchDeparseResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_cel_service_proto_msgTypes[7]+ mi := &file_v1_cel_service_proto_msgTypes[3]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -388,7 +200,7 @@ func (x *BatchDeparseResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use BatchDeparseResponse.ProtoReflect.Descriptor instead.func (*BatchDeparseResponse) Descriptor() ([]byte, []int) {- return file_v1_cel_service_proto_rawDescGZIP(), []int{7}+ return file_v1_cel_service_proto_rawDescGZIP(), []int{3}}func (x *BatchDeparseResponse) GetExpressions() []string {@@ -407,72 +219,43 @@ var file_v1_cel_service_proto_rawDesc = []byte{0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,0x6f, 0x1a, 0x25, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x78,0x70, 0x72, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x73, 0x79, 0x6e, 0x74,- 0x61, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2e, 0x0a, 0x0c, 0x50, 0x61, 0x72, 0x73,- 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72,- 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78,- 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x35, 0x0a, 0x11, 0x42, 0x61, 0x74, 0x63,+ 0x61, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x11, 0x42, 0x61, 0x74, 0x63,0x68, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a,0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03,0x28, 0x09, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22,- 0x55, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,- 0x12, 0x44, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01,- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70,- 0x69, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e,- 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72,- 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x12, 0x42, 0x61, 0x74, 0x63, 0x68, 0x50,- 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0b,- 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,- 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x65,- 0x78, 0x70, 0x72, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72,- 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73,- 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x56, 0x0a, 0x0e, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52,- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73,- 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f,+ 0x5c, 0x0a, 0x12, 0x42, 0x61, 0x74, 0x63, 0x68, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73,+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73,+ 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f,0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x76, 0x31, 0x61,0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72,- 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5d, 0x0a, 0x13,- 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75,- 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f,- 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,- 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70,- 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x52, 0x0b,- 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x31, 0x0a, 0x0f, 0x44,- 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e,- 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01,- 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x38,- 0x0a, 0x14, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65,- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73,- 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x78, 0x70,- 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0xac, 0x03, 0x0a, 0x0a, 0x43, 0x65, 0x6c,- 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65,- 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50,- 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52,- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a,- 0x01, 0x2a, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x70, 0x61, 0x72, 0x73,- 0x65, 0x12, 0x6c, 0x0a, 0x0a, 0x42, 0x61, 0x74, 0x63, 0x68, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12,- 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61,- 0x74, 0x63, 0x68, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,- 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61,- 0x74, 0x63, 0x68, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,- 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x76, 0x31,- 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12,- 0x60, 0x0a, 0x07, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x12, 0x1b, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65,- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73,- 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a,- 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x73,- 0x65, 0x12, 0x74, 0x0a, 0x0c, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73,- 0x65, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75,- 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,+ 0x52, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x5d, 0x0a,+ 0x13, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71,+ 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69,+ 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67,+ 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x76, 0x31, 0x61, 0x6c,+ 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x52,+ 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x38, 0x0a, 0x14,+ 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70,+ 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69,+ 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65,+ 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0xf0, 0x01, 0x0a, 0x0a, 0x43, 0x65, 0x6c, 0x53, 0x65,+ 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x0a, 0x42, 0x61, 0x74, 0x63, 0x68, 0x50, 0x61,+ 0x72, 0x73, 0x65, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,+ 0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75,+ 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,+ 0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70,+ 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22,+ 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x50, 0x61,+ 0x72, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x0c, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61,+ 0x72, 0x73, 0x65, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65,- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01,- 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68,- 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72,- 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,- 0x6f, 0x33,+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65,+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19,+ 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x62, 0x61, 0x74,+ 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e,+ 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72,+ 0x6f, 0x74, 0x6f, 0x33,}var (@@ -487,36 +270,26 @@ func file_v1_cel_service_proto_rawDescGZIP() []byte {return file_v1_cel_service_proto_rawDescData}-var file_v1_cel_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)+var file_v1_cel_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)var file_v1_cel_service_proto_goTypes = []interface{}{- (*ParseRequest)(nil), // 0: bytebase.v1.ParseRequest- (*BatchParseRequest)(nil), // 1: bytebase.v1.BatchParseRequest- (*ParseResponse)(nil), // 2: bytebase.v1.ParseResponse- (*BatchParseResponse)(nil), // 3: bytebase.v1.BatchParseResponse- (*DeparseRequest)(nil), // 4: bytebase.v1.DeparseRequest- (*BatchDeparseRequest)(nil), // 5: bytebase.v1.BatchDeparseRequest- (*DeparseResponse)(nil), // 6: bytebase.v1.DeparseResponse- (*BatchDeparseResponse)(nil), // 7: bytebase.v1.BatchDeparseResponse- (*v1alpha1.ParsedExpr)(nil), // 8: google.api.expr.v1alpha1.ParsedExpr+ (*BatchParseRequest)(nil), // 0: bytebase.v1.BatchParseRequest+ (*BatchParseResponse)(nil), // 1: bytebase.v1.BatchParseResponse+ (*BatchDeparseRequest)(nil), // 2: bytebase.v1.BatchDeparseRequest+ (*BatchDeparseResponse)(nil), // 3: bytebase.v1.BatchDeparseResponse+ (*v1alpha1.ParsedExpr)(nil), // 4: google.api.expr.v1alpha1.ParsedExpr}var file_v1_cel_service_proto_depIdxs = []int32{- 8, // 0: bytebase.v1.ParseResponse.expression:type_name -> google.api.expr.v1alpha1.ParsedExpr- 8, // 1: bytebase.v1.BatchParseResponse.expressions:type_name -> google.api.expr.v1alpha1.ParsedExpr- 8, // 2: bytebase.v1.DeparseRequest.expression:type_name -> google.api.expr.v1alpha1.ParsedExpr- 8, // 3: bytebase.v1.BatchDeparseRequest.expressions:type_name -> google.api.expr.v1alpha1.ParsedExpr- 0, // 4: bytebase.v1.CelService.Parse:input_type -> bytebase.v1.ParseRequest- 1, // 5: bytebase.v1.CelService.BatchParse:input_type -> bytebase.v1.BatchParseRequest- 4, // 6: bytebase.v1.CelService.Deparse:input_type -> bytebase.v1.DeparseRequest- 5, // 7: bytebase.v1.CelService.BatchDeparse:input_type -> bytebase.v1.BatchDeparseRequest- 2, // 8: bytebase.v1.CelService.Parse:output_type -> bytebase.v1.ParseResponse- 3, // 9: bytebase.v1.CelService.BatchParse:output_type -> bytebase.v1.BatchParseResponse- 6, // 10: bytebase.v1.CelService.Deparse:output_type -> bytebase.v1.DeparseResponse- 7, // 11: bytebase.v1.CelService.BatchDeparse:output_type -> bytebase.v1.BatchDeparseResponse- 8, // [8:12] is the sub-list for method output_type- 4, // [4:8] is the sub-list for method input_type- 4, // [4:4] is the sub-list for extension type_name- 4, // [4:4] is the sub-list for extension extendee- 0, // [0:4] is the sub-list for field type_name+ 4, // 0: bytebase.v1.BatchParseResponse.expressions:type_name -> google.api.expr.v1alpha1.ParsedExpr+ 4, // 1: bytebase.v1.BatchDeparseRequest.expressions:type_name -> google.api.expr.v1alpha1.ParsedExpr+ 0, // 2: bytebase.v1.CelService.BatchParse:input_type -> bytebase.v1.BatchParseRequest+ 2, // 3: bytebase.v1.CelService.BatchDeparse:input_type -> bytebase.v1.BatchDeparseRequest+ 1, // 4: bytebase.v1.CelService.BatchParse:output_type -> bytebase.v1.BatchParseResponse+ 3, // 5: bytebase.v1.CelService.BatchDeparse:output_type -> bytebase.v1.BatchDeparseResponse+ 4, // [4:6] is the sub-list for method output_type+ 2, // [2:4] is the sub-list for method input_type+ 2, // [2:2] is the sub-list for extension type_name+ 2, // [2:2] is the sub-list for extension extendee+ 0, // [0:2] is the sub-list for field type_name}func init() { file_v1_cel_service_proto_init() }@@ -526,18 +299,6 @@ func file_v1_cel_service_proto_init() {}if !protoimpl.UnsafeEnabled {file_v1_cel_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*ParseRequest); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:- return &v.unknownFields- default:- return nil- }- }- file_v1_cel_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*BatchParseRequest); i {case 0:return &v.state@@ -549,19 +310,7 @@ func file_v1_cel_service_proto_init() {return nil}}- file_v1_cel_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*ParseResponse); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:- return &v.unknownFields- default:- return nil- }- }- file_v1_cel_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {+ file_v1_cel_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*BatchParseResponse); i {case 0:return &v.state@@ -573,19 +322,7 @@ func file_v1_cel_service_proto_init() {return nil}}- file_v1_cel_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*DeparseRequest); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:- return &v.unknownFields- default:- return nil- }- }- file_v1_cel_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {+ file_v1_cel_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*BatchDeparseRequest); i {case 0:return &v.state@@ -597,19 +334,7 @@ func file_v1_cel_service_proto_init() {return nil}}- file_v1_cel_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*DeparseResponse); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:- return &v.unknownFields- default:- return nil- }- }- file_v1_cel_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {+ file_v1_cel_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*BatchDeparseResponse); i {case 0:return &v.state@@ -628,7 +353,7 @@ func file_v1_cel_service_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_v1_cel_service_proto_rawDesc,NumEnums: 0,- NumMessages: 8,+ NumMessages: 4,NumExtensions: 0,NumServices: 1,},diff --git a/proto/generated-go/v1/cel_service.pb.gw.go b/proto/generated-go/v1/cel_service.pb.gw.goindex 45fe1f002a..62378f6790 100644--- a/proto/generated-go/v1/cel_service.pb.gw.go+++ b/proto/generated-go/v1/cel_service.pb.gw.go@@ -31,40 +31,6 @@ var _ = runtime.Stringvar _ = utilities.NewDoubleArrayvar _ = metadata.Join-func request_CelService_Parse_0(ctx context.Context, marshaler runtime.Marshaler, client CelServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var protoReq ParseRequest- var metadata runtime.ServerMetadata-- newReader, berr := utilities.IOReaderFactory(req.Body)- if berr != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)- }- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }-- msg, err := client.Parse(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))- return msg, metadata, err--}--func local_request_CelService_Parse_0(ctx context.Context, marshaler runtime.Marshaler, server CelServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var protoReq ParseRequest- var metadata runtime.ServerMetadata-- newReader, berr := utilities.IOReaderFactory(req.Body)- if berr != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)- }- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }-- msg, err := server.Parse(ctx, &protoReq)- return msg, metadata, err--}-func request_CelService_BatchParse_0(ctx context.Context, marshaler runtime.Marshaler, client CelServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {var protoReq BatchParseRequestvar metadata runtime.ServerMetadata@@ -99,40 +65,6 @@ func local_request_CelService_BatchParse_0(ctx context.Context, marshaler runtim}-func request_CelService_Deparse_0(ctx context.Context, marshaler runtime.Marshaler, client CelServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var protoReq DeparseRequest- var metadata runtime.ServerMetadata-- newReader, berr := utilities.IOReaderFactory(req.Body)- if berr != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)- }- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }-- msg, err := client.Deparse(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))- return msg, metadata, err--}--func local_request_CelService_Deparse_0(ctx context.Context, marshaler runtime.Marshaler, server CelServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var protoReq DeparseRequest- var metadata runtime.ServerMetadata-- newReader, berr := utilities.IOReaderFactory(req.Body)- if berr != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)- }- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }-- msg, err := server.Deparse(ctx, &protoReq)- return msg, metadata, err--}-func request_CelService_BatchDeparse_0(ctx context.Context, marshaler runtime.Marshaler, client CelServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {var protoReq BatchDeparseRequestvar metadata runtime.ServerMetadata@@ -173,31 +105,6 @@ func local_request_CelService_BatchDeparse_0(ctx context.Context, marshaler runt// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCelServiceHandlerFromEndpoint instead.func RegisterCelServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CelServiceServer) error {- mux.Handle("POST", pattern_CelService_Parse_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)- var err error- var annotatedContext context.Context- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.CelService/Parse", runtime.WithHTTPPathPattern("/v1/cel/parse"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := local_request_CelService_Parse_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_CelService_Parse_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)-- })-mux.Handle("POST", pattern_CelService_BatchParse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -223,31 +130,6 @@ func RegisterCelServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,})- mux.Handle("POST", pattern_CelService_Deparse_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)- var err error- var annotatedContext context.Context- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.CelService/Deparse", runtime.WithHTTPPathPattern("/v1/cel/deparse"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := local_request_CelService_Deparse_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_CelService_Deparse_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)-- })-mux.Handle("POST", pattern_CelService_BatchDeparse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -314,28 +196,6 @@ func RegisterCelServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn// "CelServiceClient" to call the correct interceptors.func RegisterCelServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CelServiceClient) error {- mux.Handle("POST", pattern_CelService_Parse_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)- var err error- var annotatedContext context.Context- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.CelService/Parse", runtime.WithHTTPPathPattern("/v1/cel/parse"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := request_CelService_Parse_0(annotatedContext, inboundMarshaler, client, req, pathParams)- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)- if err != nil {- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)- return- }-- forward_CelService_Parse_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)-- })-mux.Handle("POST", pattern_CelService_BatchParse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -358,28 +218,6 @@ func RegisterCelServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,})- mux.Handle("POST", pattern_CelService_Deparse_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)- var err error- var annotatedContext context.Context- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.CelService/Deparse", runtime.WithHTTPPathPattern("/v1/cel/deparse"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := request_CelService_Deparse_0(annotatedContext, inboundMarshaler, client, req, pathParams)- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)- if err != nil {- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)- return- }-- forward_CelService_Deparse_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)-- })-mux.Handle("POST", pattern_CelService_BatchDeparse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -406,21 +244,13 @@ func RegisterCelServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,}var (- pattern_CelService_Parse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "cel", "parse"}, ""))-pattern_CelService_BatchParse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "cel", "batchParse"}, ""))- pattern_CelService_Deparse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "cel", "deparse"}, ""))-pattern_CelService_BatchDeparse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "cel", "batchDeparse"}, "")))var (- forward_CelService_Parse_0 = runtime.ForwardResponseMessage-forward_CelService_BatchParse_0 = runtime.ForwardResponseMessage- forward_CelService_Deparse_0 = runtime.ForwardResponseMessage-forward_CelService_BatchDeparse_0 = runtime.ForwardResponseMessage)diff --git a/proto/generated-go/v1/cel_service_grpc.pb.go b/proto/generated-go/v1/cel_service_grpc.pb.goindex aef7923c6f..e3dce4251a 100644--- a/proto/generated-go/v1/cel_service_grpc.pb.go+++ b/proto/generated-go/v1/cel_service_grpc.pb.go@@ -19,9 +19,7 @@ import (const _ = grpc.SupportPackageIsVersion7const (- CelService_Parse_FullMethodName = "/bytebase.v1.CelService/Parse"CelService_BatchParse_FullMethodName = "/bytebase.v1.CelService/BatchParse"- CelService_Deparse_FullMethodName = "/bytebase.v1.CelService/Deparse"CelService_BatchDeparse_FullMethodName = "/bytebase.v1.CelService/BatchDeparse")@@ -29,9 +27,7 @@ const (//// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.type CelServiceClient interface {- Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error)BatchParse(ctx context.Context, in *BatchParseRequest, opts ...grpc.CallOption) (*BatchParseResponse, error)- Deparse(ctx context.Context, in *DeparseRequest, opts ...grpc.CallOption) (*DeparseResponse, error)BatchDeparse(ctx context.Context, in *BatchDeparseRequest, opts ...grpc.CallOption) (*BatchDeparseResponse, error)}@@ -43,15 +39,6 @@ func NewCelServiceClient(cc grpc.ClientConnInterface) CelServiceClient {return &celServiceClient{cc}}-func (c *celServiceClient) Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error) {- out := new(ParseResponse)- err := c.cc.Invoke(ctx, CelService_Parse_FullMethodName, in, out, opts...)- if err != nil {- return nil, err- }- return out, nil-}-func (c *celServiceClient) BatchParse(ctx context.Context, in *BatchParseRequest, opts ...grpc.CallOption) (*BatchParseResponse, error) {out := new(BatchParseResponse)err := c.cc.Invoke(ctx, CelService_BatchParse_FullMethodName, in, out, opts...)@@ -61,15 +48,6 @@ func (c *celServiceClient) BatchParse(ctx context.Context, in *BatchParseRequestreturn out, nil}-func (c *celServiceClient) Deparse(ctx context.Context, in *DeparseRequest, opts ...grpc.CallOption) (*DeparseResponse, error) {- out := new(DeparseResponse)- err := c.cc.Invoke(ctx, CelService_Deparse_FullMethodName, in, out, opts...)- if err != nil {- return nil, err- }- return out, nil-}-func (c *celServiceClient) BatchDeparse(ctx context.Context, in *BatchDeparseRequest, opts ...grpc.CallOption) (*BatchDeparseResponse, error) {out := new(BatchDeparseResponse)err := c.cc.Invoke(ctx, CelService_BatchDeparse_FullMethodName, in, out, opts...)@@ -83,9 +61,7 @@ func (c *celServiceClient) BatchDeparse(ctx context.Context, in *BatchDeparseReq// All implementations must embed UnimplementedCelServiceServer// for forward compatibilitytype CelServiceServer interface {- Parse(context.Context, *ParseRequest) (*ParseResponse, error)BatchParse(context.Context, *BatchParseRequest) (*BatchParseResponse, error)- Deparse(context.Context, *DeparseRequest) (*DeparseResponse, error)BatchDeparse(context.Context, *BatchDeparseRequest) (*BatchDeparseResponse, error)mustEmbedUnimplementedCelServiceServer()}@@ -94,15 +70,9 @@ type CelServiceServer interface {type UnimplementedCelServiceServer struct {}-func (UnimplementedCelServiceServer) Parse(context.Context, *ParseRequest) (*ParseResponse, error) {- return nil, status.Errorf(codes.Unimplemented, "method Parse not implemented")-}func (UnimplementedCelServiceServer) BatchParse(context.Context, *BatchParseRequest) (*BatchParseResponse, error) {return nil, status.Errorf(codes.Unimplemented, "method BatchParse not implemented")}-func (UnimplementedCelServiceServer) Deparse(context.Context, *DeparseRequest) (*DeparseResponse, error) {- return nil, status.Errorf(codes.Unimplemented, "method Deparse not implemented")-}func (UnimplementedCelServiceServer) BatchDeparse(context.Context, *BatchDeparseRequest) (*BatchDeparseResponse, error) {return nil, status.Errorf(codes.Unimplemented, "method BatchDeparse not implemented")}@@ -119,24 +89,6 @@ func RegisterCelServiceServer(s grpc.ServiceRegistrar, srv CelServiceServer) {s.RegisterService(&CelService_ServiceDesc, srv)}-func _CelService_Parse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(ParseRequest)- if err := dec(in); err != nil {- return nil, err- }- if interceptor == nil {- return srv.(CelServiceServer).Parse(ctx, in)- }- info := &grpc.UnaryServerInfo{- Server: srv,- FullMethod: CelService_Parse_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(CelServiceServer).Parse(ctx, req.(*ParseRequest))- }- return interceptor(ctx, in, info, handler)-}-func _CelService_BatchParse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {in := new(BatchParseRequest)if err := dec(in); err != nil {@@ -155,24 +107,6 @@ func _CelService_BatchParse_Handler(srv interface{}, ctx context.Context, dec fureturn interceptor(ctx, in, info, handler)}-func _CelService_Deparse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(DeparseRequest)- if err := dec(in); err != nil {- return nil, err- }- if interceptor == nil {- return srv.(CelServiceServer).Deparse(ctx, in)- }- info := &grpc.UnaryServerInfo{- Server: srv,- FullMethod: CelService_Deparse_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(CelServiceServer).Deparse(ctx, req.(*DeparseRequest))- }- return interceptor(ctx, in, info, handler)-}-func _CelService_BatchDeparse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {in := new(BatchDeparseRequest)if err := dec(in); err != nil {@@ -198,18 +132,10 @@ var CelService_ServiceDesc = grpc.ServiceDesc{ServiceName: "bytebase.v1.CelService",HandlerType: (*CelServiceServer)(nil),Methods: []grpc.MethodDesc{- {- MethodName: "Parse",- Handler: _CelService_Parse_Handler,- },{MethodName: "BatchParse",Handler: _CelService_BatchParse_Handler,},- {- MethodName: "Deparse",- Handler: _CelService_Deparse_Handler,- },{MethodName: "BatchDeparse",Handler: _CelService_BatchDeparse_Handler,diff --git a/proto/v1/cel_service.proto b/proto/v1/cel_service.protoindex 592d365479..faadc9459f 100644--- a/proto/v1/cel_service.proto+++ b/proto/v1/cel_service.proto@@ -8,24 +8,12 @@ import "google/api/expr/v1alpha1/syntax.proto";option go_package = "generated-go/v1";service CelService {- rpc Parse(ParseRequest) returns (ParseResponse) {- option (google.api.http) = {- post: "/v1/cel/parse"- body: "*"- };- }rpc BatchParse(BatchParseRequest) returns (BatchParseResponse) {option (google.api.http) = {post: "/v1/cel/batchParse"body: "*"};}- rpc Deparse(DeparseRequest) returns (DeparseResponse) {- option (google.api.http) = {- post: "/v1/cel/deparse"- body: "*"- };- }rpc BatchDeparse(BatchDeparseRequest) returns (BatchDeparseResponse) {option (google.api.http) = {post: "/v1/cel/batchDeparse"@@ -34,34 +22,18 @@ service CelService {}}-message ParseRequest {- string expression = 1;-}-message BatchParseRequest {repeated string expressions = 1;}-message ParseResponse {- google.api.expr.v1alpha1.ParsedExpr expression = 1;-}-message BatchParseResponse {repeated google.api.expr.v1alpha1.ParsedExpr expressions = 1;}-message DeparseRequest {- google.api.expr.v1alpha1.ParsedExpr expression = 1;-}-message BatchDeparseRequest {repeated google.api.expr.v1alpha1.ParsedExpr expressions = 1;}-message DeparseResponse {- string expression = 1;-}-message BatchDeparseResponse {repeated string expressions = 1;}