add interface for windmill request body

This commit is contained in:
Sunil Kumar
2023-07-19 15:00:42 +05:30
parent 638e011cc0
commit 83d5291998
+15 -4
View File
@@ -1963,6 +1963,17 @@ const syncSecretsWindmill = async ({
secrets: any; secrets: any;
accessToken: string; accessToken: string;
}) => { }) => {
interface WindmilSecretUpdate {
path: string;
value: string;
is_secret: boolean;
}
interface WindmillSecretCreate extends WindmilSecretUpdate {
description: string;
}
// get secrets stored in windmill workspace
const { data: getSecretsRes } = await standardRequest.get( const { data: getSecretsRes } = await standardRequest.get(
`${INTEGRATION_WINDMILL_API_URL}/w/${integration.app}/variables/list`, `${INTEGRATION_WINDMILL_API_URL}/w/${integration.app}/variables/list`,
{ {
@@ -1977,9 +1988,9 @@ const syncSecretsWindmill = async ({
const secretsResList = getSecretsRes.map((secretObj: any) => (secretObj.path)); const secretsResList = getSecretsRes.map((secretObj: any) => (secretObj.path));
// convert the secrets to [{}] format // convert the secrets to [{}] format
const modifiedFormatForSecretInjection: any[] = []; const modifiedFormatForCreateSecretInjection: WindmillSecretCreate[] = [];
const modifiedFormatForCreateSecretInjection: any[] = []; const modifiedFormatForUpdateSecretInjection: WindmilSecretUpdate[] = [];
const modifiedFormatForUpdateSecretInjection: any[] = [];
Object.keys(secrets).forEach( Object.keys(secrets).forEach(
(key) => { (key) => {
if(key.startsWith("u/") || key.startsWith("f/")) { if(key.startsWith("u/") || key.startsWith("f/")) {
@@ -2030,7 +2041,7 @@ const syncSecretsWindmill = async ({
}) })
// create list of secrets to delete // create list of secrets to delete
const secretsToDelete: any = []; const secretsToDelete: string[] = [];
secretsResList.forEach((secret: string) => { secretsResList.forEach((secret: string) => {
if(!(secret in secrets)) { if(!(secret in secrets)) {
secretsToDelete.push(secret); secretsToDelete.push(secret);