feat: add support to export http postman graphql request (#4967)

This commit is contained in:
Nivedin 2025-04-09 15:53:12 +05:30 committed by GitHub
parent ae5b745f5c
commit 8a1996126d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 3 deletions

View file

@ -4,6 +4,7 @@
modal-title="modal.collections"
:importer-modules="importerModules"
:exporter-modules="exporterModules"
:has-team-write-access="hasTeamWriteAccess"
@hide-modal="emit('hide-modal')"
/>
</template>
@ -696,7 +697,8 @@ const importerModules = computed(() => {
}
return isTeams
? importer.metadata.applicableTo.includes("team-workspace")
? importer.metadata.applicableTo.includes("team-workspace") &&
hasTeamWriteAccess.value
: importer.metadata.applicableTo.includes("personal-workspace")
})
})

View file

@ -50,6 +50,10 @@ const props = defineProps({
type: String,
required: true,
},
hasTeamWriteAccess: {
type: Boolean,
default: false,
},
})
const {
@ -87,6 +91,7 @@ const chooseImporterOrExporter = defineStep(
disabled: exporter.metadata.disabled,
loading: exporter.metadata.isLoading?.value ?? false,
})),
hasTeamWriteAccess: props.hasTeamWriteAccess,
"onImporter-selected": (id: string) => {
selectedImporterID.value = id

View file

@ -9,7 +9,7 @@
@click="emit('importer-selected', importer.id)"
/>
</div>
<hr />
<hr v-if="hasTeamWriteAccess" />
<div class="flex flex-col space-y-2">
<template v-for="exporter in exporters" :key="exporter.id">
<!-- adding the title to a span if the item is visible, otherwise the title won't be shown -->
@ -64,6 +64,7 @@ type ImportExportEntryMeta = {
defineProps<{
importers: ImportExportEntryMeta[]
exporters: ImportExportEntryMeta[]
hasTeamWriteAccess: boolean
}>()
const emit = defineEmits<{

View file

@ -371,10 +371,28 @@ const getHoppReqBody = ({
}
)
)
} else if (body.mode === "graphql") {
const formattedQuery = {
// @ts-expect-error - this is a valid option, but seems like the types are not updated
query: body.graphql?.query,
variables: pipe(
// @ts-expect-error - this is a valid option, but seems like the types are not updated
body.graphql?.variables,
safeParseJSON,
O.getOrElse(() => undefined)
),
}
return {
contentType: "application/json",
body: pipe(
JSON.stringify(formattedQuery, null, 2),
replacePMVarTemplating
),
}
}
// TODO: File
// TODO: GraphQL ?
return { contentType: null, body: null }
}