Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(frontend): replace proto object spreads with clone() to preserve $typeName metadata (#19380)
boojack0f886eb643f4
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vueindex 8d2ff2978b..5f4cdc97f3 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue@@ -62,7 +62,7 @@</template><script setup lang="ts">-import { create } from "@bufbuild/protobuf";+import { clone, create } from "@bufbuild/protobuf";import { useDialog } from "naive-ui";import { computed, ref } from "vue";import { useI18n } from "vue-i18n";@@ -82,6 +82,7 @@ import {BatchUpdateIssuesStatusRequestSchema,IssueStatus,} from "@/types/proto-es/v1/issue_service_pb";+import { PlanSchema } from "@/types/proto-es/v1/plan_service_pb";import {BatchRunTasksRequestSchema,CreateRolloutRequestSchema,@@ -234,9 +235,9 @@ const handlePlanStateChange = async (action: "PLAN_CLOSE" | "PLAN_REOPEN") => {onPositiveClick: async () => {d.loading = true;try {- await planStore.updatePlan({ ...plan.value, state: newState }, [- "state",- ]);+ const planPatch = clone(PlanSchema, plan.value);+ planPatch.state = newState;+ await planStore.updatePlan(planPatch, ["state"]);await resourcePoller.refreshResources();} catch (error) {pushNotification({diff --git a/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/OptionsSection.vue b/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/OptionsSection.vueindex 75ba08bb77..4bc098f387 100644--- a/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/OptionsSection.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/OptionsSection.vue@@ -46,15 +46,17 @@</template><script lang="ts" setup>-import { create } from "@bufbuild/protobuf";-import { cloneDeep } from "lodash-es";+import { clone, create } from "@bufbuild/protobuf";import { NButton } from "naive-ui";import { computed, reactive, watchEffect } from "vue";import { useI18n } from "vue-i18n";import { planServiceClientConnect } from "@/connect";import { pushNotification } from "@/store";-import type { Plan_ExportDataConfig } from "@/types/proto-es/v1/plan_service_pb";-import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";+import {+ Plan_ExportDataConfigSchema,+ PlanSchema,+ UpdatePlanRequestSchema,+} from "@/types/proto-es/v1/plan_service_pb";import { usePlanContext } from "../../../logic";import ExportFormatSelector from "../../ExportOption/ExportFormatSelector.vue";import ExportPasswordInputer from "../../ExportOption/ExportPasswordInputer.vue";@@ -76,7 +78,7 @@ const exportDataConfig = computed(() => {// Local editing stateconst state = reactive({isEditing: false,- editableConfig: {} as Plan_ExportDataConfig,+ editableConfig: create(Plan_ExportDataConfigSchema, {}),});// Initialize editableConfig when exportDataConfig becomes available@@ -85,7 +87,10 @@ watchEffect(() => {exportDataConfig.value &&Object.keys(state.editableConfig).length === 0) {- state.editableConfig = { ...exportDataConfig.value };+ state.editableConfig = clone(+ Plan_ExportDataConfigSchema,+ exportDataConfig.value+ );}});@@ -135,7 +140,10 @@ const handleEdit = () => {if (!exportDataConfig.value) return;state.isEditing = true;- state.editableConfig = { ...exportDataConfig.value };+ state.editableConfig = clone(+ Plan_ExportDataConfigSchema,+ exportDataConfig.value+ );};const handleSave = async () => {@@ -148,7 +156,7 @@ const handleSave = async () => {throw new Error("Cannot find export data spec to update");}- const planPatch = cloneDeep(plan.value);+ const planPatch = clone(PlanSchema, plan.value);const specToPatch = planPatch.specs.find((spec) => spec.id === exportDataSpec.id);@@ -158,7 +166,10 @@ const handleSave = async () => {}// Update the export config- specToPatch.config.value = { ...state.editableConfig };+ specToPatch.config.value = clone(+ Plan_ExportDataConfigSchema,+ state.editableConfig+ );const request = create(UpdatePlanRequestSchema, {plan: planPatch,@@ -189,7 +200,10 @@ const handleSave = async () => {const handleCancel = () => {state.isEditing = false;if (exportDataConfig.value) {- state.editableConfig = { ...exportDataConfig.value };+ state.editableConfig = clone(+ Plan_ExportDataConfigSchema,+ exportDataConfig.value+ );}};</script>diff --git a/frontend/src/store/modules/idp.ts b/frontend/src/store/modules/idp.tsindex 84e92ce947..cad03cf04d 100644--- a/frontend/src/store/modules/idp.ts+++ b/frontend/src/store/modules/idp.ts@@ -1,4 +1,4 @@-import { create } from "@bufbuild/protobuf";+import { clone, create } from "@bufbuild/protobuf";import { createContextValues } from "@connectrpc/connect";import { isEqual, isUndefined } from "lodash-es";import { defineStore } from "pinia";@@ -10,6 +10,7 @@ import {CreateIdentityProviderRequestSchema,DeleteIdentityProviderRequestSchema,GetIdentityProviderRequestSchema,+ IdentityProviderSchema,ListIdentityProvidersRequestSchema,UpdateIdentityProviderRequestSchema,} from "@/types/proto-es/v1/idp_service_pb";@@ -82,7 +83,11 @@ export const useIdentityProviderStore = defineStore("idp", () => {throw new Error(`identity provider with name ${update.name} not found`);}- const fullProvider = { ...originData, ...update } as IdentityProvider;+ const fullProvider = clone(IdentityProviderSchema, originData);+ if (update.title !== undefined) fullProvider.title = update.title;+ if (update.domain !== undefined) fullProvider.domain = update.domain;+ if (update.type !== undefined) fullProvider.type = update.type;+ if (update.config !== undefined) fullProvider.config = update.config;const request = create(UpdateIdentityProviderRequestSchema, {identityProvider: fullProvider,updateMask: {diff --git a/frontend/src/store/modules/v1/worksheet.ts b/frontend/src/store/modules/v1/worksheet.tsindex 1080aaeed8..e078d73117 100644--- a/frontend/src/store/modules/v1/worksheet.ts+++ b/frontend/src/store/modules/v1/worksheet.ts@@ -1,4 +1,4 @@-import { create } from "@bufbuild/protobuf";+import { clone, create } from "@bufbuild/protobuf";import { createContextValues } from "@connectrpc/connect";import { uniqBy } from "lodash-es";import { defineStore } from "pinia";@@ -20,6 +20,7 @@ import {UpdateWorksheetOrganizerRequestSchema,UpdateWorksheetRequestSchema,WorksheetOrganizerSchema,+ WorksheetSchema,} from "@/types/proto-es/v1/worksheet_service_pb";import {extractWorksheetUID,@@ -109,7 +110,7 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {const createWorksheet = async (worksheet: Worksheet) => {const fullWorksheet = worksheet.name? worksheet- : { ...worksheet, name: "" };+ : clone(WorksheetSchema, worksheet);const request = create(CreateWorksheetRequestSchema, {worksheet: fullWorksheet,});