From 0cf7cf77acd0ed58f99b8edc6d47f56a113f3b5c Mon Sep 17 00:00:00 2001 From: Fang-Pen Lin Date: Thu, 23 Oct 2025 20:07:09 -0700 Subject: [PATCH] Try to fix linter issues --- backend/package-lock.json | 89 ++----------------- backend/package.json | 2 +- .../shared/sql/sql-resource-factory.ts | 2 +- .../PamAccountForm/MySQLAccountForm.tsx | 27 ++---- 4 files changed, 13 insertions(+), 107 deletions(-) diff --git a/backend/package-lock.json b/backend/package-lock.json index adda83043..5ed4cacb8 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -153,7 +153,7 @@ "@types/node": "^20.17.30", "@types/nodemailer": "^6.4.14", "@types/passport-google-oauth20": "^2.0.14", - "@types/pg": "^8.10.9", + "@types/pg": "^8.15.5", "@types/picomatch": "^2.3.3", "@types/pkcs11js": "^1.0.4", "@types/prompt-sync": "^4.2.3", @@ -15240,71 +15240,15 @@ } }, "node_modules/@types/pg": { - "version": "8.10.9", - "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.9.tgz", - "integrity": "sha512-UksbANNE/f8w0wOMxVKKIrLCbEMV+oM1uKejmwXr39olg4xqcfBDbXxObJAt6XxHbDa4XTKOlUEcEltXDX+XLQ==", + "version": "8.15.5", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.15.5.tgz", + "integrity": "sha512-LF7lF6zWEKxuT3/OR8wAZGzkg4ENGXFNyiV/JeOt9z5B+0ZVwbql9McqX5c/WStFq1GaGso7H1AzP/qSzmlCKQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*", "pg-protocol": "*", - "pg-types": "^4.0.1" - } - }, - "node_modules/@types/pg/node_modules/pg-types": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-4.0.1.tgz", - "integrity": "sha512-hRCSDuLII9/LE3smys1hRHcu5QGcLs9ggT7I/TCs0IE+2Eesxi9+9RWAAwZ0yaGjxoWICF/YHLOEjydGujoJ+g==", - "dev": true, - "dependencies": { - "pg-int8": "1.0.1", - "pg-numeric": "1.0.2", - "postgres-array": "~3.0.1", - "postgres-bytea": "~3.0.0", - "postgres-date": "~2.0.1", - "postgres-interval": "^3.0.0", - "postgres-range": "^1.1.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@types/pg/node_modules/postgres-array": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.2.tgz", - "integrity": "sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/@types/pg/node_modules/postgres-bytea": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-3.0.0.tgz", - "integrity": "sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw==", - "dev": true, - "dependencies": { - "obuf": "~1.1.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@types/pg/node_modules/postgres-date": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-2.0.1.tgz", - "integrity": "sha512-YtMKdsDt5Ojv1wQRvUhnyDJNSr2dGIC96mQVKz7xufp07nfuFONzdaowrMHjlAzY6GDLd4f+LUHHAAM1h4MdUw==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/@types/pg/node_modules/postgres-interval": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-3.0.0.tgz", - "integrity": "sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw==", - "dev": true, - "engines": { - "node": ">=12" + "pg-types": "^2.2.0" } }, "node_modules/@types/picomatch": { @@ -25496,12 +25440,6 @@ "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz", "integrity": "sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==" }, - "node_modules/obuf": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", - "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true - }, "node_modules/oci-accessgovernancecp": { "version": "2.108.0", "resolved": "https://registry.npmjs.org/oci-accessgovernancecp/-/oci-accessgovernancecp-2.108.0.tgz", @@ -28052,15 +27990,6 @@ "node": ">=4.0.0" } }, - "node_modules/pg-numeric": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pg-numeric/-/pg-numeric-1.0.2.tgz", - "integrity": "sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/pg-pool": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.7.0.tgz", @@ -28619,12 +28548,6 @@ "node": ">=0.10.0" } }, - "node_modules/postgres-range": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/postgres-range/-/postgres-range-1.1.3.tgz", - "integrity": "sha512-VdlZoocy5lCP0c/t66xAfclglEapXPCIVhqqJRncYpvbCgImF0w67aPKfbqUMr72tO2k5q0TdTZwCLjPTI6C9g==", - "dev": true - }, "node_modules/posthog-node": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/posthog-node/-/posthog-node-3.6.2.tgz", diff --git a/backend/package.json b/backend/package.json index 17be524f2..aa67c967d 100644 --- a/backend/package.json +++ b/backend/package.json @@ -101,7 +101,7 @@ "@types/node": "^20.17.30", "@types/nodemailer": "^6.4.14", "@types/passport-google-oauth20": "^2.0.14", - "@types/pg": "^8.10.9", + "@types/pg": "^8.15.5", "@types/picomatch": "^2.3.3", "@types/pkcs11js": "^1.0.4", "@types/prompt-sync": "^4.2.3", diff --git a/backend/src/ee/services/pam-resource/shared/sql/sql-resource-factory.ts b/backend/src/ee/services/pam-resource/shared/sql/sql-resource-factory.ts index c47aa8264..a30702b26 100644 --- a/backend/src/ee/services/pam-resource/shared/sql/sql-resource-factory.ts +++ b/backend/src/ee/services/pam-resource/shared/sql/sql-resource-factory.ts @@ -169,7 +169,7 @@ const makeSqlConnection = ( await client?.end(); } }, - rotateCredentials: async (currentCredentials) => { + rotateCredentials: async (_) => { // TODO: the pwd rotation for MySQL is not supported yet throw new BadRequestError({ message: "Unsupported operation" diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MySQLAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MySQLAccountForm.tsx index 4420f7f1c..7dc8648ee 100644 --- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MySQLAccountForm.tsx +++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MySQLAccountForm.tsx @@ -1,17 +1,15 @@ -import { useEffect, useState } from "react"; -import { FormProvider, useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; +import { FormProvider, useForm } from "react-hook-form"; import { z } from "zod"; import { Button, ModalClose } from "@app/components/v2"; -import { PamResourceType, TMySQLAccount, useGetPamResourceById } from "@app/hooks/api/pam"; +import { PamResourceType, TMySQLAccount } from "@app/hooks/api/pam"; import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants"; +import { GenericAccountFields, genericAccountFieldsSchema } from "./GenericAccountFields"; +import { rotateAccountFieldsSchema } from "./RotateAccountFields"; import { BaseSqlAccountSchema } from "./shared/sql-account-schemas"; import { SqlAccountFields } from "./shared/SqlAccountFields"; -import { GenericAccountFields, genericAccountFieldsSchema } from "./GenericAccountFields"; -import { RotateAccountFields, rotateAccountFieldsSchema } from "./RotateAccountFields"; - type Props = { account?: TMySQLAccount; @@ -26,7 +24,7 @@ const formSchema = genericAccountFieldsSchema.extend(rotateAccountFieldsSchema.s type FormData = z.infer; -export const MySQLAccountForm = ({ account, resourceId, resourceType, onSubmit }: Props) => { +export const MySQLAccountForm = ({ account, onSubmit }: Props) => { const isUpdate = Boolean(account); const form = useForm({ @@ -47,20 +45,6 @@ export const MySQLAccountForm = ({ account, resourceId, resourceType, onSubmit } formState: { isSubmitting, isDirty } } = form; - const [rotationCredentialsConfigured, setRotationCredentialsConfigured] = useState(false); - - const { data: resource } = useGetPamResourceById(resourceType, resourceId, { - enabled: !account && !!resourceId && !!resourceType - }); - - useEffect(() => { - if (account) { - setRotationCredentialsConfigured(account.resource.rotationCredentialsConfigured); - } else { - setRotationCredentialsConfigured(!!resource?.rotationAccountCredentials); - } - }, [account, resource]); - return (
-