Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: fe connect rpc migration (#16726)
p0ny9d58edbf81e9
diff --git a/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue b/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vueindex 5a1291ce03..eeeecb309f 100644--- a/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue+++ b/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue@@ -172,8 +172,7 @@ import {CreateChangelistRequestSchema,} from "@/types/proto-es/v1/changelist_service_pb";import { Engine } from "@/types/proto-es/v1/common_pb";-import { Sheet } from "@/types/proto/v1/sheet_service";-import { convertEngineToOld } from "@/utils/v1/common-conversions";+import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";import {ENCODINGS,extractChangelistResourceName,@@ -270,9 +269,9 @@ const doCreate = async () => {const createdSheets = await Promise.all(files.value.map(async (f) => {const { name, arrayBuffer } = f;- const sheet = Sheet.fromPartial({+ const sheet = createProto(SheetSchema, {title: name,- engine: convertEngineToOld(Engine.ENGINE_UNSPECIFIED), // TODO(jim)+ engine: Engine.ENGINE_UNSPECIFIED,});const content = new TextDecoder(state.encoding).decode(arrayBuffer);setSheetStatement(sheet, content);diff --git a/frontend/src/components/Changelist/ChangelistDetail/NavBar/ImportButton.vue b/frontend/src/components/Changelist/ChangelistDetail/NavBar/ImportButton.vueindex 870df072c7..2fbd0c2ae9 100644--- a/frontend/src/components/Changelist/ChangelistDetail/NavBar/ImportButton.vue+++ b/frontend/src/components/Changelist/ChangelistDetail/NavBar/ImportButton.vue@@ -30,7 +30,7 @@ import {Changelist_ChangeSchema,ChangelistSchema,} from "@/types/proto-es/v1/changelist_service_pb";-import { Sheet } from "@/types/proto/v1/sheet_service";+import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";import { setSheetStatement } from "@/utils";import { useChangelistDetailContext } from "../context";@@ -42,7 +42,7 @@ const onUploadFiles = async () => {const createdSheets = await Promise.all(statementMap.map(async (m) => {- const sheet = Sheet.fromPartial({+ const sheet = create(SheetSchema, {title: m.filename,});setSheetStatement(sheet, m.statement);diff --git a/frontend/src/components/Changelist/ChangelistDetail/RawSQLPanel/RawSQLPanel.vue b/frontend/src/components/Changelist/ChangelistDetail/RawSQLPanel/RawSQLPanel.vueindex 7ac2d86f88..b0d7844b22 100644--- a/frontend/src/components/Changelist/ChangelistDetail/RawSQLPanel/RawSQLPanel.vue+++ b/frontend/src/components/Changelist/ChangelistDetail/RawSQLPanel/RawSQLPanel.vue@@ -69,7 +69,8 @@ import { BBAttention, BBSpin } from "@/bbkit";import DownloadSheetButton from "@/components/Sheet/DownloadSheetButton.vue";import { Drawer, DrawerContent, ErrorTipsButton } from "@/components/v2";import { pushNotification, useSheetV1Store } from "@/store";-import { Sheet } from "@/types/proto/v1/sheet_service";+import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";+import { create as createProto } from "@bufbuild/protobuf";import {getSheetStatement,setSheetStatement,@@ -144,7 +145,7 @@ const doSaveChange = async () => {try {isUpdating.value = true;- const patch = Sheet.fromPartial({+ const patch = createProto(SheetSchema, {name: sheet.value.name,});setSheetStatement(patch, statement.value);diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vueindex b3cb1960b4..9e7845f9f8 100644--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue@@ -31,7 +31,7 @@:project="issue.project":database="databaseForTask(project, selectedTask)":advices="- convertNewAdviceArrayToOld(checkResultMap[databaseForTask(project, selectedTask).name].advices)+ checkResultMap[databaseForTask(project, selectedTask).name].advices":affected-rows="checkResultMap[databaseForTask(project, selectedTask).name].affectedRows@@ -90,8 +90,8 @@ import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_import { Issue, Issue_Type } from "@/types/proto/v1/issue_service";import type { Plan_ExportDataConfig } from "@/types/proto/v1/plan_service";import { type Plan_ChangeDatabaseConfig } from "@/types/proto/v1/plan_service";-import type { Sheet } from "@/types/proto/v1/sheet_service";-import { Advice_Status } from "@/types/proto/v1/sql_service";+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";+import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";import {defer,extractIssueUID,@@ -105,7 +105,6 @@ import {sheetNameOfTaskV1,type Defer,} from "@/utils";-import { convertEngineToOld } from "@/utils/v1/common-conversions";import {convertOldIssueToNew,convertNewIssueToOld,@@ -114,7 +113,6 @@ import {convertOldPlanToNew,convertNewPlanToOld,} from "@/utils/v1/plan-conversions";-import { convertNewAdviceArrayToOld, convertNewAdviceStatusToOld } from "@/utils/v1/sql-conversions";const MAX_FORMATTABLE_STATEMENT_SIZE = 10000; // 10K characters@@ -234,7 +232,7 @@ const createSheets = async () => {// The sheet is pending createconst sheet = getLocalSheetByName(config.sheet);const engine = await databaseEngineForSpec(spec);- sheet.engine = convertEngineToOld(engine as Engine);+ sheet.engine = engine;pendingCreateSheetMap.set(sheet.name, sheet);await maybeFormatSQL(sheet, engine as Engine);}@@ -364,7 +362,7 @@ const runSQLCheckForIssue = async () => {for (const checkResult of Object.values(checkResultMap.value)) {const hasErrors = checkResult.advices.some((advice) => {- return convertNewAdviceStatusToOld(advice.status) === Advice_Status.ERROR;+ return advice.status === Advice_Status.ERROR;});// Focus on the first task with error.if (hasErrors) {diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vueindex f91fcdc6d7..67afc26104 100644--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vue+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vue@@ -43,7 +43,7 @@ import {TaskRun_ExportArchiveStatus,Task_Status,} from "@/types/proto/v1/rollout_service";-import { ExportRequest } from "@/types/proto/v1/sql_service";+import { ExportRequestSchema } from "@/types/proto-es/v1/sql_service_pb";import { flattenTaskV1List } from "@/utils";import { convertExportFormatToNew } from "@/utils/v1/common-conversions";@@ -87,7 +87,7 @@ watchEffect(async () => {const downloadExportArchive = async () => {state.isExporting = true;const content = await useSQLStore().exportData(- ExportRequest.fromPartial({+ create(ExportRequestSchema, {name: selectedStage.value.name,}));diff --git a/frontend/src/components/IssueV1/components/IssueLabelSelector.vue b/frontend/src/components/IssueV1/components/IssueLabelSelector.vueindex 71a31c0895..9c5c84c24b 100644--- a/frontend/src/components/IssueV1/components/IssueLabelSelector.vue+++ b/frontend/src/components/IssueV1/components/IssueLabelSelector.vue@@ -52,7 +52,7 @@ import { computed, h } from "vue";import { PROJECT_V1_ROUTE_SETTINGS } from "@/router/dashboard/projectV1";import { getProjectName } from "@/store/modules/v1/common";import type { ComposedProject } from "@/types";-import { Label } from "@/types/proto/v1/project_service";+import type { Label } from "@/types/proto-es/v1/project_service_pb";import { hasProjectPermissionV2 } from "@/utils";type IssueLabelOption = SelectOption & {diff --git a/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.ts b/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.tsindex c5bcbb41bb..76fa2b5f00 100644--- a/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.ts+++ b/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.ts@@ -18,7 +18,7 @@ import {useUserStore,} from "@/store";import { SYSTEM_BOT_USER_NAME, UNKNOWN_ID, isValidProjectName } from "@/types";-import { type Label } from "@/types/proto/v1/project_service";+import { type Label } from "@/types/proto-es/v1/project_service_pb";import { UserType } from "@/types/proto-es/v1/user_service_pb";import type { SearchParams, SearchScopeId } from "@/utils";import {diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vueindex 3e65ecabec..d4c839c088 100644--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue+++ b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue@@ -194,7 +194,6 @@ import { create } from "@bufbuild/protobuf";import { planServiceClientConnect } from "@/grpcweb";import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";import { convertOldPlanToNew, convertNewPlanToOld } from "@/utils/v1/plan-conversions";-import { convertEngineToOld } from "@/utils/v1/common-conversions";import { emitWindowEvent } from "@/plugins";import {pushNotification,@@ -204,9 +203,8 @@ import {import type { SQLDialect } from "@/types";import { dialectOfEngineV1 } from "@/types";import { IssueStatus } from "@/types/proto/v1/issue_service";-import { Sheet } from "@/types/proto/v1/sheet_service";-import type { Advice } from "@/types/proto/v1/sql_service";-import type { Engine } from "@/types/proto-es/v1/common_pb";+import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";+import type { Advice } from "@/types/proto-es/v1/sql_service_pb";import {flattenTaskV1List,getSheetStatement,@@ -455,10 +453,10 @@ const updateStatement = async (statement: string) => {throw new Error("Plan is not defined. Cannot update statement.");}- const sheet = Sheet.fromPartial({+ const sheet = create(SheetSchema, {...createEmptyLocalSheet(),title: issue.value.title,- engine: convertEngineToOld(await databaseEngineForSpec(head(planPatch.specs)) as Engine),+ engine: await databaseEngineForSpec(head(planPatch.specs)),});setSheetStatement(sheet, statement);const createdSheet = await useSheetV1Store().createSheet(diff --git a/frontend/src/components/IssueV1/components/StatementSection/StatementSection.vue b/frontend/src/components/IssueV1/components/StatementSection/StatementSection.vueindex 2bef2d7af1..16d6033a68 100644--- a/frontend/src/components/IssueV1/components/StatementSection/StatementSection.vue+++ b/frontend/src/components/IssueV1/components/StatementSection/StatementSection.vue@@ -13,7 +13,6 @@ import { usePlanSQLCheckContext } from "@/components/Plan/components/SQLCheckSecimport { databaseForTask } from "@/components/Rollout/RolloutDetail";import { useCurrentProjectV1 } from "@/store";import { TaskTypeListWithStatement } from "@/types";-import { convertNewAdviceArrayToOld } from "@/utils/v1/sql-conversions";import { isValidTaskName } from "@/utils";import { useEventListener } from "@vueuse/core";import { computed, nextTick, ref } from "vue";@@ -32,8 +31,7 @@ const editorViewRef = ref<InstanceType<typeof EditorView>>();const advices = computed(() => {const database = databaseForTask(project.value, selectedTask.value);- const newAdvices = resultMap.value[database.name]?.advices || [];- return convertNewAdviceArrayToOld(newAdvices);+ return resultMap.value[database.name]?.advices || [];});type ViewMode = "NONE" | "EDITOR";diff --git a/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.ts b/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.tsindex 5c316e9bd9..3db8af21bd 100644--- a/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.ts+++ b/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.ts@@ -1,13 +1,14 @@import { maxBy } from "lodash-es";import { computed, type Ref } from "vue";import type { AdviceOption } from "@/components/MonacoEditor";+import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";import {- PlanCheckRun,PlanCheckRun_Result_Status,PlanCheckRun_Type,-} from "@/types/proto/v1/plan_service";-import { Advice_Status, type Advice } from "@/types/proto/v1/sql_service";+} from "@/types/proto-es/v1/plan_service_pb";+import { Advice_Status, type Advice } from "@/types/proto-es/v1/sql_service_pb";import { extractPlanCheckRunUID } from "@/utils";+import { convertOldPlanCheckRunToNew } from "@/utils/v1/plan-conversions";import { type IssueContext } from "../../logic";export const useSQLAdviceMarkers = (@@ -35,7 +36,10 @@ export const useSQLAdviceMarkers = (});} else {const { selectedTask, getPlanCheckRunsForTask } = context;- const planCheckRunList = getPlanCheckRunsForTask(selectedTask.value);+ const oldPlanCheckRunList = getPlanCheckRunsForTask(selectedTask.value);++ // Convert old proto types to proto-es types at the boundary+ const planCheckRunList = oldPlanCheckRunList.map(convertOldPlanCheckRunToNew);const types: PlanCheckRun_Type[] = [PlanCheckRun_Type.DATABASE_STATEMENT_ADVISE,@@ -64,10 +68,11 @@ const getLatestAdviceOptions = (planCheckRunList: PlanCheckRun[]) => {result.status === PlanCheckRun_Result_Status.ERROR ||result.status === PlanCheckRun_Result_Status.WARNING)- .filter((result) => result.sqlReviewReport?.line !== undefined)+ .filter((result) => result.report?.case === "sqlReviewReport" && result.report.value.line !== undefined).map<AdviceOption>((result) => {- const line = result.sqlReviewReport!.line;- const column = result.sqlReviewReport?.column ?? Number.MAX_SAFE_INTEGER;+ const sqlReviewReport = result.report?.case === "sqlReviewReport" ? result.report.value : null;+ const line = sqlReviewReport?.line ?? 0;+ const column = sqlReviewReport?.column ?? Number.MAX_SAFE_INTEGER;const code = result.code;return {severity:diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vueindex 97997ac9d5..f4634e40d1 100644--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue@@ -84,7 +84,7 @@ import { computed } from "vue";import AdviceStatusIcon from "@/components/Plan/components/SQLCheckSection/AdviceStatusIcon.vue";import { usePlanSQLCheckContext } from "@/components/Plan/components/SQLCheckSection/context";import { Task_Status } from "@/types/proto/v1/rollout_service";-import { Advice_Status } from "@/types/proto/v1/sql_service";+import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";import { useIssueContext } from "../../logic";import TaskStatusIconV1 from "../TaskStatusIconV1.vue";import { filterTask } from "./filter";@@ -110,7 +110,7 @@ const TASK_STATUS_FILTERS: Task_Status[] = [Task_Status.SKIPPED,];const ADVICE_STATUS_FILTERS: Advice_Status[] = [- Advice_Status.UNRECOGNIZED,+ Advice_Status.STATUS_UNSPECIFIED,Advice_Status.SUCCESS,Advice_Status.WARNING,Advice_Status.ERROR,diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vueindex c97ab68a03..97d9dcbe8b 100644--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue@@ -70,7 +70,7 @@ import { useVerticalScrollState } from "@/composables/useScrollState";import { batchGetOrFetchDatabases, useCurrentProjectV1 } from "@/store";import { DEBOUNCE_SEARCH_DELAY } from "@/types";import type { Task_Status } from "@/types/proto/v1/rollout_service";-import type { Advice_Status } from "@/types/proto/v1/sql_service";+import type { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";import { isDev } from "@/utils";import { useIssueContext } from "../../logic";import CurrentTaskSection from "./CurrentTaskSection.vue";diff --git a/frontend/src/components/IssueV1/components/TaskListSection/filter.ts b/frontend/src/components/IssueV1/components/TaskListSection/filter.tsindex dee4b9967c..6ae556f122 100644--- a/frontend/src/components/IssueV1/components/TaskListSection/filter.ts+++ b/frontend/src/components/IssueV1/components/TaskListSection/filter.ts@@ -1,8 +1,7 @@import { planCheckRunSummaryForCheckRunList } from "@/components/PlanCheckRun/common";import type { CheckReleaseResponse_CheckResult } from "@/types/proto-es/v1/release_service_pb";import type { Task, Task_Status } from "@/types/proto/v1/rollout_service";-import { Advice_Status } from "@/types/proto/v1/sql_service";-import { convertNewAdviceStatusToOld } from "@/utils/v1/sql-conversions";+import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";import { type IssueContext } from "../../logic";export const filterTask = (@@ -21,10 +20,10 @@ export const filterTask = (if (status) {return task.status === status;}- if (adviceStatus) {+ if (adviceStatus !== undefined) {if (isCreating.value) {const result = sqlCheckResultMap[task.target];- if (adviceStatus === Advice_Status.UNRECOGNIZED) {+ if (adviceStatus === Advice_Status.STATUS_UNSPECIFIED) {return !Boolean(result);}if (adviceStatus === Advice_Status.SUCCESS) {@@ -32,7 +31,7 @@ export const filterTask = (}return (result &&- result.advices.some((advice) => convertNewAdviceStatusToOld(advice.status) === adviceStatus)+ result.advices.some((advice) => advice.status === adviceStatus));} else {const summary = planCheckRunSummaryForCheckRunList(diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vueindex b3bfedeb64..b3ad6edbbf 100644--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue@@ -18,7 +18,7 @@import { NEllipsis } from "naive-ui";import { computed } from "vue";import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";-import type { Sheet } from "@/types/proto/v1/sheet_service";+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";import type { FlattenLogEntry } from "../common";import AffectedRowsCell from "./AffectedRowsCell.vue";import DatabaseSyncCell from "./DatabaseSyncCell.vue";diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/StatementCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/StatementCell.vueindex c36ab4f943..e018f7255a 100644--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/StatementCell.vue+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/StatementCell.vue@@ -33,7 +33,7 @@ import { computed } from "vue";import TextOverflowPopover from "@/components/misc/TextOverflowPopover.vue";import { CopyButton } from "@/components/v2";import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";-import type { Sheet } from "@/types/proto/v1/sheet_service";+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";import { extractSheetCommandByIndex } from "@/utils";import type { FlattenLogEntry } from "./common";diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vueindex fb6495c894..52a9bfc87b 100644--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue@@ -23,7 +23,7 @@ import {type TaskRun,TaskRunLogEntry_Type,} from "@/types/proto/v1/rollout_service";-import type { Sheet } from "@/types/proto/v1/sheet_service";+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";import DetailCell, { detailCellRowSpan } from "./DetailCell";import DurationCell from "./DurationCell.vue";import LogTimeCell from "./LogTimeCell.vue";diff --git a/frontend/src/components/IssueV1/components/TaskStatusIcon.vue b/frontend/src/components/IssueV1/components/TaskStatusIcon.vueindex 8b8dbb6859..8953e5a882 100644--- a/frontend/src/components/IssueV1/components/TaskStatusIcon.vue+++ b/frontend/src/components/IssueV1/components/TaskStatusIcon.vue@@ -64,8 +64,7 @@ import { useCurrentProjectV1 } from "@/store";import { PlanCheckRun_Result_Status } from "@/types/proto/v1/plan_service";import type { Task } from "@/types/proto/v1/rollout_service";import { Task_Status } from "@/types/proto/v1/rollout_service";-import { Advice_Status } from "@/types/proto/v1/sql_service";-import { convertNewAdviceStatusToOld } from "@/utils/v1/sql-conversions";+import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";import { planCheckStatusForTask, useIssueContext } from "../logic";const props = defineProps<{@@ -88,13 +87,13 @@ const checkStatus = computed(() => {if (checkResult.advices.some(- (advice) => convertNewAdviceStatusToOld(advice.status) === Advice_Status.ERROR+ (advice) => advice.status === Advice_Status.ERROR)) {return PlanCheckRun_Result_Status.ERROR;} else if (checkResult.advices.some(- (advice) => convertNewAdviceStatusToOld(advice.status) === Advice_Status.WARNING+ (advice) => advice.status === Advice_Status.WARNING)) {return PlanCheckRun_Result_Status.WARNING;diff --git a/frontend/src/components/Plan/components/AddSpecDrawer.vue b/frontend/src/components/Plan/components/AddSpecDrawer.vueindex e79011b154..186d60eede 100644--- a/frontend/src/components/Plan/components/AddSpecDrawer.vue+++ b/frontend/src/components/Plan/components/AddSpecDrawer.vue@@ -149,12 +149,13 @@ import type { DatabaseSelectState } from "@/components/DatabaseAndGroupSelector"import { getLocalSheetByName, getNextLocalSheetUID } from "@/components/Plan";import { Drawer, DrawerContent } from "@/components/v2";import { useCurrentProjectV1 } from "@/store";+import { create as createProto } from "@bufbuild/protobuf";import {Plan_ChangeDatabaseConfig,Plan_ChangeDatabaseConfig_Type,} from "@/types/proto/v1/plan_service";import type { Plan_Spec } from "@/types/proto/v1/plan_service";-import { Sheet } from "@/types/proto/v1/sheet_service";+import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";defineProps<{title?: string;@@ -234,7 +235,7 @@ const handleConfirm = async () => {}const sheetUID = getNextLocalSheetUID();- const sheet = Sheet.fromPartial({+ const sheet = createProto(SheetSchema, {...getLocalSheetByName(`${project.value.name}/sheets/${sheetUID}`),title:changeType.value === "MIGRATE" ? "Schema Migration" : "Data Change",diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vueindex 8fe8f0632f..b97e78c697 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue@@ -46,17 +46,15 @@ import { usePlanContext } from "@/components/Plan/logic";import { planServiceClientConnect } from "@/grpcweb";import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";import { useCurrentProjectV1, useSheetV1Store } from "@/store";-import { Engine } from "@/types/proto-es/v1/common_pb";import { CreatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";import { type Plan_ChangeDatabaseConfig } from "@/types/proto/v1/plan_service";-import type { Sheet } from "@/types/proto/v1/sheet_service";+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";import {extractPlanUID,extractProjectResourceName,extractSheetUID,hasProjectPermissionV2,} from "@/utils";-import { convertEngineToOld } from "@/utils/v1/common-conversions";import {convertOldPlanToNew,convertNewPlanToOld,@@ -133,9 +131,7 @@ const createSheets = async () => {// The sheet is pending createconst sheet = getLocalSheetByName(config.sheet);const engine = await databaseEngineForSpec(spec);- sheet.engine = convertEngineToOld(- (engine ?? Engine.ENGINE_UNSPECIFIED) as Engine- );+ sheet.engine = engine;pendingCreateSheetMap.set(sheet.name, sheet);}}diff --git a/frontend/src/components/Plan/components/SQLCheckSection/AdviceStatusIcon.vue b/frontend/src/components/Plan/components/SQLCheckSection/AdviceStatusIcon.vueindex 0b1dfa16c2..55a64ef9a0 100644--- a/frontend/src/components/Plan/components/SQLCheckSection/AdviceStatusIcon.vue+++ b/frontend/src/components/Plan/components/SQLCheckSection/AdviceStatusIcon.vue@@ -28,7 +28,7 @@ import {import { NTooltip } from "naive-ui";import { computed } from "vue";import { useI18n } from "vue-i18n";-import { Advice_Status } from "@/types/proto/v1/sql_service";+import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";const props = defineProps<{status: Advice_Status;diff --git a/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue b/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vueindex 67ef10d68c..3d05a3e80e 100644--- a/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue+++ b/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue@@ -37,8 +37,8 @@ import { NTag } from "naive-ui";import { computed, ref } from "vue";import { TaskSpinner } from "@/components/IssueV1/components/common";import { SQLCheckPanel } from "@/components/SQLCheck";-import type { Advice } from "@/types/proto/v1/sql_service";-import { Advice_Status } from "@/types/proto/v1/sql_service";+import type { Advice } from "@/types/proto-es/v1/sql_service_pb";+import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";import { usePlanSQLCheckContext } from "./context";const props = defineProps<{diff --git a/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckButton.vue b/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckButton.vueindex 1f07481f59..53b2d3ce9e 100644--- a/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckButton.vue+++ b/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckButton.vue@@ -61,8 +61,7 @@ import { releaseServiceClientConnect } from "@/grpcweb";import type { CheckReleaseResponse } from "@/types/proto-es/v1/release_service_pb";import { CheckReleaseRequestSchema, CheckReleaseResponseSchema, ReleaseFileType } from "@/types/proto-es/v1/release_service_pb";import { AdviceSchema, Advice_Status as ProtoESAdvice_Status } from "@/types/proto-es/v1/sql_service_pb";-import { convertNewAdviceArrayToOld } from "@/utils/v1/sql-conversions";-import { Advice_Status } from "@/types/proto/v1/sql_service";+import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";import type { Defer, VueStyle } from "@/utils";import { defer } from "@/utils";import { useSpecSheet } from "../StatementSection/useSpecSheet";@@ -92,8 +91,7 @@ const confirmDialog = ref<Defer<boolean>>();const checkResult = ref<CheckReleaseResponse | undefined>();const advices = computed(() => {- const newAdvices = checkResult.value?.results.flatMap((r) => r.advices);- return newAdvices ? convertNewAdviceArrayToOld(newAdvices) : undefined;+ return checkResult.value?.results.flatMap((r) => r.advices);});const changeType = computed(() => getSpecChangeType(selectedSpec.value));diff --git a/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckSection.vue b/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckSection.vueindex 2260caf732..cbccad609d 100644--- a/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckSection.vue+++ b/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckSection.vue@@ -38,7 +38,6 @@import { NTag, NTooltip } from "naive-ui";import { computed } from "vue";import { isValidDatabaseName } from "@/types";-import { convertNewAdviceArrayToOld } from "@/utils/v1/sql-conversions";import SQLCheckBadge from "./SQLCheckBadge.vue";import SQLCheckButton from "./SQLCheckButton.vue";import { usePlanSQLCheckContext } from "./context";@@ -49,9 +48,6 @@ const checkResult = computed(() => {const result = resultMap.value[database.value.name] || undefined;if (!result) return undefined;- return {- ...result,- advices: convertNewAdviceArrayToOld(result.advices)- };+ return result;});</script>diff --git a/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue b/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vueindex 873dd20f34..de3880d305 100644--- a/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue+++ b/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue@@ -143,9 +143,8 @@ import {Release_File_ChangeType,type CheckReleaseResponse_CheckResult,} from "@/types/proto-es/v1/release_service_pb";-import { Advice_Status, type Advice } from "@/types/proto/v1/sql_service";+import { Advice_Status, type Advice } from "@/types/proto-es/v1/sql_service_pb";import { getSheetStatement, isNullOrUndefined } from "@/utils";-import { convertNewAdviceArrayToOld } from "@/utils/v1/sql-conversions";import { usePlanContext } from "../../logic/context";import { targetsForSpec } from "../../logic/plan";import { usePlanSpecContext } from "../SpecDetailView/context";@@ -188,8 +187,7 @@ const allAdvices = computed(() => {}const advices: AdviceWithTarget[] = [];for (const result of checkResults.value) {- const oldAdvices = convertNewAdviceArrayToOld(result.advices);- for (const advice of oldAdvices) {+ for (const advice of result.advices) {advices.push({...advice,target: result.target,diff --git a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vueindex 5171e4f5fc..71c0f581bb 100644--- a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue+++ b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue@@ -193,17 +193,15 @@ import {} from "@/store";import type { SQLDialect } from "@/types";import { dialectOfEngineV1 } from "@/types";-import { Engine } from "@/types/proto-es/v1/common_pb";import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";import { Task_Status } from "@/types/proto/v1/rollout_service";-import { Sheet } from "@/types/proto/v1/sheet_service";+import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";import {getSheetStatement,getStatementSize,setSheetStatement,useInstanceV1EditorLanguage,} from "@/utils";-import { convertEngineToOld } from "@/utils/v1/common-conversions";import {convertOldPlanToNew,convertNewPlanToOld,@@ -420,12 +418,11 @@ const updateStatement = async (statement: string) => {(spec) => spec.id === selectedSpec.value.id);const specEngine = await databaseEngineForSpec(head(specsToPatch));- const sheet = Sheet.fromPartial({+ const sheet = create(SheetSchema, {...createEmptyLocalSheet(),title: plan.value.title,- engine: convertEngineToOld(- (specEngine ?? Engine.ENGINE_UNSPECIFIED) as Engine- ),+ engine: specEngine+ ,});setSheetStatement(sheet, statement);const createdSheet = await useSheetV1Store().createSheet(diff --git a/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts b/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.tsindex 7157644efa..b227a2a142 100644--- a/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts+++ b/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts@@ -6,7 +6,7 @@ import {PlanCheckRun_Result_Status,PlanCheckRun_Type,} from "@/types/proto/v1/plan_service";-import { Advice_Status, type Advice } from "@/types/proto/v1/sql_service";+import { Advice_Status, type Advice } from "@/types/proto-es/v1/sql_service_pb";import { extractPlanCheckRunUID } from "@/utils";export const useSQLAdviceMarkers = (diff --git a/frontend/src/components/Plan/logic/sheet.ts b/frontend/src/components/Plan/logic/sheet.tsindex aa91f98bec..5601b01fae 100644--- a/frontend/src/components/Plan/logic/sheet.ts+++ b/frontend/src/components/Plan/logic/sheet.ts@@ -1,5 +1,7 @@import { reactive } from "vue";-import { Sheet } from "@/types/proto/v1/sheet_service";+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";+import { create } from "@bufbuild/protobuf";+import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";const state = {uid: -101,@@ -12,7 +14,7 @@ const nextUID = () => {const sheetsByName = reactive(new Map<string, Sheet>());export const createEmptyLocalSheet = () => {- return reactive(Sheet.fromPartial({}));+ return reactive(create(SheetSchema, {}));};export const getNextLocalSheetUID = () => {diff --git a/frontend/src/components/Project/ProjectArchiveRestoreButton.vue b/frontend/src/components/Project/ProjectArchiveRestoreButton.vueindex 0ea5e4cfb8..b05c1cdf73 100644--- a/frontend/src/components/Project/ProjectArchiveRestoreButton.vue+++ b/frontend/src/components/Project/ProjectArchiveRestoreButton.vue@@ -1,6 +1,6 @@<template><template v-if="allowArchiveOrRestore">- <template v-if="project.state === convertStateToOld(State.ACTIVE)">+ <template v-if="project.state === State.ACTIVE"><BBButtonConfirm:type="'ARCHIVE'":button-text="$t('project.settings.archive.btn-text')"@@ -21,7 +21,7 @@</div></BBButtonConfirm></template>- <template v-else-if="project.state === convertStateToOld(State.DELETED)">+ <template v-else-if="project.state === State.DELETED"><BBButtonConfirm:type="'RESTORE'":button-text="$t('project.settings.restore.btn-text')"@@ -47,7 +47,6 @@ import { PROJECT_V1_ROUTE_DASHBOARD } from "@/router/dashboard/workspaceRoutes";import { useProjectV1Store } from "@/store";import type { ComposedProject } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";-import { convertStateToOld } from "@/utils/v1/common-conversions";import { hasWorkspacePermissionV2 } from "@/utils";const props = defineProps<{@@ -60,7 +59,7 @@ const router = useRouter();const force = ref(false);const allowArchiveOrRestore = computed(() => {- if (props.project.state === convertStateToOld(State.ACTIVE)) {+ if (props.project.state === State.ACTIVE) {return hasWorkspacePermissionV2("bb.projects.delete");}return hasWorkspacePermissionV2("bb.projects.undelete");diff --git a/frontend/src/components/Project/ProjectCreatePanel.vue b/frontend/src/components/Project/ProjectCreatePanel.vueindex 27b89b90b1..8f9137ff9d 100644--- a/frontend/src/components/Project/ProjectCreatePanel.vue+++ b/frontend/src/components/Project/ProjectCreatePanel.vue@@ -76,7 +76,7 @@ import { projectNamePrefix } from "@/store/modules/v1/common";import { useProjectV1Store } from "@/store/modules/v1/project";import type { ComposedProject } from "@/types";import { emptyProject } from "@/types";-import type { Project } from "@/types/proto/v1/project_service";+import type { Project } from "@/types/proto-es/v1/project_service_pb";import { hasWorkspacePermissionV2 } from "@/utils";interface LocalState {diff --git a/frontend/src/components/Project/Settings/ProjectGeneralSettingPanel.vue b/frontend/src/components/Project/Settings/ProjectGeneralSettingPanel.vueindex ddae38582d..757974fb16 100644--- a/frontend/src/components/Project/Settings/ProjectGeneralSettingPanel.vue+++ b/frontend/src/components/Project/Settings/ProjectGeneralSettingPanel.vue@@ -29,7 +29,7 @@ import { computed, reactive } from "vue";import ResourceIdField from "@/components/v2/Form/ResourceIdField.vue";import { useProjectV1Store } from "@/store";import { DEFAULT_PROJECT_NAME } from "@/types";-import type { Project } from "@/types/proto/v1/project_service";+import type { Project } from "@/types/proto-es/v1/project_service_pb";import { extractProjectResourceName } from "@/utils";interface LocalState {diff --git a/frontend/src/components/Project/Settings/ProjectIssueRelatedSettingPanel.vue b/frontend/src/components/Project/Settings/ProjectIssueRelatedSettingPanel.vueindex 89762a8c36..eb4b3bc012 100644--- a/frontend/src/components/Project/Settings/ProjectIssueRelatedSettingPanel.vue+++ b/frontend/src/components/Project/Settings/ProjectIssueRelatedSettingPanel.vue@@ -269,11 +269,16 @@import { Switch } from "@/components/v2";import { useProjectV1Store } from "@/store";import type { ComposedProject } from "@/types";-import {+import type {Label,Project_ExecutionRetryPolicy,-} from "@/types/proto/v1/project_service";+} from "@/types/proto-es/v1/project_service_pb";+import {+ LabelSchema,+ Project_ExecutionRetryPolicySchema,+} from "@/types/proto-es/v1/project_service_pb";import { cloneDeep, isEqual } from "lodash-es";+import { create as createProto } from "@bufbuild/protobuf";import { TriangleAlertIcon } from "lucide-vue-next";import {NColorPicker,@@ -344,11 +349,11 @@ const onLabelsUpdate = (values: string[]) => {if (new Set(labelValues.value).has(newValue)) {return;}- state.issueLabels.push({+ state.issueLabels.push(createProto(LabelSchema, {color: defaultColor,value: newValue,group: "",- });+ }));};const renderLabel = (value: string, index: number) => {@@ -469,7 +474,7 @@ const updateMask = computed(() => {const handleInput = (value: number | null) => {if (value === null) return;if (value === undefined) return;- state.executionRetryPolicy = Project_ExecutionRetryPolicy.create({+ state.executionRetryPolicy = createProto(Project_ExecutionRetryPolicySchema, {maximumRetries: value,});};diff --git a/frontend/src/components/Project/WebhookTypeIcon.vue b/frontend/src/components/Project/WebhookTypeIcon.vueindex d499bd4b85..2c3b8fb13e 100644--- a/frontend/src/components/Project/WebhookTypeIcon.vue+++ b/frontend/src/components/Project/WebhookTypeIcon.vue@@ -27,7 +27,7 @@</template><script setup lang="ts">-import { Webhook_Type } from "@/types/proto/v1/project_service";+import { Webhook_Type } from "@/types/proto-es/v1/project_service_pb";defineProps<{type: Webhook_Type;diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vueindex 0f899c1a19..b8d0ca3751 100644--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue@@ -142,7 +142,6 @@ import { PresetRoleType } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";import type { Binding } from "@/types/proto-es/v1/iam_policy_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { convertStateToOld } from "@/utils/v1/common-conversions";import { displayRoleTitle, checkRoleContainsAnyPermission } from "@/utils";import { convertFromExpr, buildConditionExpr } from "@/utils/issue/cel";import { getBindingIdentifier } from "../utils";@@ -207,7 +206,7 @@ const isDateDisabled = (date: number) => {};const allowRemoveRole = () => {- if (props.project.state === convertStateToOld(State.DELETED)) {+ if (props.project.state === State.DELETED) {return false;}diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vueindex 8e91dca6e3..edb124df91 100644--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue@@ -161,7 +161,6 @@ import { PresetRoleType, PRESET_ROLES } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";import type { Binding } from "@/types/proto-es/v1/iam_policy_pb";import { BindingSchema } from "@/types/proto-es/v1/iam_policy_pb";-import { convertStateToOld } from "@/utils/v1/common-conversions";import {displayRoleTitle,hasProjectPermissionV2,@@ -375,7 +374,7 @@ const getDataTableColumns = (// 1. Disallow removing the last OWNER.// 2. Allow workspace roles who can manage project. This helps when the project OWNER is no longer available.const allowRemoveRole = (role: string) => {- if (props.project.state === convertStateToOld(State.DELETED)) {+ if (props.project.state === State.DELETED) {return false;}if (props.binding.type === "groups") {diff --git a/frontend/src/components/ProjectWebhookForm.vue b/frontend/src/components/ProjectWebhookForm.vueindex b14d75b38e..2cc1265c78 100644--- a/frontend/src/components/ProjectWebhookForm.vue+++ b/frontend/src/components/ProjectWebhookForm.vue@@ -264,7 +264,7 @@ import {Webhook_Type,type Activity_Type,type Webhook,-} from "@/types/proto/v1/project_service";+} from "@/types/proto-es/v1/project_service_pb";import { Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";import { projectWebhookV1Slug } from "../utils";import WebhookTypeIcon from "./Project/WebhookTypeIcon.vue";diff --git a/frontend/src/components/ProjectWebhookPanel.vue b/frontend/src/components/ProjectWebhookPanel.vueindex b47527e76f..0760e54fbf 100644--- a/frontend/src/components/ProjectWebhookPanel.vue+++ b/frontend/src/components/ProjectWebhookPanel.vue@@ -31,8 +31,8 @@ import {PROJECT_V1_ROUTE_WEBHOOK_DETAIL,} from "@/router/dashboard/projectV1";import { projectWebhookV1ActivityItemList } from "@/types";-import type { Project, Webhook } from "@/types/proto/v1/project_service";-import { activity_TypeToJSON } from "@/types/proto/v1/project_service";+import type { Project, Webhook } from "@/types/proto-es/v1/project_service_pb";+import { Activity_Type } from "@/types/proto-es/v1/project_service_pb";import { projectWebhookV1Slug } from "@/utils";defineProps<{@@ -80,7 +80,7 @@ const columnList = computed((): DataTableColumn<Webhook>[] => {if (item) {return item.title;}- return activity_TypeToJSON(activity);+ return Activity_Type[activity] || `ACTIVITY_${activity}`;});return list.join(", ");diff --git a/frontend/src/components/SQLCheck/SQLCheckButton.vue b/frontend/src/components/SQLCheck/SQLCheckButton.vueindex 975175d56c..ad8a046942 100644--- a/frontend/src/components/SQLCheck/SQLCheckButton.vue+++ b/frontend/src/components/SQLCheck/SQLCheckButton.vue@@ -84,17 +84,13 @@ import {ReleaseFileType,Release_File_ChangeType,} from "@/types/proto-es/v1/release_service_pb";-import type { Advice } from "@/types/proto/v1/sql_service";+import type { Advice } from "@/types/proto-es/v1/sql_service_pb";import {- Advice as AdviceProto,+ AdviceSchema,Advice_Status,-} from "@/types/proto/v1/sql_service";+} from "@/types/proto-es/v1/sql_service_pb";import type { Defer, VueStyle } from "@/utils";import { defer } from "@/utils";-import {- convertNewAdviceArrayToOld,- convertOldAdviceArrayToNew,-} from "@/utils/v1/sql-conversions";import ErrorList from "../misc/ErrorList.vue";import SQLCheckPanel from "./SQLCheckPanel.vue";import SQLCheckSummary from "./SQLCheckSummary.vue";@@ -143,11 +139,10 @@ const filteredAdvices = computed(() => {const { adviceFilter } = props;const advices = checkResult.value?.results.flatMap((r) => r.advices);if (!advices) return undefined;- const oldAdvices = convertNewAdviceArrayToOld(advices);if (!adviceFilter) {- return oldAdvices;+ return advices;}- return oldAdvices?.filter(adviceFilter);+ return advices?.filter(adviceFilter);});const statementErrors = asyncComputed(async () => {@@ -207,14 +202,12 @@ const runChecks = async () => {checkResult.value = create(CheckReleaseResponseSchema, {results: [{- advices: convertOldAdviceArrayToNew(- errors.map((err) =>- AdviceProto.fromPartial({- title: "Pre check",- status: Advice_Status.WARNING,- content: err,- })- )+ advices: errors.map((err) =>+ create(AdviceSchema, {+ title: "Pre check",+ status: Advice_Status.WARNING,+ content: err,+ })),},],diff --git a/frontend/src/components/SQLCheck/SQLCheckPanel.vue b/frontend/src/components/SQLCheck/SQLCheckPanel.vueindex 658d04ebc7..b9d16e2332 100644--- a/frontend/src/components/SQLCheck/SQLCheckPanel.vue+++ b/frontend/src/components/SQLCheck/SQLCheckPanel.vue@@ -70,8 +70,8 @@ import {PlanCheckRun_Status,} from "@/types/proto/v1/plan_service";import { CheckReleaseResponse_RiskLevel } from "@/types/proto-es/v1/release_service_pb";-import type { Advice } from "@/types/proto/v1/sql_service";-import { Advice_Status } from "@/types/proto/v1/sql_service";+import type { Advice } from "@/types/proto-es/v1/sql_service_pb";+import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";import type { Defer } from "@/utils";const props = withDefaults(diff --git a/frontend/src/components/SQLCheck/SQLCheckSummary.vue b/frontend/src/components/SQLCheck/SQLCheckSummary.vueindex f8cbb2252d..10ff3a4f70 100644--- a/frontend/src/components/SQLCheck/SQLCheckSummary.vue+++ b/frontend/src/components/SQLCheck/SQLCheckSummary.vue@@ -16,8 +16,8 @@import { NButton } from "naive-ui";import { computed } from "vue";import type { ComposedDatabase } from "@/types";-import type { Advice } from "@/types/proto/v1/sql_service";-import { Advice_Status } from "@/types/proto/v1/sql_service";+import type { Advice } from "@/types/proto-es/v1/sql_service_pb";+import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";type Summary = {successCount: number;diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vue b/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vueindex 5fe2feef47..ccfc43e4c2 100644--- a/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vue+++ b/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vue@@ -11,7 +11,7 @@{{ suffix }}</slot>- <NTooltip v-if="convertStateToNew(project.state) === State.DELETED">+ <NTooltip v-if="project.state === State.DELETED"><template #trigger><heroicons-outline:archive class="w-4 h-4 text-control" /></template>@@ -26,8 +26,7 @@import { NTooltip } from "naive-ui";import { ProjectV1Name } from "@/components/v2";import { State } from "@/types/proto-es/v1/common_pb";-import { convertStateToNew } from "@/utils/v1/common-conversions";-import type { Project } from "@/types/proto/v1/project_service";+import type { Project } from "@/types/proto-es/v1/project_service_pb";import type { Mode } from "../DatabaseV1Table.vue";withDefaults(diff --git a/frontend/src/components/v2/Model/ProjectV1Name.vue b/frontend/src/components/v2/Model/ProjectV1Name.vueindex 87bdcf4c9f..59dd3620c2 100644--- a/frontend/src/components/v2/Model/ProjectV1Name.vue+++ b/frontend/src/components/v2/Model/ProjectV1Name.vue@@ -15,7 +15,7 @@import { NPerformantEllipsis } from "naive-ui";import { computed } from "vue";import { useRouter } from "vue-router";-import type { Project } from "@/types/proto/v1/project_service";+import type { Project } from "@/types/proto-es/v1/project_service_pb";import { autoProjectRoute, projectV1Name } from "@/utils";import HighlightLabelText from "./HighlightLabelText.vue";diff --git a/frontend/src/components/v2/Select/ProjectSelect.vue b/frontend/src/components/v2/Select/ProjectSelect.vueindex ac927f2d91..f1b740b2a1 100644--- a/frontend/src/components/v2/Select/ProjectSelect.vue+++ b/frontend/src/components/v2/Select/ProjectSelect.vue@@ -37,7 +37,7 @@ import {isValidProjectName,DEBOUNCE_SEARCH_DELAY,} from "@/types";-import type { Project } from "@/types/proto/v1/project_service";+import type { Project } from "@/types/proto-es/v1/project_service_pb";import { hasWorkspacePermissionV2, getDefaultPagination } from "@/utils";import ResourceSelect from "./ResourceSelect.vue";diff --git a/frontend/src/composables/useExecuteSQL.ts b/frontend/src/composables/useExecuteSQL.tsindex 445b697523..206d8ab05d 100644--- a/frontend/src/composables/useExecuteSQL.ts+++ b/frontend/src/composables/useExecuteSQL.ts@@ -1,20 +1,13 @@+import { create } from "@bufbuild/protobuf";+import { Code } from "@connectrpc/connect";+import { createContextValues } from "@connectrpc/connect";import Emittery from "emittery";import { head, isEmpty, cloneDeep } from "lodash-es";-import { Code } from "@connectrpc/connect";import { Status } from "nice-grpc-common";-import { create } from "@bufbuild/protobuf";-import { createContextValues } from "@connectrpc/connect";import { v4 as uuidv4 } from "uuid";import { markRaw, reactive } from "vue";import { sqlServiceClientConnect } from "@/grpcweb";import { ignoredCodesContextKey } from "@/grpcweb/context-key";-import {- CheckRequestSchema,- CheckRequest_ChangeType as NewCheckRequest_ChangeType,-} from "@/types/proto-es/v1/sql_service_pb";-import {- convertNewCheckResponseToOld,-} from "@/utils/v1/sql-conversions";import { t } from "@/plugins/i18n";import {pushNotification,@@ -39,14 +32,19 @@ import type {QueryDataSourceType,} from "@/types";import { isValidDatabaseName } from "@/types";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import { Engine } from "@/types/proto-es/v1/common_pb";import { DatabaseGroupView } from "@/types/proto-es/v1/database_group_service_pb";import {- Advice,+ CheckRequestSchema,+ CheckRequest_ChangeType as NewCheckRequest_ChangeType,+ QueryRequestSchema,+} from "@/types/proto-es/v1/sql_service_pb";+import type { Advice } from "@/types/proto-es/v1/sql_service_pb";+import {Advice_Status,- advice_StatusToJSON,-} from "@/types/proto/v1/sql_service";+ QueryOptionSchema,+} from "@/types/proto-es/v1/sql_service_pb";+import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import {getValidDataSourceByPolicy,hasPermissionToCreateChangeDatabaseIssue,@@ -137,13 +135,13 @@ const useExecuteSQL = () => {statement: params.statement,changeType: NewCheckRequest_ChangeType.SQL_EDITOR,});- const newResponse = await sqlServiceClientConnect.check(request, {- contextValues: createContextValues()- .set(ignoredCodesContextKey, [Code.PermissionDenied]),+ const response = await sqlServiceClientConnect.check(request, {+ contextValues: createContextValues().set(ignoredCodesContextKey, [+ Code.PermissionDenied,+ ]),signal: abortController?.signal,});- const response = convertNewCheckResponseToOld(newResponse);- const { advices } = response;+ const advices = response.advices;events.emit("update:advices", { tab, params, advices });return { passed: advices.length === 0, advices };};@@ -162,7 +160,7 @@ const useExecuteSQL = () => {adviceStatus = "WARNING";}- adviceNotifyMessage += `${advice_StatusToJSON(advice.status)}: ${+ adviceNotifyMessage += `${Advice_Status[advice.status]}: ${advice.title}\n`;if (advice.content) {@@ -402,7 +400,7 @@ const useExecuteSQL = () => {}const resultSet = await sqlStore.query(- {+ create(QueryRequestSchema, {name: database.name,dataSourceId: dataSourceId,statement: context.params.statement,@@ -410,10 +408,10 @@ const useExecuteSQL = () => {explain: context.params.explain,schema: context.params.connection.schema,container: context.params.connection.table,- queryOption: {+ queryOption: create(QueryOptionSchema, {redisRunCommandsOn: sqlEditorStore.redisCommandOption,- },- },+ }),+ }),abortController.signal);diff --git a/frontend/src/composables/utils.ts b/frontend/src/composables/utils.tsindex 3d7fbfb769..6dedc50a68 100644--- a/frontend/src/composables/utils.ts+++ b/frontend/src/composables/utils.ts@@ -1,8 +1,10 @@import { orderBy } from "lodash-es";import { stringify } from "uuid";+import { create as createProto } from "@bufbuild/protobuf";import type { SQLResultSetV1 } from "@/types";-import { NullValue } from "@/types/proto/google/protobuf/struct";-import { QueryRow, RowValue } from "@/types/proto/v1/sql_service";+import { NullValue } from "@bufbuild/protobuf/wkt";+import type { QueryRow, RowValue } from "@/types/proto-es/v1/sql_service_pb";+import { QueryRowSchema, RowValueSchema } from "@/types/proto-es/v1/sql_service_pb";type NoSQLRowData = {key: string;@@ -100,71 +102,99 @@ const convertAnyToRowValue = (case "number": {if (Math.floor(value) === value) {return {- value: RowValue.fromPartial({- int32Value: value,+ value: createProto(RowValueSchema, {+ kind: {+ case: "int32Value",+ value: value,+ },}),type: "INTEGER",};}return {- value: RowValue.fromPartial({- floatValue: value,+ value: createProto(RowValueSchema, {+ kind: {+ case: "floatValue",+ value: value,+ },}),type: "FLOAT",};}case "string":return {- value: RowValue.fromPartial({- stringValue: value,+ value: createProto(RowValueSchema, {+ kind: {+ case: "stringValue",+ value: value,+ },}),type: "TEXT",};case "undefined":return {- value: RowValue.fromPartial({- nullValue: NullValue.NULL_VALUE,+ value: createProto(RowValueSchema, {+ kind: {+ case: "nullValue",+ value: NullValue.NULL_VALUE,+ },}),type: "NULL",};case "boolean":return {- value: RowValue.fromPartial({- boolValue: value,+ value: createProto(RowValueSchema, {+ kind: {+ case: "boolValue",+ value: value,+ },}),type: "BOOLEAN",};case "bigint":return {- value: RowValue.fromPartial({- stringValue: value.toString(),+ value: createProto(RowValueSchema, {+ kind: {+ case: "stringValue",+ value: value.toString(),+ },}),type: "TEXT",};case "object": {if (value === null) {return {- value: RowValue.fromPartial({- nullValue: NullValue.NULL_VALUE,+ value: createProto(RowValueSchema, {+ kind: {+ case: "nullValue",+ value: NullValue.NULL_VALUE,+ },}),type: "NULL",};}if (Array.isArray(value)) {return {- value: RowValue.fromPartial({- stringValue: JSON.stringify(value.map(flattenNoSQLColumn)),+ value: createProto(RowValueSchema, {+ kind: {+ case: "stringValue",+ value: JSON.stringify(value.map(flattenNoSQLColumn)),+ },}),type: "OBJECT",};}if (value instanceof Date) {return {- value: RowValue.fromPartial({- timestampValue: {- googleTimestamp: {- seconds: Math.floor(value.getTime() / 1000),- nanos: (value.getTime() % 1000) * 1e6,+ value: createProto(RowValueSchema, {+ kind: {+ case: "timestampValue",+ value: {+ googleTimestamp: {+ seconds: BigInt(Math.floor(value.getTime() / 1000)),+ nanos: (value.getTime() % 1000) * 1e6,+ },+ accuracy: 6,},},}),@@ -177,8 +207,11 @@ const convertAnyToRowValue = (return convertAnyToRowValue(formatted, !nested);} else {return {- value: RowValue.fromPartial({- stringValue: JSON.stringify(value),+ value: createProto(RowValueSchema, {+ kind: {+ case: "stringValue",+ value: JSON.stringify(value),+ },}),type: "TEXT",};@@ -186,8 +219,11 @@ const convertAnyToRowValue = (}default:return {- value: RowValue.fromPartial({- stringValue: JSON.stringify(value),+ value: createProto(RowValueSchema, {+ kind: {+ case: "stringValue",+ value: JSON.stringify(value),+ },}),type: "TEXT",};@@ -204,14 +240,17 @@ export const flattenNoSQLResult = (resultSet: SQLResultSetV1) => {}).map((_) => "TEXT");for (const row of result.rows) {- if (row.values.length !== 1 || !row.values[0].stringValue) {+ if (row.values.length !== 1 || row.values[0].kind.case !== "stringValue") {continue;}- const data = JSON.parse(row.values[0].stringValue);+ const data = JSON.parse(row.values[0].kind.value);const values: RowValue[] = Array.from({ length: columns.length }).map((_) =>- RowValue.fromPartial({- nullValue: NullValue.NULL_VALUE,+ createProto(RowValueSchema, {+ kind: {+ case: "nullValue",+ value: NullValue.NULL_VALUE,+ },}));@@ -224,7 +263,7 @@ export const flattenNoSQLResult = (resultSet: SQLResultSetV1) => {}rows.push(- QueryRow.fromPartial({+ createProto(QueryRowSchema, {values: values,}));@@ -279,10 +318,10 @@ const getNoSQLColumns = (rows: QueryRow[]) => {};const getNoSQLRows = (row: QueryRow): NoSQLRowData[] | undefined => {- if (row.values.length !== 1 || !row.values[0].stringValue) {+ if (row.values.length !== 1 || row.values[0].kind.case !== "stringValue") {return;}- const parsedRow = JSON.parse(row.values[0].stringValue) as {+ const parsedRow = JSON.parse(row.values[0].kind.value) as {[key: string]: any;};const results: NoSQLRowData[] = [];diff --git a/frontend/src/layouts/ProjectV1Layout.vue b/frontend/src/layouts/ProjectV1Layout.vueindex 6ca9e18350..2448bd6864 100644--- a/frontend/src/layouts/ProjectV1Layout.vue+++ b/frontend/src/layouts/ProjectV1Layout.vue@@ -1,6 +1,6 @@<template><template v-if="initialized">- <ArchiveBanner v-if="convertStateToNew(project.state) === State.DELETED" class="py-2" />+ <ArchiveBanner v-if="project.state === State.DELETED" class="py-2" /><template v-if="isDefaultProject"><h1 class="mb-4 text-xl font-bold leading-6 text-main truncate">{{ $t("database.unassigned-databases") }}@@ -95,7 +95,6 @@ import {} from "@/types";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import { State } from "@/types/proto-es/v1/common_pb";-import { convertStateToNew } from "@/utils/v1/common-conversions";import { hasProjectPermissionV2 } from "@/utils";import { useBodyLayoutContext } from "./common";@@ -178,7 +177,7 @@ const hasPermission = computed(() => {});const allowEdit = computed(() => {- if (convertStateToNew(project.value.state) === State.DELETED) {+ if (project.value.state === State.DELETED) {return false;}@@ -195,7 +194,7 @@ const hasRequestRoleFeature = featureToRef();const quickActionListForDatabase = computed(() => {- if (convertStateToNew(project.value.state) !== State.ACTIVE) {+ if (project.value.state !== State.ACTIVE) {return [];}diff --git a/frontend/src/plugins/ai/components/ChatPanel.vue b/frontend/src/plugins/ai/components/ChatPanel.vueindex 7e4fe0b006..c38ed5a340 100644--- a/frontend/src/plugins/ai/components/ChatPanel.vue+++ b/frontend/src/plugins/ai/components/ChatPanel.vue@@ -32,13 +32,14 @@ import { head } from "lodash-es";import { NSpin } from "naive-ui";import { storeToRefs } from "pinia";import { reactive, watch } from "vue";+import { create as createProto } from "@bufbuild/protobuf";import { sqlServiceClientConnect } from "@/grpcweb";import {convertOldAICompletionRequestToNew,convertNewAICompletionResponseToOld,} from "@/utils/v1/sql-conversions";import { useSQLEditorTabStore } from "@/store";-import { type AICompletionRequest_Message } from "@/types/proto/v1/sql_service";+import { type AICompletionRequest_Message, AICompletionRequest_MessageSchema } from "@/types/proto-es/v1/sql_service_pb";import { nextAnimationFrame } from "@/utils";import { onConnectionChanged, useAIContext, useCurrentChat } from "../logic";import * as promptUtils from "../logic/prompt";@@ -117,10 +118,10 @@ const requestAI = async (query: string) => {const messages: AICompletionRequest_Message[] = [];conversation.messageList.forEach((message) => {const { author, prompt } = message;- messages.push({+ messages.push(createProto(AICompletionRequest_MessageSchema, {role: author === "USER" ? "user" : "assistant",content: prompt,- });+ }));});state.loading = true;try {diff --git a/frontend/src/plugins/ai/logic/useDynamicSuggestions.ts b/frontend/src/plugins/ai/logic/useDynamicSuggestions.tsindex 90103b278d..89c7b4007a 100644--- a/frontend/src/plugins/ai/logic/useDynamicSuggestions.ts+++ b/frontend/src/plugins/ai/logic/useDynamicSuggestions.ts@@ -1,5 +1,6 @@import { head, uniq, values } from "lodash-es";import { computed, reactive, ref } from "vue";+import { create as createProto } from "@bufbuild/protobuf";import { hashCode } from "@/bbkit/BBUtil";import { sqlServiceClientConnect } from "@/grpcweb";@@ -8,7 +9,7 @@ import {convertOldAICompletionRequestToNew,convertNewAICompletionResponseToOld,} from "@/utils/v1/sql-conversions";-import { type AICompletionRequest_Message } from "@/types/proto/v1/sql_service";+import { type AICompletionRequest_Message, AICompletionRequest_MessageSchema } from "@/types/proto-es/v1/sql_service_pb";import { WebStorageHelper } from "@/utils";import { useAIContext } from "./context";import * as promptUtils from "./prompt";@@ -94,14 +95,14 @@ export const useDynamicSuggestions = () => {new Set([...used.values(), ...suggestions]));const messages: AICompletionRequest_Message[] = [- {+ createProto(AICompletionRequest_MessageSchema, {role: "system",content: command,- },- {+ }),+ createProto(AICompletionRequest_MessageSchema, {role: "user",content: prompt,- },+ }),];console.debug("[DynamicSuggestions]");console.debug(command);diff --git a/frontend/src/store/modules/sqlEditor/editor.ts b/frontend/src/store/modules/sqlEditor/editor.tsindex b0b578f09c..499f4bd9ff 100644--- a/frontend/src/store/modules/sqlEditor/editor.ts+++ b/frontend/src/store/modules/sqlEditor/editor.ts@@ -2,7 +2,7 @@ import { useLocalStorage } from "@vueuse/core";import { defineStore } from "pinia";import { computed, ref, watch } from "vue";import { type ComposedDatabase, isValidProjectName } from "@/types";-import { QueryOption_RedisRunCommandsOn } from "@/types/proto/v1/sql_service";+import { QueryOption_RedisRunCommandsOn } from "@/types/proto-es/v1/sql_service_pb";import { hasWorkspacePermissionV2 } from "@/utils";export const useSQLEditorStore = defineStore("sqlEditor", () => {diff --git a/frontend/src/store/modules/sqlEditor/queryHistory.ts b/frontend/src/store/modules/sqlEditor/queryHistory.tsindex 608d646385..e57fd01a1e 100644--- a/frontend/src/store/modules/sqlEditor/queryHistory.ts+++ b/frontend/src/store/modules/sqlEditor/queryHistory.ts@@ -3,11 +3,8 @@ import { defineStore } from "pinia";import { reactive } from "vue";import { sqlServiceClientConnect } from "@/grpcweb";import { SearchQueryHistoriesRequestSchema } from "@/types/proto-es/v1/sql_service_pb";-import {- convertNewSearchQueryHistoriesResponseToOld,-} from "@/utils/v1/sql-conversions";import { isValidProjectName, isValidDatabaseName } from "@/types";-import type { QueryHistory } from "@/types/proto/v1/sql_service";+import type { QueryHistory } from "@/types/proto-es/v1/sql_service_pb";export interface QueryHistoryFilter {statement?: string;@@ -67,8 +64,7 @@ export const useSQLEditorQueryHistoryStore = defineStore(pageToken,filter: getListQueryHistoryFilter(filter),});- const newResp = await sqlServiceClientConnect.searchQueryHistories(request);- const resp = convertNewSearchQueryHistoriesResponseToOld(newResp);+ const resp = await sqlServiceClientConnect.searchQueryHistories(request);queryHistoryMap.get(key)!.nextPageToken = resp.nextPageToken;if (pageToken) {diff --git a/frontend/src/store/modules/sqlEditor/webTerminal.ts b/frontend/src/store/modules/sqlEditor/webTerminal.tsindex ab13783cbc..d2119678fb 100644--- a/frontend/src/store/modules/sqlEditor/webTerminal.ts+++ b/frontend/src/store/modules/sqlEditor/webTerminal.ts@@ -1,4 +1,4 @@-import { create } from "@bufbuild/protobuf";+import { create, fromJson } from "@bufbuild/protobuf";import { type Duration, DurationSchema } from "@bufbuild/protobuf/wkt";import Emittery from "emittery";import { uniqueId } from "lodash-es";@@ -18,10 +18,16 @@ import type {SQLEditorQueryParams,} from "@/types";import {+ AdminExecuteRequestSchema,+ AdminExecuteResponseSchema,+ QueryResult_Message_Level,+ QueryResultSchema,+} from "@/types/proto-es/v1/sql_service_pb";+import type {AdminExecuteRequest,AdminExecuteResponse,QueryResult,-} from "@/types/proto/v1/sql_service";+} from "@/types/proto-es/v1/sql_service_pb";import {extractGrpcErrorMessage,getErrorCode as extractGrpcStatusCode,@@ -146,7 +152,7 @@ const createStreamingQueryController = () => {result.latency = parseDuration(result.latency);});}- const response = AdminExecuteResponse.fromJSON(data.result);+ const response = fromJson(AdminExecuteResponseSchema, data.result);subscriber.next(response);} else if (data.error) {const err = new ClientError(@@ -269,7 +275,7 @@ const useQueryStateLogic = (qs: WebTerminalQueryState) => {pushNotification({module: "bytebase",style: "INFO",- title: message.level,+ title: QueryResult_Message_Level[message.level],description: message.content,});}@@ -279,7 +285,7 @@ const useQueryStateLogic = (qs: WebTerminalQueryState) => {};export const mockAffectedV1Rows0 = (): QueryResult => {- return QueryResult.fromPartial({+ return create(QueryResultSchema, {columnNames: ["Affected Rows"],columnTypeNames: ["BIGINT"],masked: [false],@@ -289,7 +295,10 @@ export const mockAffectedV1Rows0 = (): QueryResult => {{values: [{- int64Value: 0,+ kind: {+ case: "int64Value",+ value: BigInt(0),+ },},],},@@ -301,7 +310,7 @@ const mapRequest = (params: SQLEditorQueryParams): AdminExecuteRequest => {const { connection, statement, explain } = params;const database = useDatabaseV1Store().getDatabaseByName(connection.database);- const request = AdminExecuteRequest.fromPartial({+ const request = create(AdminExecuteRequestSchema, {name: database.name,statement: explain ? `EXPLAIN ${statement}` : statement,schema: connection.schema,diff --git a/frontend/src/store/modules/v1/localSheet.ts b/frontend/src/store/modules/v1/localSheet.tsindex 03da35c3e8..de5b4bf070 100644--- a/frontend/src/store/modules/v1/localSheet.ts+++ b/frontend/src/store/modules/v1/localSheet.ts@@ -1,7 +1,8 @@import { defineStore } from "pinia";import { reactive } from "vue";-import type { DeepPartial } from "@/types/proto/v1/sheet_service";-import { Sheet } from "@/types/proto/v1/sheet_service";+import { create as createProto } from "@bufbuild/protobuf";+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";+import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";import { extractProjectResourceName } from "@/utils";import { useSheetV1Store } from "./sheet";@@ -22,14 +23,19 @@ export const useLocalSheetStore = defineStore("local_sheet", () => {const createLocalSheet = (name: string,- defaults: DeepPartial<Sheet> = {}+ defaults: Partial<Sheet> = {}) => {- return reactive(- Sheet.fromPartial({- name,- ...defaults,- })- );+ const sheet = createProto(SheetSchema, {+ name,+ title: defaults.title || "",+ creator: defaults.creator || "",+ content: defaults.content || new Uint8Array(),+ contentSize: defaults.contentSize || BigInt(0),+ engine: defaults.engine,+ payload: defaults.payload,+ createTime: defaults.createTime,+ });+ return reactive(sheet);};const getOrCreateSheetByName = (name: string) => {diff --git a/frontend/src/store/modules/v1/project.ts b/frontend/src/store/modules/v1/project.tsindex f31177870d..5aac47d096 100644--- a/frontend/src/store/modules/v1/project.ts+++ b/frontend/src/store/modules/v1/project.ts@@ -16,7 +16,10 @@ import {DEFAULT_PROJECT_NAME,isValidProjectName,} from "@/types";-import { State as NewState } from "@/types/proto-es/v1/common_pb";+import { State } from "@/types/proto-es/v1/common_pb";+import type {+ Project,+} from "@/types/proto-es/v1/project_service_pb";import {GetProjectRequestSchema,ListProjectsRequestSchema,@@ -27,23 +30,14 @@ import {BatchDeleteProjectsRequestSchema,UndeleteProjectRequestSchema,} from "@/types/proto-es/v1/project_service_pb";-import type {- Project,- ListProjectsResponse,-} from "@/types/proto/v1/project_service";import { hasWorkspacePermissionV2 } from "@/utils";-import { convertStateToOld } from "@/utils/v1/common-conversions";-import {- convertNewProjectToOld,- convertOldProjectToNew,-} from "@/utils/v1/project-conversions";import { projectNamePrefix } from "./common";import { useProjectIamPolicyStore } from "./projectIamPolicy";export interface ProjectFilter {query?: string;excludeDefault?: boolean;- state?: NewState;+ state?: State;}const getListProjectFilter = (params: ProjectFilter) => {@@ -57,8 +51,8 @@ const getListProjectFilter = (params: ProjectFilter) => {if (params.excludeDefault) {list.push("exclude_default == true");}- if (params.state === NewState.DELETED) {- list.push(`state == "${convertStateToOld(params.state)}"`);+ if (params.state === State.DELETED) {+ list.push(`state == "${State[params.state]}"`);}return list.join(" && ");};@@ -96,7 +90,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {return projectList.value;}return projectList.value.filter(- (project) => project.state === convertStateToOld(NewState.ACTIVE)+ (project) => project.state === State.ACTIVE);};const getProjectByName = (name: string) => {@@ -110,9 +104,8 @@ export const useProjectV1Store = defineStore("project_v1", () => {const response = await projectServiceClientConnect.getProject(request, {contextValues: createContextValues().set(silentContextKey, silent),});- const project = convertNewProjectToOld(response);- await upsertProjectMap([project]);- return project as ComposedProject;+ await upsertProjectMap([response]);+ return response as ComposedProject;};const fetchProjectList = async (params: {@@ -129,7 +122,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {params.silent ?? true);- let response: ListProjectsResponse | undefined = undefined;+ let response: { projects: Project[]; nextPageToken: string } | undefined = undefined;let pageToken = params.pageToken;while (true) {let resp;@@ -138,14 +131,14 @@ export const useProjectV1Store = defineStore("project_v1", () => {...params,pageToken,filter: getListProjectFilter(params.filter ?? {}),- showDeleted: params.filter?.state === NewState.DELETED ? true : false,+ showDeleted: params.filter?.state === State.DELETED ? true : false,});const connectResponse = await projectServiceClientConnect.listProjects(request,{ contextValues });resp = {- projects: connectResponse.projects.map(convertNewProjectToOld),+ projects: connectResponse.projects,nextPageToken: connectResponse.nextPageToken,};} else {@@ -153,14 +146,14 @@ export const useProjectV1Store = defineStore("project_v1", () => {...params,pageToken,filter: getListProjectFilter(params.filter ?? {}),- showDeleted: params.filter?.state === NewState.DELETED ? true : false,+ showDeleted: params.filter?.state === State.DELETED ? true : false,});const connectResponse =await projectServiceClientConnect.searchProjects(request, {contextValues,});resp = {- projects: connectResponse.projects.map(convertNewProjectToOld),+ projects: connectResponse.projects,nextPageToken: connectResponse.nextPageToken,};}@@ -176,7 +169,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {return {projects: composedProjects,- nextPageToken: (response as ListProjectsResponse).nextPageToken,+ nextPageToken: response.nextPageToken,};};@@ -196,22 +189,20 @@ export const useProjectV1Store = defineStore("project_v1", () => {};const createProject = async (project: Project, resourceId: string) => {const request = create(CreateProjectRequestSchema, {- project: convertOldProjectToNew(project),+ project,projectId: resourceId,});const response = await projectServiceClientConnect.createProject(request);- const created = convertNewProjectToOld(response);- const composed = await upsertProjectMap([created]);+ const composed = await upsertProjectMap([response]);return composed[0];};const updateProject = async (project: Project, updateMask: string[]) => {const request = create(UpdateProjectRequestSchema, {- project: convertOldProjectToNew(project),+ project,updateMask: { paths: updateMask },});const response = await projectServiceClientConnect.updateProject(request);- const updated = convertNewProjectToOld(response);- const composed = await upsertProjectMap([updated]);+ const composed = await upsertProjectMap([response]);return composed[0];};const archiveProject = async (project: Project, force = false) => {@@ -220,7 +211,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {force,});await projectServiceClientConnect.deleteProject(request);- project.state = convertStateToOld(NewState.DELETED);+ project.state = State.DELETED;await upsertProjectMap([project]);};const batchDeleteProjects = async (projectNames: string[], force = false) => {@@ -236,7 +227,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {if (project && project.name !== UNKNOWN_PROJECT_NAME) {// Extract Project properties (excluding iamPolicy)const { iamPolicy: _iamPolicy, ...projectData } = project;- return { ...projectData, state: convertStateToOld(NewState.DELETED) };+ return { ...projectData, state: State.DELETED };}return null;})@@ -251,8 +242,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {name: project.name,});const response = await projectServiceClientConnect.undeleteProject(request);- const restored = convertNewProjectToOld(response);- await upsertProjectMap([restored]);+ await upsertProjectMap([response]);};return {diff --git a/frontend/src/store/modules/v1/projectWebhook.ts b/frontend/src/store/modules/v1/projectWebhook.tsindex 621ac363f8..1dad8c54e9 100644--- a/frontend/src/store/modules/v1/projectWebhook.ts+++ b/frontend/src/store/modules/v1/projectWebhook.ts@@ -2,14 +2,13 @@ import { defineStore } from "pinia";import { create } from "@bufbuild/protobuf";import { projectServiceClientConnect } from "@/grpcweb";import type { IdType } from "@/types";-import type { Project, Webhook } from "@/types/proto/v1/project_service";+import type { Project, Webhook } from "@/types/proto-es/v1/project_service_pb";import {AddWebhookRequestSchema,UpdateWebhookRequestSchema,RemoveWebhookRequestSchema,TestWebhookRequestSchema,} from "@/types/proto-es/v1/project_service_pb";-import { convertNewProjectToOld, convertOldWebhookToNew } from "@/utils/v1/project-conversions";import { extractProjectWebhookID } from "@/utils";export const useProjectWebhookV1Store = defineStore("projectWebhook_v1", () => {@@ -27,33 +26,33 @@ export const useProjectWebhookV1Store = defineStore("projectWebhook_v1", () => {const createProjectWebhook = async (project: string, webhook: Webhook) => {const request = create(AddWebhookRequestSchema, {project,- webhook: convertOldWebhookToNew(webhook),+ webhook,});const response = await projectServiceClientConnect.addWebhook(request);- return convertNewProjectToOld(response);+ return response;};const updateProjectWebhook = async (webhook: Webhook,updateMask: string[]) => {const request = create(UpdateWebhookRequestSchema, {- webhook: convertOldWebhookToNew(webhook),+ webhook,updateMask: { paths: updateMask },});const response = await projectServiceClientConnect.updateWebhook(request);- return convertNewProjectToOld(response);+ return response;};const deleteProjectWebhook = async (webhook: Webhook) => {const request = create(RemoveWebhookRequestSchema, {- webhook: convertOldWebhookToNew(webhook),+ webhook,});const response = await projectServiceClientConnect.removeWebhook(request);- return convertNewProjectToOld(response);+ return response;};const testProjectWebhook = async (project: Project, webhook: Webhook) => {const request = create(TestWebhookRequestSchema, {project: project.name,- webhook: convertOldWebhookToNew(webhook),+ webhook,});const response = await projectServiceClientConnect.testWebhook(request);return {diff --git a/frontend/src/store/modules/v1/sheet.ts b/frontend/src/store/modules/v1/sheet.tsindex 5d6d83011c..5243a49bd8 100644--- a/frontend/src/store/modules/v1/sheet.ts+++ b/frontend/src/store/modules/v1/sheet.ts@@ -5,16 +5,15 @@ import { sheetServiceClientConnect } from "@/grpcweb";import { useCache } from "@/store/cache";import type { MaybeRef } from "@/types";import { UNKNOWN_ID } from "@/types";-import { Sheet } from "@/types/proto/v1/sheet_service";+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";+import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";import { Engine } from "@/types/proto-es/v1/common_pb";import {CreateSheetRequestSchema,GetSheetRequestSchema,UpdateSheetRequestSchema} from "@/types/proto-es/v1/sheet_service_pb";-import { convertNewSheetToOld, convertOldSheetToNew } from "@/utils/v1/sheet-conversions";import { extractSheetUID, getSheetStatement } from "@/utils";-import { convertEngineToOld } from "@/utils/v1/common-conversions";export type SheetView = "FULL" | "BASIC";type SheetCacheKey = [string /* uid */, SheetView];@@ -43,26 +42,32 @@ export const useSheetV1Store = defineStore("sheet_v1", () => {// CRUDconst createSheet = async (parent: string, sheet: Partial<Sheet>) => {- if (!sheet.engine || sheet.engine === convertEngineToOld(Engine.ENGINE_UNSPECIFIED)) {- const engineStr = sheet.engine || "<undefined>";+ if (!sheet.engine) {console.warn(- `[SheetService.CreateSheet] sheet.engine unspecified: ${engineStr}`+ `[SheetService.CreateSheet] sheet.engine unspecified: ${sheet.engine}`);-- sheet.engine = convertEngineToOld(Engine.ENGINE_UNSPECIFIED);+ sheet.engine = Engine.ENGINE_UNSPECIFIED;}- const fullSheet = Sheet.fromPartial(sheet);+ const fullSheet = create(SheetSchema, {+ name: sheet.name || "",+ title: sheet.title || "",+ creator: sheet.creator || "",+ content: sheet.content || new Uint8Array(),+ contentSize: sheet.contentSize || BigInt(0),+ engine: sheet.engine || Engine.MYSQL,+ payload: sheet.payload,+ createTime: sheet.createTime,+ });const request = create(CreateSheetRequestSchema, {parent,- sheet: convertOldSheetToNew(fullSheet),+ sheet: fullSheet,});const response = await sheetServiceClientConnect.createSheet(request);- const created = convertNewSheetToOld(response);- setCache(created, "FULL");+ setCache(response, "FULL");if (sheet.name) {removeLocalSheet(sheet.name);}- return created;+ return response;};/**@@ -114,8 +119,7 @@ export const useSheetV1Store = defineStore("sheet_v1", () => {raw: view === "FULL",});const response = await sheetServiceClientConnect.getSheet(request);- const sheet = convertNewSheetToOld(response);- return sheet;+ return response;} catch {return undefined;}@@ -152,15 +156,23 @@ export const useSheetV1Store = defineStore("sheet_v1", () => {const patchSheetContent = async (sheet: Partial<Sheet>) => {if (!sheet.name) return;- const fullSheet = Sheet.fromPartial(sheet);+ const fullSheet = create(SheetSchema, {+ name: sheet.name || "",+ title: sheet.title || "",+ creator: sheet.creator || "",+ content: sheet.content || new Uint8Array(),+ contentSize: sheet.contentSize || BigInt(0),+ engine: sheet.engine || Engine.MYSQL,+ payload: sheet.payload,+ createTime: sheet.createTime,+ });const request = create(UpdateSheetRequestSchema, {- sheet: convertOldSheetToNew(fullSheet),+ sheet: fullSheet,updateMask: { paths: ["content"] },});const response = await sheetServiceClientConnect.updateSheet(request);- const updated = convertNewSheetToOld(response);- setCache(updated, "FULL");- return updated;+ setCache(response, "FULL");+ return response;};return {diff --git a/frontend/src/store/modules/v1/sql.ts b/frontend/src/store/modules/v1/sql.tsindex 86c4e67d8c..e96bd082ab 100644--- a/frontend/src/store/modules/v1/sql.ts+++ b/frontend/src/store/modules/v1/sql.ts@@ -1,4 +1,5 @@import { Code, ConnectError, createContextValues } from "@connectrpc/connect";+import { create as createProto } from "@bufbuild/protobuf";import { Status } from "nice-grpc-common";import { defineStore } from "pinia";import { sqlServiceClientConnect } from "@/grpcweb";@@ -8,16 +9,13 @@ import {} from "@/grpcweb/context-key";import type { SQLResultSetV1 } from "@/types";import { PlanCheckRun_ResultSchema } from "@/types/proto-es/v1/plan_service_pb";-import type { ExportRequest, QueryRequest } from "@/types/proto/v1/sql_service";-import { Advice } from "@/types/proto/v1/sql_service";-import { Advice_Status } from "@/types/proto/v1/sql_service";+import type { ExportRequest, QueryRequest } from "@/types/proto-es/v1/sql_service_pb";+import {+ type Advice,+ AdviceSchema,+ Advice_Status+} from "@/types/proto-es/v1/sql_service_pb";import { extractGrpcErrorMessage } from "@/utils/grpcweb";-import {- convertOldQueryRequestToNew,- convertNewQueryResponseToOld,- convertOldExportRequestToNew,- convertNewExportResponseToOld,-} from "@/utils/v1/sql-conversions";const convertCodeToStatus = (code: Code): Status => {// Map Connect Code to nice-grpc Status@@ -51,7 +49,7 @@ export const getSqlReviewReports = (err: unknown): Advice[] => {column: report.report.value.column,}: undefinedadvices.push(- Advice.fromPartial({+ createProto(AdviceSchema, {status: Advice_Status.ERROR,code: report.code,title: report.title || "SQL Review Failed",@@ -70,8 +68,7 @@ export const useSQLStore = defineStore("sql", () => {signal: AbortSignal): Promise<SQLResultSetV1> => {try {- const newRequest = convertOldQueryRequestToNew(params);- const newResponse = await sqlServiceClientConnect.query(newRequest, {+ const newResponse = await sqlServiceClientConnect.query(params, {// Skip global error handling since we will handle and display// errors manually.contextValues: createContextValues()@@ -79,12 +76,10 @@ export const useSQLStore = defineStore("sql", () => {.set(silentContextKey, true),signal,});- const response = convertNewQueryResponseToOld(newResponse);-return {error: "",advices: [],- ...response,+ results: newResponse.results,};} catch (err) {return {@@ -100,15 +95,13 @@ export const useSQLStore = defineStore("sql", () => {};const exportData = async (params: ExportRequest) => {- const newRequest = convertOldExportRequestToNew(params);- const newResponse = await sqlServiceClientConnect.export(newRequest, {+ const newResponse = await sqlServiceClientConnect.export(params, {// Won't jump to 403 page when permission denied.contextValues: createContextValues().set(ignoredCodesContextKey, [Code.PermissionDenied,]),});- const response = convertNewExportResponseToOld(newResponse);- return response.content;+ return newResponse.content;};return {diff --git a/frontend/src/store/modules/v1/worksheet.ts b/frontend/src/store/modules/v1/worksheet.tsindex af9e7fbaa1..74cadb6d7b 100644--- a/frontend/src/store/modules/v1/worksheet.ts+++ b/frontend/src/store/modules/v1/worksheet.ts@@ -15,22 +15,16 @@ import {SearchWorksheetsRequestSchema,UpdateWorksheetOrganizerRequestSchema,} from "@/types/proto-es/v1/worksheet_service_pb";-import type { WorksheetOrganizer } from "@/types/proto/v1/worksheet_service";-import {- Worksheet_Visibility,+import type { WorksheetOrganizer } from "@/types/proto-es/v1/worksheet_service_pb";+import type {Worksheet,-} from "@/types/proto/v1/worksheet_service";+} from "@/types/proto-es/v1/worksheet_service_pb";import {extractWorksheetUID,getSheetStatement,isWorksheetWritableV1,getStatementSize,} from "@/utils";-import {- convertOldWorksheetToNew,- convertNewWorksheetToOld,- convertOldWorksheetOrganizerToNew,-} from "@/utils/v1/worksheet-conversions";import { useSQLEditorTabStore } from "../sqlEditor";import { useUserStore } from "../user";import { useCurrentUserV1 } from "./auth";@@ -108,21 +102,17 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {};// CRUD- const createWorksheet = async (worksheet: Partial<Worksheet>) => {+ const createWorksheet = async (worksheet: Worksheet) => {const fullWorksheet = worksheet.name? worksheet: { ...worksheet, name: "" };- const newWorksheet = convertOldWorksheetToNew(- Worksheet.create(fullWorksheet)- );const request = create(CreateWorksheetRequestSchema, {- worksheet: newWorksheet,+ worksheet: fullWorksheet,});const response =await worksheetServiceClientConnect.createWorksheet(request);- const created = convertNewWorksheetToOld(response);- await setCache(created, "FULL");- return created;+ await setCache(response, "FULL");+ return response;};/**@@ -165,8 +155,7 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {contextValues: createContextValues().set(silentContextKey, silent),});- const worksheet = convertNewWorksheetToOld(response);- return worksheet;+ return response;} catch {return undefined;}@@ -209,20 +198,18 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {});const response =await worksheetServiceClientConnect.searchWorksheets(request);- const worksheets = response.worksheets.map(convertNewWorksheetToOld);- await setListCache(worksheets);- return worksheets;+ await setListCache(response.worksheets);+ return response.worksheets;};const fetchSharedWorksheetList = async () => {const me = useCurrentUserV1();const request = create(SearchWorksheetsRequestSchema, {- filter: `creator != "users/${me.value.email}" && visibility in ["${Worksheet_Visibility.VISIBILITY_PROJECT_READ}","${Worksheet_Visibility.VISIBILITY_PROJECT_WRITE}"]`,+ filter: `creator != "users/${me.value.email}" && visibility in ["PROJECT_READ","PROJECT_WRITE"]`,});const response =await worksheetServiceClientConnect.searchWorksheets(request);- const worksheets = response.worksheets.map(convertNewWorksheetToOld);- await setListCache(worksheets);- return worksheets;+ await setListCache(response.worksheets);+ return response.worksheets;};const fetchStarredWorksheetList = async () => {@@ -231,30 +218,23 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {});const response =await worksheetServiceClientConnect.searchWorksheets(request);- const worksheets = response.worksheets.map(convertNewWorksheetToOld);- await setListCache(worksheets);- return worksheets;+ await setListCache(response.worksheets);+ return response.worksheets;};const patchWorksheet = async (- worksheet: Partial<Worksheet>,+ worksheet: Worksheet,updateMask: string[]) => {if (!worksheet.name) return;- const fullWorksheet = Worksheet.create({- ...worksheet,- name: worksheet.name,- });- const newWorksheet = convertOldWorksheetToNew(fullWorksheet);const request = create(UpdateWorksheetRequestSchema, {- worksheet: newWorksheet,+ worksheet: worksheet,updateMask: { paths: updateMask },});const response =await worksheetServiceClientConnect.updateWorksheet(request);- const updated = convertNewWorksheetToOld(response);- await setCache(updated, "FULL");- return updated;+ await setCache(response, "FULL");+ return response;};const deleteWorksheetByName = async (name: string) => {@@ -269,9 +249,8 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {organizer: Pick<WorksheetOrganizer, "worksheet" | "starred">) => {const fullOrganizer = { ...organizer } as WorksheetOrganizer;- const newOrganizer = convertOldWorksheetOrganizerToNew(fullOrganizer);const request = create(UpdateWorksheetOrganizerRequestSchema, {- organizer: newOrganizer,+ organizer: fullOrganizer,// for now we only support change the `starred` field.updateMask: { paths: ["starred"] },});diff --git a/frontend/src/types/sheet.ts b/frontend/src/types/sheet.tsindex 2c5e47d0f6..8b39459297 100644--- a/frontend/src/types/sheet.ts+++ b/frontend/src/types/sheet.ts@@ -1,5 +1,5 @@import type { VNode } from "vue";-import type { Worksheet_Visibility } from "@/types/proto/v1/worksheet_service";+import type { Worksheet_Visibility } from "@/types/proto-es/v1/worksheet_service_pb";export type AccessOption = {label: string;diff --git a/frontend/src/types/v1/project.ts b/frontend/src/types/v1/project.tsindex ecba981271..92e22b4ab7 100644--- a/frontend/src/types/v1/project.ts+++ b/frontend/src/types/v1/project.ts@@ -1,9 +1,9 @@import { EMPTY_ID, UNKNOWN_ID } from "../const";import { State } from "../proto-es/v1/common_pb";-import { convertStateToOld } from "@/utils/v1/common-conversions";import type { IamPolicy } from "../proto-es/v1/iam_policy_pb";import { IamPolicySchema } from "../proto-es/v1/iam_policy_pb";-import { Project } from "../proto/v1/project_service";+import type { Project } from "../proto-es/v1/project_service_pb";+import { ProjectSchema } from "../proto-es/v1/project_service_pb";import { create as createProto } from "@bufbuild/protobuf";export const DEFAULT_PROJECT_UID = 1;@@ -17,10 +17,10 @@ export interface ComposedProject extends Project {export const emptyProject = (): ComposedProject => {return {- ...Project.fromPartial({+ ...createProto(ProjectSchema, {name: EMPTY_PROJECT_NAME,title: "",- state: convertStateToOld(State.ACTIVE),+ state: State.ACTIVE,}),iamPolicy: createProto(IamPolicySchema, {}),};diff --git a/frontend/src/types/v1/projectWebhook.ts b/frontend/src/types/v1/projectWebhook.tsindex 459d07df6d..c386670da7 100644--- a/frontend/src/types/v1/projectWebhook.ts+++ b/frontend/src/types/v1/projectWebhook.ts@@ -1,14 +1,15 @@import { t } from "@/plugins/i18n";import {Activity_Type,- Webhook,+ WebhookSchema,Webhook_Type,-} from "../proto/v1/project_service";+} from "../proto-es/v1/project_service_pb";+import { create as createProto } from "@bufbuild/protobuf";export const emptyProjectWebhook = () => {- return Webhook.fromPartial({+ return createProto(WebhookSchema, {type: Webhook_Type.SLACK,- notificationTypes: [Activity_Type.TYPE_ISSUE_STATUS_UPDATE],+ notificationTypes: [Activity_Type.ISSUE_STATUS_UPDATE],});};@@ -100,13 +101,13 @@ export const projectWebhookV1ActivityItemList ={title: t("project.webhook.activity-item.issue-creation.title"),label: t("project.webhook.activity-item.issue-creation.label"),- activity: Activity_Type.TYPE_ISSUE_CREATE,+ activity: Activity_Type.ISSUE_CREATE,supportDirectMessage: false,},{title: t("project.webhook.activity-item.issue-status-change.title"),label: t("project.webhook.activity-item.issue-status-change.label"),- activity: Activity_Type.TYPE_ISSUE_STATUS_UPDATE,+ activity: Activity_Type.ISSUE_STATUS_UPDATE,supportDirectMessage: false,},{@@ -116,7 +117,7 @@ export const projectWebhookV1ActivityItemList =label: t("project.webhook.activity-item.issue-stage-status-change.label"),- activity: Activity_Type.TYPE_ISSUE_PIPELINE_STAGE_STATUS_UPDATE,+ activity: Activity_Type.ISSUE_PIPELINE_STAGE_STATUS_UPDATE,supportDirectMessage: false,},{@@ -126,37 +127,37 @@ export const projectWebhookV1ActivityItemList =label: t("project.webhook.activity-item.issue-task-status-change.label"),- activity: Activity_Type.TYPE_ISSUE_PIPELINE_TASK_RUN_STATUS_UPDATE,+ activity: Activity_Type.ISSUE_PIPELINE_TASK_RUN_STATUS_UPDATE,supportDirectMessage: false,},{title: t("project.webhook.activity-item.issue-info-change.title"),label: t("project.webhook.activity-item.issue-info-change.label"),- activity: Activity_Type.TYPE_ISSUE_FIELD_UPDATE,+ activity: Activity_Type.ISSUE_FIELD_UPDATE,supportDirectMessage: false,},{title: t("project.webhook.activity-item.issue-comment-creation.title"),label: t("project.webhook.activity-item.issue-comment-creation.label"),- activity: Activity_Type.TYPE_ISSUE_COMMENT_CREATE,+ activity: Activity_Type.ISSUE_COMMENT_CREATE,supportDirectMessage: false,},{title: t("project.webhook.activity-item.issue-approval-notify.title"),label: t("project.webhook.activity-item.issue-approval-notify.label"),- activity: Activity_Type.TYPE_ISSUE_APPROVAL_NOTIFY,+ activity: Activity_Type.ISSUE_APPROVAL_NOTIFY,supportDirectMessage: true,},{title: t("project.webhook.activity-item.notify-issue-approved.title"),label: t("project.webhook.activity-item.notify-issue-approved.label"),- activity: Activity_Type.TYPE_NOTIFY_ISSUE_APPROVED,+ activity: Activity_Type.NOTIFY_ISSUE_APPROVED,supportDirectMessage: true,},{title: t("project.webhook.activity-item.notify-pipeline-rollout.title"),label: t("project.webhook.activity-item.notify-pipeline-rollout.label"),- activity: Activity_Type.TYPE_NOTIFY_PIPELINE_ROLLOUT,+ activity: Activity_Type.NOTIFY_PIPELINE_ROLLOUT,supportDirectMessage: true,},];diff --git a/frontend/src/types/v1/sql.ts b/frontend/src/types/v1/sql.tsindex c37c8521fb..06843e7732 100644--- a/frontend/src/types/v1/sql.ts+++ b/frontend/src/types/v1/sql.ts@@ -1,7 +1,7 @@import type { Status } from "nice-grpc-common";-import type { Advice, QueryResponse } from "../proto/v1/sql_service";+import type { Advice, QueryResponse } from "../proto-es/v1/sql_service_pb";-export interface SQLResultSetV1 extends QueryResponse {+export interface SQLResultSetV1 extends Omit<QueryResponse, "$typeName"> {error: string; // empty if no error occurredadvices: Advice[];status?: Status;diff --git a/frontend/src/utils/auto-route.ts b/frontend/src/utils/auto-route.tsindex 3728a06816..e568a5a02f 100644--- a/frontend/src/utils/auto-route.ts+++ b/frontend/src/utils/auto-route.ts@@ -25,7 +25,7 @@ import type {Instance,InstanceResource,} from "@/types/proto-es/v1/instance_service_pb";-import type { Project } from "@/types/proto/v1/project_service";+import type { Project } from "@/types/proto-es/v1/project_service_pb";import { DatabaseChangeMode } from "@/types/proto-es/v1/setting_service_pb";import {extractDatabaseResourceName,diff --git a/frontend/src/utils/v1/project.ts b/frontend/src/utils/v1/project.tsindex 5f780b17b0..6f0d8eb563 100644--- a/frontend/src/utils/v1/project.ts+++ b/frontend/src/utils/v1/project.ts@@ -1,7 +1,6 @@import { DEFAULT_PROJECT_NAME } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";-import { convertStateToOld } from "@/utils/v1/common-conversions";-import type { Project } from "@/types/proto/v1/project_service";+import type { Project } from "@/types/proto-es/v1/project_service_pb";export const extractProjectResourceName = (name: string) => {const pattern = /(?:^|\/)projects\/([^/]+)(?:$|\/)/;@@ -15,7 +14,7 @@ export function projectV1Name(project: Project) {}const parts = [project.title];- if (project.state === convertStateToOld(State.DELETED)) {+ if (project.state === State.DELETED) {parts.push("(Archived)");}return parts.join(" ");diff --git a/frontend/src/utils/v1/projectWebhook.ts b/frontend/src/utils/v1/projectWebhook.tsindex 1b4f354769..99f48f3389 100644--- a/frontend/src/utils/v1/projectWebhook.ts+++ b/frontend/src/utils/v1/projectWebhook.ts@@ -1,5 +1,5 @@import slug from "slug";-import type { Webhook } from "@/types/proto/v1/project_service";+import type { Webhook } from "@/types/proto-es/v1/project_service_pb";export const extractProjectWebhookID = (name: string) => {const pattern = /(?:^|\/)webhooks\/([^/]+)(?:$|\/)/;diff --git a/frontend/src/utils/v1/sheet.ts b/frontend/src/utils/v1/sheet.tsindex b29ba5c5d0..f8a448f23d 100644--- a/frontend/src/utils/v1/sheet.ts+++ b/frontend/src/utils/v1/sheet.ts@@ -1,6 +1,5 @@-import type { Sheet } from "@/types/proto/v1/sheet_service";-import type { Worksheet } from "@/types/proto/v1/worksheet_service";-import { getStatementSize } from "@/utils";+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";export const extractSheetUID = (name: string) => {const pattern = /(?:^|\/)sheets\/([^/]+)(?:$|\/)/;@@ -17,7 +16,7 @@ export const setSheetStatement = (statement: string) => {sheet.content = new TextEncoder().encode(statement);- sheet.contentSize = getStatementSize(statement);+ sheet.contentSize = BigInt(new TextEncoder().encode(statement).length);};export const getSheetStatement = (sheet: Sheet | Worksheet) => {diff --git a/frontend/src/utils/v1/sql.ts b/frontend/src/utils/v1/sql.tsindex 1a67ab0b86..d1ef75ee86 100644--- a/frontend/src/utils/v1/sql.ts+++ b/frontend/src/utils/v1/sql.ts@@ -1,25 +1,26 @@import dayjs from "dayjs";import Long from "long";-import { getDateForPbTimestamp } from "@/types";-import { NullValue } from "@/types/proto/google/protobuf/struct";+import { toJson } from "@bufbuild/protobuf";+import { getDateForPbTimestampProtoEs } from "@/types";import { Engine } from "@/types/proto-es/v1/common_pb";-import {+import type {RowValue,- type RowValue_Timestamp,- type RowValue_TimestampTZ,-} from "@/types/proto/v1/sql_service";+ RowValue_Timestamp,+ RowValue_TimestampTZ,+} from "@/types/proto-es/v1/sql_service_pb";+import { RowValueSchema } from "@/types/proto-es/v1/sql_service_pb";import { isNullOrUndefined } from "../util";// extractSQLRowValuePlain extracts a plain value from a RowValue.export const extractSQLRowValuePlain = (value: RowValue | undefined) => {if (typeof value === "undefined" ||- value.nullValue === NullValue.NULL_VALUE+ value.kind?.case === "nullValue") {return null;}- const plainObject = RowValue.toJSON(value) as Record<string, any>;+ const plainObject = toJson(RowValueSchema, value) as Record<string, any>;const keys = Object.keys(plainObject);if (keys.length === 0) {return undefined; // Will be displayed as "UNSET"@@ -29,8 +30,8 @@ export const extractSQLRowValuePlain = (value: RowValue | undefined) => {}// First check if there's a formatted stringValue which should take precedence- if (value.stringValue) {- let stringValue = value.stringValue;+ if (value.kind?.case === "stringValue") {+ let stringValue = value.kind.value;if (stringValue.startsWith('"') && stringValue.endsWith('"')) {stringValue = stringValue.replace(/^"|"$/g, "");}@@ -38,9 +39,9 @@ export const extractSQLRowValuePlain = (value: RowValue | undefined) => {}// Handle binary data with auto-format detection- if (value.bytesValue) {+ if (value.kind?.case === "bytesValue") {// Ensure bytesValue exists before converting to array- const byteArray = Array.from(value.bytesValue);+ const byteArray = Array.from(value.kind.value);// For single byte/bit values (could be boolean)if (byteArray.length === 1) {@@ -51,7 +52,7 @@ export const extractSQLRowValuePlain = (value: RowValue | undefined) => {}// Check if it's readable text- const isReadableText = byteArray.every((byte) => byte >= 32 && byte <= 126);+ const isReadableText = byteArray.every((byte: number) => byte >= 32 && byte <= 126);if (isReadableText) {try {return new TextDecoder().decode(new Uint8Array(byteArray));@@ -65,19 +66,19 @@ export const extractSQLRowValuePlain = (value: RowValue | undefined) => {return ("0x" +byteArray- .map((byte) => byte.toString(16).toUpperCase().padStart(2, "0"))+ .map((byte: number) => byte.toString(16).toUpperCase().padStart(2, "0")).join(""));}- if (value.timestampValue && value.timestampValue.googleTimestamp) {- return formatTimestamp(value.timestampValue);+ if (value.kind?.case === "timestampValue" && value.kind.value.googleTimestamp) {+ return formatTimestamp(value.kind.value);}- if (value.timestampTzValue && value.timestampTzValue.googleTimestamp) {- return formatTimestampWithTz(value.timestampTzValue);+ if (value.kind?.case === "timestampTzValue" && value.kind.value.googleTimestamp) {+ return formatTimestampWithTz(value.kind.value);}- if (value.valueValue) {- return JSON.stringify(value.valueValue);+ if (value.kind?.case === "valueValue") {+ return JSON.stringify(value.kind.value);}const key = keys[0];@@ -86,7 +87,7 @@ export const extractSQLRowValuePlain = (value: RowValue | undefined) => {const formatTimestamp = (timestamp: RowValue_Timestamp) => {const fullDayjs = dayjs(- getDateForPbTimestamp(timestamp.googleTimestamp)+ getDateForPbTimestampProtoEs(timestamp.googleTimestamp)).utc();const microseconds = Math.floor((timestamp.googleTimestamp?.nanos ?? 0) /@@ -101,7 +102,7 @@ const formatTimestamp = (timestamp: RowValue_Timestamp) => {const formatTimestampWithTz = (timestampTzValue: RowValue_TimestampTZ) => {const fullDayjs = dayjs(- getDateForPbTimestamp(timestampTzValue.googleTimestamp)+ getDateForPbTimestampProtoEs(timestampTzValue.googleTimestamp)).utc().add(timestampTzValue.offset, "seconds");@@ -297,15 +298,15 @@ export const compareQueryRowValues = (const extractSQLRowValueRaw = (value: RowValue | undefined) => {if (typeof value === "undefined" ||- value.nullValue === NullValue.NULL_VALUE+ value.kind?.case === "nullValue") {return null;}- const keys = Object.keys(RowValue.toJSON(value) as Record<string, any>);+ const keys = Object.keys(toJson(RowValueSchema, value) as Record<string, any>);if (keys.length === 0) {return undefined;}- return (value as any)[keys[0]];+ return value.kind?.value;};const toInt = (a: any) => {diff --git a/frontend/src/utils/v1/worksheet.ts b/frontend/src/utils/v1/worksheet.tsindex 82d3aad92f..0de908a559 100644--- a/frontend/src/utils/v1/worksheet.ts+++ b/frontend/src/utils/v1/worksheet.ts@@ -1,8 +1,8 @@import { useCurrentUserV1, useProjectV1Store } from "@/store";import { extractUserId } from "@/store/modules/v1/common";import { UNKNOWN_PROJECT_NAME } from "@/types";-import type { Worksheet } from "@/types/proto/v1/worksheet_service";-import { Worksheet_Visibility } from "@/types/proto/v1/worksheet_service";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";+import { Worksheet_Visibility } from "@/types/proto-es/v1/worksheet_service_pb";import { hasProjectPermissionV2, hasWorkspacePermissionV2 } from "@/utils";export const extractWorksheetUID = (name: string) => {@@ -28,10 +28,10 @@ export const isWorksheetReadableV1 = (sheet: Worksheet) => {}switch (sheet.visibility) {- case Worksheet_Visibility.VISIBILITY_PRIVATE:+ case Worksheet_Visibility.PRIVATE:return false;- case Worksheet_Visibility.VISIBILITY_PROJECT_READ:- case Worksheet_Visibility.VISIBILITY_PROJECT_WRITE: {+ case Worksheet_Visibility.PROJECT_READ:+ case Worksheet_Visibility.PROJECT_WRITE: {const projectV1 = useProjectV1Store().getProjectByName(sheet.project);if (projectV1.name === UNKNOWN_PROJECT_NAME) {return false;@@ -63,11 +63,11 @@ export const isWorksheetWritableV1 = (sheet: Worksheet) => {return false;}switch (sheet.visibility) {- case Worksheet_Visibility.VISIBILITY_PRIVATE:+ case Worksheet_Visibility.PRIVATE:return false;- case Worksheet_Visibility.VISIBILITY_PROJECT_WRITE:+ case Worksheet_Visibility.PROJECT_WRITE:return hasProjectPermissionV2(projectV1, "bb.projects.get");- case Worksheet_Visibility.VISIBILITY_PROJECT_READ:+ case Worksheet_Visibility.PROJECT_READ:return hasProjectPermissionV2(projectV1, "bb.worksheets.manage");}diff --git a/frontend/src/views/SettingWorkspaceIM.vue b/frontend/src/views/SettingWorkspaceIM.vueindex 4f2fef656f..1c36c1408e 100644--- a/frontend/src/views/SettingWorkspaceIM.vue+++ b/frontend/src/views/SettingWorkspaceIM.vue@@ -56,7 +56,7 @@ import { BBAttention } from "@/bbkit";import BBTextField from "@/bbkit/BBTextField.vue";import WebhookTypeIcon from "@/components/Project/WebhookTypeIcon.vue";import { useSettingV1Store, pushNotification } from "@/store";-import { Webhook_Type } from "@/types/proto/v1/project_service";+import { Webhook_Type } from "@/types/proto-es/v1/project_service_pb";import {type AppIMSetting,AppIMSettingSchema,diff --git a/frontend/src/views/Setup/AdminSetup.vue b/frontend/src/views/Setup/AdminSetup.vueindex 6cc3d4ceaa..33b7cfae99 100644--- a/frontend/src/views/Setup/AdminSetup.vue+++ b/frontend/src/views/Setup/AdminSetup.vue@@ -113,7 +113,7 @@ import {} from "@/store";import { projectNamePrefix } from "@/store/modules/v1/common";import { emptyProject } from "@/types";-import type { Project } from "@/types/proto/v1/project_service";+import type { Project } from "@/types/proto-es/v1/project_service_pb";import { DatabaseChangeMode, Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";import { create } from "@bufbuild/protobuf";import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";diff --git a/frontend/src/views/project/ProjectMemberDashboard.vue b/frontend/src/views/project/ProjectMemberDashboard.vueindex e3257ce144..3657195de9 100644--- a/frontend/src/views/project/ProjectMemberDashboard.vue+++ b/frontend/src/views/project/ProjectMemberDashboard.vue@@ -9,7 +9,6 @@ import { useProjectByName } from "@/store";import { projectNamePrefix } from "@/store/modules/v1/common";import { DEFAULT_PROJECT_NAME } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";-import { convertStateToOld } from "@/utils/v1/common-conversions";import { hasProjectPermissionV2 } from "@/utils";const props = defineProps<{@@ -25,7 +24,7 @@ const allowEdit = computed(() => {return false;}- if (project.value.state === convertStateToOld(State.DELETED)) {+ if (project.value.state === State.DELETED) {return false;}diff --git a/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryConnectionIcon.vue b/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryConnectionIcon.vueindex 39cf21410d..68f4be6a40 100644--- a/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryConnectionIcon.vue+++ b/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryConnectionIcon.vue@@ -12,7 +12,7 @@ import { computedAsync } from "@vueuse/core";import { InstanceV1EngineIcon } from "@/components/v2";import { useDatabaseV1Store } from "@/store";import { isValidInstanceName, unknownInstanceResource } from "@/types";-import type { QueryHistory } from "@/types/proto/v1/sql_service";+import type { QueryHistory } from "@/types/proto-es/v1/sql_service_pb";import { extractDatabaseResourceName } from "@/utils";const props = defineProps<{diff --git a/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vue b/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vueindex 43e36d52cd..018d5275c9 100644--- a/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vue+++ b/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vue@@ -82,10 +82,10 @@ import {} from "@/store";import {DEBOUNCE_SEARCH_DELAY,- getDateForPbTimestamp,+ getDateForPbTimestampProtoEs,type SQLEditorTab,} from "@/types";-import type { QueryHistory } from "@/types/proto/v1/sql_service";+import type { QueryHistory } from "@/types/proto-es/v1/sql_service_pb";import { getHighlightHTMLByKeyWords, defer } from "@/utils";interface State {@@ -152,7 +152,7 @@ const getFormattedStatement = (statement: string) => {};const titleOfQueryHistory = (history: QueryHistory) => {- return dayjs(getDateForPbTimestamp(history.createTime)).format(+ return dayjs(getDateForPbTimestampProtoEs(history.createTime)).format("YYYY-MM-DD HH:mm:ss");};diff --git a/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/SheetList/SheetListItem.vue b/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/SheetList/SheetListItem.vueindex 543016f09c..acc5ea9196 100644--- a/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/SheetList/SheetListItem.vue+++ b/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/SheetList/SheetListItem.vue@@ -20,7 +20,7 @@<script setup lang="ts">import { computed } from "vue";import { useSQLEditorTabStore } from "@/store";-import type { Worksheet } from "@/types/proto/v1/worksheet_service";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";import type { SheetViewMode } from "@/views/sql-editor/Sheet";import {Dropdown,diff --git a/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/common.ts b/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/common.tsindex 0e5772d12a..4b889b608c 100644--- a/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/common.ts+++ b/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/common.ts@@ -1,5 +1,5 @@import type { SQLEditorTab } from "@/types";-import type { Worksheet } from "@/types/proto/v1/worksheet_service";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";import { extractWorksheetUID } from "@/utils";import type { SheetViewMode } from "../../Sheet";diff --git a/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue b/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vueindex 9be44b7eb0..e32e23ec41 100644--- a/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue+++ b/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue@@ -136,7 +136,7 @@ import {DataSourceQueryPolicy_Restriction,PolicyType,} from "@/types/proto-es/v1/org_policy_service_pb";-import { QueryOption_RedisRunCommandsOn } from "@/types/proto/v1/sql_service";+import { QueryOption_RedisRunCommandsOn } from "@/types/proto-es/v1/sql_service_pb";import { getValidDataSourceByPolicy, readableDataSourceType } from "@/utils";import { getAdminDataSourceRestrictionOfDatabase } from "@/utils";import ResultLimitSelect from "./ResultLimitSelect.vue";diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataBlock.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataBlock.vueindex 79d3ecbcb8..d15c674c6d 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataBlock.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataBlock.vue@@ -59,7 +59,7 @@ import { NScrollbar } from "naive-ui";import { computed, watch, ref } from "vue";import { FeatureBadge } from "@/components/FeatureGuard";import { useConnectionOfCurrentSQLEditorTab } from "@/store";-import type { QueryRow, RowValue } from "@/types/proto/v1/sql_service";+import type { QueryRow, RowValue } from "@/types/proto-es/v1/sql_service_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import TableCell from "./DataTable/TableCell.vue";import SensitiveDataIcon from "./DataTable/common/SensitiveDataIcon.vue";diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vueindex b80f85cf76..8e76765cd1 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vue@@ -144,7 +144,7 @@ import { computed, nextTick, onMounted, ref, watch } from "vue";import { FeatureBadge } from "@/components/FeatureGuard";import { useConnectionOfCurrentSQLEditorTab } from "@/store";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { type QueryRow, type RowValue } from "@/types/proto/v1/sql_service";+import { type QueryRow, type RowValue } from "@/types/proto-es/v1/sql_service_pb";import { useSQLResultViewContext } from "../context";import TableCell from "./TableCell.vue";import {@@ -201,13 +201,13 @@ const existBinaryValue = (columnIndex: number) => {return false;}- // Check each row in the column for binary data+ // Check each row in the column for binary data (proto-es oneof pattern)for (const row of rows.value) {const cell = row.getVisibleCells()[columnIndex];if (!cell) continue;const value = cell.getValue<RowValue>();- if (value?.bytesValue) {+ if (value?.kind?.case === "bytesValue") {return true;}}diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vueindex 77987f50bf..e7fd5671a0 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue@@ -56,7 +56,7 @@ import { twMerge } from "tailwind-merge";import { computed, ref, watchEffect } from "vue";import { useConnectionOfCurrentSQLEditorTab } from "@/store";import { Engine } from "@/types/proto-es/v1/common_pb";-import type { QueryRow, RowValue } from "@/types/proto/v1/sql_service";+import type { QueryRow, RowValue } from "@/types/proto-es/v1/sql_service_pb";import { extractSQLRowValuePlain, getHighlightHTMLByRegExp } from "@/utils";import { useSQLResultViewContext } from "../context";import {@@ -96,9 +96,9 @@ const allowSelect = computed(() => {return props.allowSelect && !selectionDisabled.value;});-// Check if the value is binary data+// Check if the value is binary data (proto-es oneof pattern)const hasByteData = computed(() => {- return !!props.value.bytesValue;+ return props.value.kind?.case === "bytesValue";});const binaryFormat = computed(() => {@@ -114,16 +114,19 @@ watchEffect(() => {return;}if (!binaryFormat.value) {- const binaryFormat = detectBinaryFormat({- bytesValue: props.value.bytesValue,- columnType: props.columnType,- });+ const bytesValue = props.value.kind?.case === "bytesValue" ? props.value.kind.value : undefined;+ if (bytesValue) {+ const binaryFormat = detectBinaryFormat({+ bytesValue,+ columnType: props.columnType,+ });setBinaryFormat({rowIndex: props.rowIndex,colIndex: props.colIndex,setIndex: props.setIndex,- format: binaryFormat,- });+ format: binaryFormat,+ });+ }}});@@ -182,9 +185,10 @@ const classes = computed(() => {return twMerge(classes);});-// Format the binary value based on selected format+// Format the binary value based on selected format (proto-es oneof pattern)const formattedValue = computed(() => {- if (!props.value?.bytesValue) {+ const bytesValue = props.value.kind?.case === "bytesValue" ? props.value.kind.value : undefined;+ if (!bytesValue) {return props.value;}@@ -197,7 +201,7 @@ const formattedValue = computed(() => {}const stringValue = formatBinaryValue({- bytesValue: props.value.bytesValue,+ bytesValue,format: actualFormat,});return {diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/selection-logic.ts b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/selection-logic.tsindex c83cbe275f..0f069cf651 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/selection-logic.ts+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/selection-logic.ts@@ -13,7 +13,7 @@ import {} from "vue";import { useI18n } from "vue-i18n";import { pushNotification } from "@/store";-import type { QueryRow, RowValue } from "@/types/proto/v1/sql_service";+import type { QueryRow, RowValue } from "@/types/proto-es/v1/sql_service_pb";import { extractSQLRowValuePlain, isDescendantOf, toClipboard } from "@/utils";import { useSQLResultViewContext } from "../../context";import {@@ -139,8 +139,8 @@ export const provideSelectionContext = (table: Ref<Table<QueryRow>>) => {colIndex: number;rowIndex: number;}) => {- // Special handling for binary data- if (value && value.bytesValue) {+ // Special handling for binary data (proto-es oneof pattern)+ if (value && value.kind?.case === "bytesValue") {// Get the result set index if availableconst setIndex = resultViewContext.detail?.value?.set ?? 0;@@ -153,18 +153,18 @@ export const provideSelectionContext = (table: Ref<Table<QueryRow>>) => {if (binaryFormat) {// Column format overrides take precedencereturn formatBinaryValue({- bytesValue: value.bytesValue,+ bytesValue: value.kind.value,format: binaryFormat,});}const header = table.value.getFlatHeaders()[colIndex];const detectedFormat = detectBinaryFormat({- bytesValue: value.bytesValue,+ bytesValue: value.kind.value,columnType: getColumnType(header),});return formatBinaryValue({- bytesValue: value.bytesValue,+ bytesValue: value.kind.value,format: detectedFormat,});}diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/utils.ts b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/utils.tsindex 35134ba35f..ca76824076 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/utils.ts+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/utils.ts@@ -1,5 +1,5 @@import type { Header } from "@tanstack/vue-table";-import type { QueryRow } from "@/types/proto/v1/sql_service";+import type { QueryRow } from "@/types/proto-es/v1/sql_service_pb";interface ColumnMeta {columnType: string;diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel/DetailPanel.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel/DetailPanel.vueindex c65fcc8e0a..807845056f 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel/DetailPanel.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel/DetailPanel.vue@@ -155,7 +155,7 @@ import { NButton, NPopover, NScrollbar, NTooltip } from "naive-ui";import { computed } from "vue";import { DrawerContent } from "@/components/v2";import { CopyButton } from "@/components/v2";-import type { RowValue } from "@/types/proto/v1/sql_service";+import type { RowValue } from "@/types/proto-es/v1/sql_service_pb";import { extractSQLRowValuePlain } from "@/utils";import {useBinaryFormatContext,@@ -205,12 +205,12 @@ const binaryFormat = computed(() => {// Check if the current value is binary data (using bytesValue)const isBinaryData = computed(() => {if (!rawValue.value) return false;- return !!rawValue.value.bytesValue;+ return rawValue.value.kind?.case === "bytesValue";});// Format the binary value based on selected formatconst formattedValue = computed(() => {- if (!rawValue.value?.bytesValue) {+ if (rawValue.value?.kind?.case !== "bytesValue") {return rawValue.value;}@@ -223,7 +223,7 @@ const formattedValue = computed(() => {}const stringValue = formatBinaryValue({- bytesValue: rawValue.value.bytesValue,+ bytesValue: rawValue.value.kind.value,format: actualFormat,});return {diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/AdviceItem.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/AdviceItem.vueindex 5de39ab75b..26eb82be66 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/AdviceItem.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/AdviceItem.vue@@ -31,7 +31,7 @@ import { NButton } from "naive-ui";import { computed } from "vue";import { positionWithOffset } from "@/components/MonacoEditor/utils";import type { SQLEditorQueryParams } from "@/types";-import { Advice_Status, type Advice } from "@/types/proto/v1/sql_service";+import { Advice_Status, type Advice } from "@/types/proto-es/v1/sql_service_pb";import { useSQLEditorContext } from "@/views/sql-editor/context";const props = defineProps<{diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/ErrorView.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/ErrorView.vueindex 004fcd9b02..9cb18735b6 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/ErrorView.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/ErrorView.vue@@ -35,7 +35,7 @@ import { BBAttention } from "@/bbkit";import { useAppFeature, useSQLEditorTabStore } from "@/store";import type { SQLEditorQueryParams, SQLResultSetV1 } from "@/types";import { DatabaseChangeMode } from "@/types/proto-es/v1/setting_service_pb";-import { Advice_Status } from "@/types/proto/v1/sql_service";+import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";import { useSQLResultViewContext } from "../context";import AdviceItem from "./AdviceItem.vue";import PostgresError from "./PostgresError.vue";diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/PostgresError.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/PostgresError.vueindex fd238a5505..2890932ee7 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/PostgresError.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ErrorView/PostgresError.vue@@ -18,7 +18,7 @@<script setup lang="ts">import { computed } from "vue";import type { SQLResultSetV1 } from "@/types";-import type { QueryResult_PostgresError } from "@/types/proto/v1/sql_service";+import type { QueryResult_PostgresError } from "@/types/proto-es/v1/sql_service_pb";const props = defineProps<{resultSet: SQLResultSetV1;@@ -27,8 +27,8 @@ const props = defineProps<{const postgresErrors = computed(() => {const errors: QueryResult_PostgresError[] = [];props.resultSet.results.forEach((result) => {- if (result.postgresError) {- errors.push(result.postgresError);+ if (result.detailedError?.case === "postgresError") {+ errors.push(result.detailedError.value);}});return errors;diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vueindex 8a2727c133..1408f85064 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue@@ -183,6 +183,7 @@</template><script lang="ts" setup>+import { create } from "@bufbuild/protobuf";import type { ColumnDef } from "@tanstack/vue-table";import {getCoreRowModel,@@ -235,14 +236,14 @@ import {isValidInstanceName,} from "@/types";import { Engine, ExportFormat } from "@/types/proto-es/v1/common_pb";-import { convertExportFormatToOld } from "@/utils/v1/common-conversions";import { PolicyType } from "@/types/proto-es/v1/org_policy_service_pb";import { DatabaseChangeMode } from "@/types/proto-es/v1/setting_service_pb";-import type {- QueryResult,- QueryRow,- RowValue,-} from "@/types/proto/v1/sql_service";+import {+ ExportRequestSchema,+ type QueryResult,+ type QueryRow,+ type RowValue,+} from "@/types/proto-es/v1/sql_service_pb";import {compareQueryRowValues,createExplainToken,@@ -321,8 +322,8 @@ const { policy: exportDataPolicy } = usePolicyByParentAndType();const disallowExportQueryData = computed(() => {- return exportDataPolicy.value?.policy?.case === "exportDataPolicy"- ? exportDataPolicy.value.policy.value.disable+ return exportDataPolicy.value?.policy?.case === "exportDataPolicy"+ ? exportDataPolicy.value.policy.value.disable: false;});@@ -481,15 +482,17 @@ const handleExportBtnClick = async ({const limit = options.limit ?? (admin ? 0 : editorStore.resultRowsLimit);try {- const content = await useSQLStore().exportData({- name: props.database.name,- dataSourceId: props.params.connection.dataSourceId ?? "",- format: convertExportFormatToOld(options.format),- statement,- limit,- admin,- password: options.password,- });+ const content = await useSQLStore().exportData(+ create(ExportRequestSchema, {+ name: props.database.name,+ dataSourceId: props.params.connection.dataSourceId ?? "",+ format: options.format,+ statement,+ limit,+ admin,+ password: options.password,+ })+ );resolve([{@@ -564,7 +567,7 @@ const queryTime = computed(() => {if (!latency) return "-";const { seconds, nanos } = latency;- const totalSeconds = seconds.toNumber() + nanos / 1e9;+ const totalSeconds = Number(seconds) + nanos / 1e9;if (totalSeconds < 1) {const totalMS = Math.round(totalSeconds * 1000);return `${totalMS} ms`;diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/context.ts b/frontend/src/views/sql-editor/EditorCommon/ResultView/context.tsindex ee28c0558a..27ebea237b 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/context.ts+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/context.ts@@ -1,6 +1,6 @@import { type Table } from "@tanstack/vue-table";import { type Ref, type InjectionKey, provide, inject } from "vue";-import type { QueryRow } from "@/types/proto/v1/sql_service";+import type { QueryRow } from "@/types/proto-es/v1/sql_service_pb";export type SQLResultViewContext = {dark: Ref<boolean>;diff --git a/frontend/src/views/sql-editor/EditorCommon/SaveSheetForm.vue b/frontend/src/views/sql-editor/EditorCommon/SaveSheetForm.vueindex 5d77edb3cb..c60d014d39 100644--- a/frontend/src/views/sql-editor/EditorCommon/SaveSheetForm.vue+++ b/frontend/src/views/sql-editor/EditorCommon/SaveSheetForm.vue@@ -19,7 +19,7 @@import { NButton, NInput } from "naive-ui";import { ref, nextTick } from "vue";import type { SQLEditorTab } from "@/types";-import type { Worksheet } from "@/types/proto/v1/worksheet_service";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";const props = defineProps<{tab: SQLEditorTab;diff --git a/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vue b/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vueindex 59040a95a3..b5cc249a7c 100644--- a/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vue+++ b/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vue@@ -24,10 +24,12 @@ import {} from "@/store";import type { SQLEditorTab } from "@/types";import { UNKNOWN_ID } from "@/types";+import { create } from "@bufbuild/protobuf";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";import {- Worksheet,+ WorksheetSchema,Worksheet_Visibility,-} from "@/types/proto/v1/worksheet_service";+} from "@/types/proto-es/v1/worksheet_service_pb";import { extractWorksheetUID } from "@/utils";import { useSheetContext } from "../Sheet";import { useSQLEditorContext } from "../context";@@ -61,9 +63,12 @@ const doSaveSheet = async (const sheetId = Number(extractWorksheetUID(worksheet ?? ""));if (sheetId !== UNKNOWN_ID) {+ const currentSheet = await worksheetV1Store.getWorksheetByName(worksheet);+ if (!currentSheet) return;+const updatedSheet = await worksheetV1Store.patchWorksheet({- name: worksheet,+ ...currentSheet,title: title,database: tab.connection.database,content: new TextEncoder().encode(statement),@@ -90,12 +95,12 @@ const doSaveSheet = async (true /* silent */);const createdSheet = await worksheetV1Store.createWorksheet(- Worksheet.fromPartial({+ create(WorksheetSchema, {title,project: database.project,content: new TextEncoder().encode(statement),database: database.name,- visibility: Worksheet_Visibility.VISIBILITY_PRIVATE,+ visibility: Worksheet_Visibility.PRIVATE,}));if (tabStore.currentTabId === tab.id) {diff --git a/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue b/frontend/src/views/sql-editor/EditorCommon/SharePopover.vueindex 7d967261ea..f81c35cced 100644--- a/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue+++ b/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue@@ -99,7 +99,7 @@ import {useWorkSheetAndTabStore,} from "@/store";import type { AccessOption } from "@/types";-import { Worksheet_Visibility } from "@/types/proto/v1/worksheet_service";+import { Worksheet_Visibility } from "@/types/proto-es/v1/worksheet_service_pb";import { extractProjectResourceName, extractWorksheetUID } from "@/utils";const { t } = useI18n();@@ -118,19 +118,19 @@ const accessOptions = computed<AccessOption[]>(() => {return [{label: t("sql-editor.private"),- value: Worksheet_Visibility.VISIBILITY_PRIVATE,+ value: Worksheet_Visibility.PRIVATE,description: t("sql-editor.private-desc"),icon: h(LockKeyholeIcon),},{label: t("sql-editor.project-read"),- value: Worksheet_Visibility.VISIBILITY_PROJECT_READ,+ value: Worksheet_Visibility.PROJECT_READ,description: t("sql-editor.project-read-desc"),icon: h(UsersIcon),},{label: t("sql-editor.project-write"),- value: Worksheet_Visibility.VISIBILITY_PROJECT_WRITE,+ value: Worksheet_Visibility.PROJECT_WRITE,description: t("sql-editor.project-write-desc"),icon: h(UsersIcon),},@@ -153,7 +153,7 @@ const handleChangeAccess = async (option: AccessOption) => {currentAccess.value = option;await worksheetV1Store.patchWorksheet({- name: sheet.value.name,+ ...sheet.value,visibility: currentAccess.value.value,},["visibility"]diff --git a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vueindex d56cc33285..2242dcd6c2 100644--- a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue+++ b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue@@ -124,9 +124,10 @@ import {useSQLStore,} from "@/store";import type { ComposedDatabase, SQLEditorDatabaseQueryContext } from "@/types";+import { create } from "@bufbuild/protobuf";import { ExportFormat } from "@/types/proto-es/v1/common_pb";+import { ExportRequestSchema } from "@/types/proto-es/v1/sql_service_pb";import { hexToRgb } from "@/utils";-import { convertExportFormatToOld } from "@/utils/v1/common-conversions";@@ -274,15 +275,17 @@ const handleExportBtnClick = async ({continue;}try {- const content = await sqlStore.exportData({- name: databaseName,- dataSourceId: context.params.connection.dataSourceId ?? "",- format: convertExportFormatToOld(options.format),- statement: context.params.statement,- limit: options.limit,- admin: tabStore.currentTab?.mode === "ADMIN",- password: options.password,- });+ const content = await sqlStore.exportData(+ create(ExportRequestSchema, {+ name: databaseName,+ dataSourceId: context.params.connection.dataSourceId ?? "",+ format: options.format,+ statement: context.params.statement,+ limit: options.limit,+ admin: tabStore.currentTab?.mode === "ADMIN",+ password: options.password,+ })+ );contents.push({content,diff --git a/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vue b/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vueindex 8b4337dd87..5a820e8fb4 100644--- a/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vue+++ b/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vue@@ -61,7 +61,7 @@ import {} from "@/store";import type { SQLDialect, SQLEditorQueryParams, SQLEditorTab } from "@/types";import { dialectOfEngineV1 } from "@/types";-import { Advice_Status, type Advice } from "@/types/proto/v1/sql_service";+import { Advice_Status, type Advice } from "@/types/proto-es/v1/sql_service_pb";import {nextAnimationFrame,useInstanceV1EditorLanguage,diff --git a/frontend/src/views/sql-editor/Setting/Project/Detail.vue b/frontend/src/views/sql-editor/Setting/Project/Detail.vueindex 80b87a33ba..971bd8fce3 100644--- a/frontend/src/views/sql-editor/Setting/Project/Detail.vue+++ b/frontend/src/views/sql-editor/Setting/Project/Detail.vue@@ -77,7 +77,6 @@ import { PagedDatabaseTable } from "@/components/v2/Model/DatabaseV1Table";import { DEFAULT_PROJECT_NAME, type ComposedProject } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";import { hasProjectPermissionV2 } from "@/utils";-import { convertStateToOld } from "@/utils/v1/common-conversions";type LocalState = {transfer: {@@ -107,7 +106,7 @@ const showSettingButton = computed(() => {});const allowEditSetting = computed(() => {if (props.project.name === DEFAULT_PROJECT_NAME) return false;- if (props.project.state === convertStateToOld(State.DELETED)) {+ if (props.project.state === State.DELETED) {return false;}return hasProjectPermissionV2(props.project, "bb.projects.update");@@ -122,7 +121,7 @@ const showMembersButton = computed(() => {});const allowEditMembers = computed(() => {if (props.project.name === DEFAULT_PROJECT_NAME) return false;- if (props.project.state === convertStateToOld(State.DELETED)) {+ if (props.project.state === State.DELETED) {return false;}diff --git a/frontend/src/views/sql-editor/Sheet/common/Dropdown.vue b/frontend/src/views/sql-editor/Sheet/common/Dropdown.vueindex 5a3a4f4dc1..a71457f84c 100644--- a/frontend/src/views/sql-editor/Sheet/common/Dropdown.vue+++ b/frontend/src/views/sql-editor/Sheet/common/Dropdown.vue@@ -41,16 +41,18 @@ import {} from "naive-ui";import { computed } from "vue";import { useI18n } from "vue-i18n";+import { create } from "@bufbuild/protobuf";import {useWorkSheetStore,pushNotification,useSQLEditorTabStore,useTabViewStateStore,} from "@/store";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";import {- Worksheet,+ WorksheetSchema,Worksheet_Visibility,-} from "@/types/proto/v1/worksheet_service";+} from "@/types/proto-es/v1/worksheet_service_pb";import {isWorksheetWritableV1,getSheetStatement,@@ -162,12 +164,12 @@ const handleAction = async (key: string) => {closeOnEsc: false,async onPositiveClick() {await worksheetV1Store.createWorksheet(- Worksheet.fromPartial({+ create(WorksheetSchema, {title: worksheet.title,project: worksheet.project,content: worksheet.content,database: worksheet.database,- visibility: Worksheet_Visibility.VISIBILITY_PRIVATE,+ visibility: Worksheet_Visibility.PRIVATE,}));pushNotification({diff --git a/frontend/src/views/sql-editor/Sheet/context.ts b/frontend/src/views/sql-editor/Sheet/context.tsindex 7962a260ab..b1f2abe4bd 100644--- a/frontend/src/views/sql-editor/Sheet/context.ts+++ b/frontend/src/views/sql-editor/Sheet/context.ts@@ -11,7 +11,7 @@ import {useWorkSheetStore,} from "@/store";import type { SQLEditorTab } from "@/types";-import type { Worksheet } from "@/types/proto/v1/worksheet_service";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";import {emptySQLEditorConnection,getSheetStatement,diff --git a/frontend/src/views/sql-editor/SheetPanel/SheetPanel.vue b/frontend/src/views/sql-editor/SheetPanel/SheetPanel.vueindex c96b6dc31a..ee55dfd8e7 100644--- a/frontend/src/views/sql-editor/SheetPanel/SheetPanel.vue+++ b/frontend/src/views/sql-editor/SheetPanel/SheetPanel.vue@@ -44,7 +44,7 @@ import { NButton, NTabs, NTabPane } from "naive-ui";import { ref } from "vue";import MaskSpinner from "@/components/misc/MaskSpinner.vue";import { SearchBox } from "@/components/v2";-import type { Worksheet } from "@/types/proto/v1/worksheet_service";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";import { useSheetContext, openWorksheetByName, addNewSheet } from "../Sheet";import { useSQLEditorContext } from "../context";import SheetTable from "./SheetTable";diff --git a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetConnection.vue b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetConnection.vueindex 262d614c2b..fd8623a35d 100644--- a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetConnection.vue+++ b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetConnection.vue@@ -44,7 +44,7 @@ import {isValidDatabaseName,unknownEnvironment,} from "@/types";-import type { Worksheet } from "@/types/proto/v1/worksheet_service";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";const props = defineProps<{sheet: Worksheet;diff --git a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vueindex aeff9cd21d..d149f7cb5c 100644--- a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue+++ b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue@@ -20,9 +20,9 @@ import { useI18n } from "vue-i18n";import HumanizeDate from "@/components/misc/HumanizeDate.vue";import { ProjectV1Name } from "@/components/v2";import { useUserStore, useProjectV1Store } from "@/store";-import { getDateForPbTimestamp } from "@/types";-import type { Worksheet } from "@/types/proto/v1/worksheet_service";-import { Worksheet_Visibility } from "@/types/proto/v1/worksheet_service";+import { getDateForPbTimestampProtoEs } from "@/types";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";+import { Worksheet_Visibility } from "@/types/proto-es/v1/worksheet_service_pb";import { getHighlightHTMLByRegExp } from "@/utils";import type { SheetViewMode } from "../../Sheet";import { useSheetContextByView, Dropdown } from "../../Sheet";@@ -92,7 +92,7 @@ const columns = computed((): DataTableColumn<Worksheet>[] => {key: "updatedAt",width: 180,render: (sheet) => (- <HumanizeDate date={getDateForPbTimestamp(sheet.updateTime)} />+ <HumanizeDate date={getDateForPbTimestampProtoEs(sheet.updateTime)} />),},{@@ -141,11 +141,11 @@ const creatorForSheet = (sheet: Worksheet) => {const visibilityDisplayName = (visibility: Worksheet_Visibility) => {switch (visibility) {- case Worksheet_Visibility.VISIBILITY_PRIVATE:+ case Worksheet_Visibility.PRIVATE:return t("sql-editor.private");- case Worksheet_Visibility.VISIBILITY_PROJECT_READ:+ case Worksheet_Visibility.PROJECT_READ:return t("sql-editor.project-read");- case Worksheet_Visibility.VISIBILITY_PROJECT_WRITE:+ case Worksheet_Visibility.PROJECT_WRITE:return t("sql-editor.project-write");default:return "";diff --git a/frontend/src/views/sql-editor/TabList/TabItem/Label.vue b/frontend/src/views/sql-editor/TabList/TabItem/Label.vueindex 3a61688430..0a6e232a15 100644--- a/frontend/src/views/sql-editor/TabList/TabItem/Label.vue+++ b/frontend/src/views/sql-editor/TabList/TabItem/Label.vue@@ -25,6 +25,7 @@</div></template><script lang="ts" setup>+import { create } from "@bufbuild/protobuf";import { NEllipsis } from "naive-ui";import { computed, nextTick, reactive, ref, watch } from "vue";import { useEmitteryEventListener } from "@/composables/useEmitteryEventListener";@@ -34,6 +35,7 @@ import {useTabViewStateStore,} from "@/store";import type { SQLEditorTab } from "@/types";+import { WorksheetSchema } from "@/types/proto-es/v1/worksheet_service_pb";import { useTabListContext } from "../context";type LocalState = {@@ -93,10 +95,10 @@ const confirmEdit = () => {if (tab.worksheet) {worksheetV1Store.patchWorksheet(- {+ create(WorksheetSchema, {name: tab.worksheet,title,- },+ }),["title"]).then(() => {diff --git a/frontend/src/views/sql-editor/TabList/TabItem/Prefix.vue b/frontend/src/views/sql-editor/TabList/TabItem/Prefix.vueindex ab3332c6a9..a928202514 100644--- a/frontend/src/views/sql-editor/TabList/TabItem/Prefix.vue+++ b/frontend/src/views/sql-editor/TabList/TabItem/Prefix.vue@@ -2,8 +2,8 @@<SheetConnectionIcon :tab="tab" class="w-4 h-4" /><heroicons-outline:user-groupv-if="- sheet?.visibility === Worksheet_Visibility.VISIBILITY_PROJECT_READ ||- sheet?.visibility === Worksheet_Visibility.VISIBILITY_PROJECT_WRITE+ sheet?.visibility === Worksheet_Visibility.PROJECT_READ ||+ sheet?.visibility === Worksheet_Visibility.PROJECT_WRITE"class="w-4 h-4"/>@@ -17,7 +17,7 @@ import { WrenchIcon } from "lucide-vue-next";import { computed } from "vue";import { useWorkSheetStore } from "@/store";import type { SQLEditorTab } from "@/types";-import { Worksheet_Visibility } from "@/types/proto/v1/worksheet_service";+import { Worksheet_Visibility } from "@/types/proto-es/v1/worksheet_service_pb";import { SheetConnectionIcon } from "../../EditorCommon";const props = defineProps<{diff --git a/frontend/src/views/sql-editor/context.ts b/frontend/src/views/sql-editor/context.tsindex a763068c87..6fa16df2fa 100644--- a/frontend/src/views/sql-editor/context.ts+++ b/frontend/src/views/sql-editor/context.ts@@ -5,7 +5,7 @@ import { inject, provide, ref } from "vue";import { useSQLEditorStore } from "@/store";import type { SQLEditorTab } from "@/types";import type { GetSchemaStringRequest_ObjectType } from "@/types/proto-es/v1/database_service_pb";-import type { Worksheet } from "@/types/proto/v1/worksheet_service";+import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";export type AsidePanelTab = "SCHEMA" | "WORKSHEET" | "HISTORY";