Compare commits
3 Commits
hotfix/mig
...
hotfix/ser
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb4b8a5876 | ||
|
|
629730a309 | ||
|
|
e0f468aa1c |
@@ -688,4 +688,4 @@ export const INFRA_CONFIG_SERVICE_NOT_CONFIGURED =
|
|||||||
* (InfraConfigService)
|
* (InfraConfigService)
|
||||||
*/
|
*/
|
||||||
export const DATABASE_TABLE_NOT_EXIST =
|
export const DATABASE_TABLE_NOT_EXIST =
|
||||||
'Database migration not found. Please check the documentation for assistance: https://docs.hoppscotch.io/documentation/self-host/community-edition/install-and-build#running-migrations';
|
'Database migration not performed. Please check the FAQ for assistance: https://docs.hoppscotch.io/support/getting-started/faq';
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
"generate_token": "Generate Token",
|
"generate_token": "Generate Token",
|
||||||
"graphql_headers": "Authorization Headers are sent as part of the payload to connection_init",
|
"graphql_headers": "Authorization Headers are sent as part of the payload to connection_init",
|
||||||
"include_in_url": "Include in URL",
|
"include_in_url": "Include in URL",
|
||||||
"inherited_from": "Inherited {auth} from parent collection {collection} ",
|
"inherited_from": "Inherited from {auth} from Parent Collection {collection} ",
|
||||||
"learn": "Learn how",
|
"learn": "Learn how",
|
||||||
"oauth": {
|
"oauth": {
|
||||||
"redirect_auth_server_returned_error": "Auth Server returned an error state",
|
"redirect_auth_server_returned_error": "Auth Server returned an error state",
|
||||||
@@ -313,12 +313,10 @@
|
|||||||
"export": {
|
"export": {
|
||||||
"as_json": "Export as JSON",
|
"as_json": "Export as JSON",
|
||||||
"create_secret_gist": "Create secret Gist",
|
"create_secret_gist": "Create secret Gist",
|
||||||
"create_secret_gist_tooltip_text": "Export as secret Gist",
|
|
||||||
"failed": "Something went wrong while exporting",
|
"failed": "Something went wrong while exporting",
|
||||||
"secret_gist_success": "Successfully exported as secret Gist",
|
"gist_created": "Gist created",
|
||||||
"require_github": "Login with GitHub to create secret gist",
|
"require_github": "Login with GitHub to create secret gist",
|
||||||
"title": "Export",
|
"title": "Export"
|
||||||
"success": "Successfully exported"
|
|
||||||
},
|
},
|
||||||
"filter": {
|
"filter": {
|
||||||
"all": "All",
|
"all": "All",
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<Splitpanes
|
<Splitpanes
|
||||||
|
class="smart-splitter"
|
||||||
:rtl="SIDEBAR_ON_LEFT && mdAndLarger"
|
:rtl="SIDEBAR_ON_LEFT && mdAndLarger"
|
||||||
:class="{
|
:class="{
|
||||||
'!flex-row-reverse': SIDEBAR_ON_LEFT && mdAndLarger,
|
'!flex-row-reverse': SIDEBAR_ON_LEFT && mdAndLarger,
|
||||||
'smart-splitter': SIDEBAR && hasSidebar,
|
|
||||||
'no-splitter': !(SIDEBAR && hasSidebar),
|
|
||||||
}"
|
}"
|
||||||
:horizontal="!mdAndLarger"
|
:horizontal="!mdAndLarger"
|
||||||
@resize="setPaneEvent($event, 'vertical')"
|
@resize="setPaneEvent($event, 'vertical')"
|
||||||
>
|
>
|
||||||
<Pane
|
<Pane
|
||||||
:size="SIDEBAR && hasSidebar ? PANE_MAIN_SIZE : 100"
|
:size="PANE_MAIN_SIZE"
|
||||||
min-size="65"
|
min-size="65"
|
||||||
class="flex flex-col !overflow-auto"
|
class="flex flex-col !overflow-auto"
|
||||||
>
|
>
|
||||||
@@ -37,8 +36,9 @@
|
|||||||
</Splitpanes>
|
</Splitpanes>
|
||||||
</Pane>
|
</Pane>
|
||||||
<Pane
|
<Pane
|
||||||
:size="SIDEBAR && hasSidebar ? PANE_SIDEBAR_SIZE : 0"
|
v-if="SIDEBAR && hasSidebar"
|
||||||
:min-size="25"
|
:size="PANE_SIDEBAR_SIZE"
|
||||||
|
min-size="25"
|
||||||
class="flex flex-col !overflow-auto bg-primaryContrast"
|
class="flex flex-col !overflow-auto bg-primaryContrast"
|
||||||
>
|
>
|
||||||
<slot name="sidebar" />
|
<slot name="sidebar" />
|
||||||
|
|||||||
@@ -9,10 +9,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { HoppCollection } from "@hoppscotch/data"
|
|
||||||
import * as E from "fp-ts/Either"
|
import * as E from "fp-ts/Either"
|
||||||
import { PropType, computed, ref } from "vue"
|
|
||||||
|
|
||||||
import { FileSource } from "~/helpers/import-export/import/import-sources/FileSource"
|
import { FileSource } from "~/helpers/import-export/import/import-sources/FileSource"
|
||||||
import { UrlSource } from "~/helpers/import-export/import/import-sources/UrlSource"
|
import { UrlSource } from "~/helpers/import-export/import/import-sources/UrlSource"
|
||||||
|
|
||||||
@@ -27,9 +24,11 @@ import {
|
|||||||
} from "~/helpers/import-export/import/importers"
|
} from "~/helpers/import-export/import/importers"
|
||||||
|
|
||||||
import { defineStep } from "~/composables/step-components"
|
import { defineStep } from "~/composables/step-components"
|
||||||
|
import { PropType, computed, ref } from "vue"
|
||||||
|
|
||||||
import { useI18n } from "~/composables/i18n"
|
import { useI18n } from "~/composables/i18n"
|
||||||
import { useToast } from "~/composables/toast"
|
import { useToast } from "~/composables/toast"
|
||||||
|
import { HoppCollection } from "@hoppscotch/data"
|
||||||
import { appendRESTCollections, restCollections$ } from "~/newstore/collections"
|
import { appendRESTCollections, restCollections$ } from "~/newstore/collections"
|
||||||
import MyCollectionImport from "~/components/importExport/ImportExportSteps/MyCollectionImport.vue"
|
import MyCollectionImport from "~/components/importExport/ImportExportSteps/MyCollectionImport.vue"
|
||||||
import { GetMyTeamsQuery } from "~/helpers/backend/graphql"
|
import { GetMyTeamsQuery } from "~/helpers/backend/graphql"
|
||||||
@@ -49,7 +48,7 @@ import { getTeamCollectionJSON } from "~/helpers/backend/helpers"
|
|||||||
import { platform } from "~/platform"
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
import { initializeDownloadCollection } from "~/helpers/import-export/export"
|
import { initializeDownloadCollection } from "~/helpers/import-export/export"
|
||||||
import { gistExporter } from "~/helpers/import-export/export/gist"
|
import { collectionsGistExporter } from "~/helpers/import-export/export/gistExport"
|
||||||
import { myCollectionsExporter } from "~/helpers/import-export/export/myCollections"
|
import { myCollectionsExporter } from "~/helpers/import-export/export/myCollections"
|
||||||
import { teamCollectionsExporter } from "~/helpers/import-export/export/teamCollections"
|
import { teamCollectionsExporter } from "~/helpers/import-export/export/teamCollections"
|
||||||
|
|
||||||
@@ -84,8 +83,6 @@ const currentUser = useReadonlyStream(
|
|||||||
platform.auth.getCurrentUser()
|
platform.auth.getCurrentUser()
|
||||||
)
|
)
|
||||||
|
|
||||||
const myCollections = useReadonlyStream(restCollections$, [])
|
|
||||||
|
|
||||||
const showImportFailedError = () => {
|
const showImportFailedError = () => {
|
||||||
toast.error(t("import.failed"))
|
toast.error(t("import.failed"))
|
||||||
}
|
}
|
||||||
@@ -471,13 +468,8 @@ const HoppGistCollectionsExporter: ImporterOrExporter = {
|
|||||||
icon: IconGithub,
|
icon: IconGithub,
|
||||||
disabled: !currentUser.value
|
disabled: !currentUser.value
|
||||||
? true
|
? true
|
||||||
: currentUser.value?.provider !== "github.com",
|
: currentUser.value.provider !== "github.com",
|
||||||
title:
|
title: t("export.create_secret_gist"),
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
currentUser?.value?.provider === "github.com"
|
|
||||||
? "export.create_secret_gist_tooltip_text"
|
|
||||||
: "export.require_github",
|
|
||||||
applicableTo: ["personal-workspace", "team-workspace"],
|
applicableTo: ["personal-workspace", "team-workspace"],
|
||||||
isLoading: isHoppGistCollectionExporterInProgress,
|
isLoading: isHoppGistCollectionExporterInProgress,
|
||||||
},
|
},
|
||||||
@@ -494,27 +486,13 @@ const HoppGistCollectionsExporter: ImporterOrExporter = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (E.isRight(collectionJSON)) {
|
if (E.isRight(collectionJSON)) {
|
||||||
if (!JSON.parse(collectionJSON.right).length) {
|
collectionsGistExporter(collectionJSON.right, accessToken)
|
||||||
isHoppGistCollectionExporterInProgress.value = false
|
|
||||||
return toast.error(t("error.no_collections_to_export"))
|
|
||||||
}
|
|
||||||
|
|
||||||
const res = await gistExporter(collectionJSON.right, accessToken)
|
|
||||||
|
|
||||||
if (E.isLeft(res)) {
|
|
||||||
toast.error(t("export.failed"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
toast.success(t("export.secret_gist_success"))
|
|
||||||
|
|
||||||
platform.analytics?.logEvent({
|
platform.analytics?.logEvent({
|
||||||
type: "HOPP_EXPORT_COLLECTION",
|
type: "HOPP_EXPORT_COLLECTION",
|
||||||
exporter: "gist",
|
exporter: "gist",
|
||||||
platform: "rest",
|
platform: "rest",
|
||||||
})
|
})
|
||||||
|
|
||||||
platform.io.openExternalLink(res.right)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isHoppGistCollectionExporterInProgress.value = false
|
isHoppGistCollectionExporterInProgress.value = false
|
||||||
@@ -582,6 +560,8 @@ const selectedTeamID = computed(() => {
|
|||||||
: undefined
|
: undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const myCollections = useReadonlyStream(restCollections$, [])
|
||||||
|
|
||||||
const getCollectionJSON = async () => {
|
const getCollectionJSON = async () => {
|
||||||
if (
|
if (
|
||||||
props.collectionsType.type === "team-collections" &&
|
props.collectionsType.type === "team-collections" &&
|
||||||
|
|||||||
@@ -9,16 +9,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { HoppCollection } from "@hoppscotch/data"
|
|
||||||
import * as E from "fp-ts/Either"
|
|
||||||
import { ref } from "vue"
|
|
||||||
|
|
||||||
import { useI18n } from "~/composables/i18n"
|
import { useI18n } from "~/composables/i18n"
|
||||||
import { useToast } from "~/composables/toast"
|
import { useToast } from "~/composables/toast"
|
||||||
|
import { HoppCollection } from "@hoppscotch/data"
|
||||||
import { ImporterOrExporter } from "~/components/importExport/types"
|
import { ImporterOrExporter } from "~/components/importExport/types"
|
||||||
import { FileSource } from "~/helpers/import-export/import/import-sources/FileSource"
|
import { FileSource } from "~/helpers/import-export/import/import-sources/FileSource"
|
||||||
import { GistSource } from "~/helpers/import-export/import/import-sources/GistSource"
|
import { GistSource } from "~/helpers/import-export/import/import-sources/GistSource"
|
||||||
|
|
||||||
|
import * as E from "fp-ts/Either"
|
||||||
|
|
||||||
import IconFolderPlus from "~icons/lucide/folder-plus"
|
import IconFolderPlus from "~icons/lucide/folder-plus"
|
||||||
import IconUser from "~icons/lucide/user"
|
import IconUser from "~icons/lucide/user"
|
||||||
import { initializeDownloadCollection } from "~/helpers/import-export/export"
|
import { initializeDownloadCollection } from "~/helpers/import-export/export"
|
||||||
@@ -31,7 +30,7 @@ import {
|
|||||||
} from "~/newstore/collections"
|
} from "~/newstore/collections"
|
||||||
import { hoppGqlCollectionsImporter } from "~/helpers/import-export/import/hoppGql"
|
import { hoppGqlCollectionsImporter } from "~/helpers/import-export/import/hoppGql"
|
||||||
import { gqlCollectionsExporter } from "~/helpers/import-export/export/gqlCollections"
|
import { gqlCollectionsExporter } from "~/helpers/import-export/export/gqlCollections"
|
||||||
import { gistExporter } from "~/helpers/import-export/export/gist"
|
import { gqlCollectionsGistExporter } from "~/helpers/import-export/export/gqlCollectionsGistExporter"
|
||||||
import { computed } from "vue"
|
import { computed } from "vue"
|
||||||
import { hoppGQLImporter } from "~/helpers/import-export/import/hopp"
|
import { hoppGQLImporter } from "~/helpers/import-export/import/hopp"
|
||||||
|
|
||||||
@@ -43,10 +42,6 @@ const currentUser = useReadonlyStream(
|
|||||||
platform.auth.getCurrentUser()
|
platform.auth.getCurrentUser()
|
||||||
)
|
)
|
||||||
|
|
||||||
const gqlCollections = useReadonlyStream(graphqlCollections$, [])
|
|
||||||
|
|
||||||
const isGqlCollectionGistExportInProgress = ref(false)
|
|
||||||
|
|
||||||
const GqlCollectionsHoppImporter: ImporterOrExporter = {
|
const GqlCollectionsHoppImporter: ImporterOrExporter = {
|
||||||
metadata: {
|
metadata: {
|
||||||
id: "import.from_json",
|
id: "import.from_json",
|
||||||
@@ -124,6 +119,8 @@ const GqlCollectionsGistImporter: ImporterOrExporter = {
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gqlCollections = useReadonlyStream(graphqlCollections$, [])
|
||||||
|
|
||||||
const GqlCollectionsHoppExporter: ImporterOrExporter = {
|
const GqlCollectionsHoppExporter: ImporterOrExporter = {
|
||||||
metadata: {
|
metadata: {
|
||||||
id: "export.as_json",
|
id: "export.as_json",
|
||||||
@@ -162,35 +159,29 @@ const GqlCollectionsGistExporter: ImporterOrExporter = {
|
|||||||
metadata: {
|
metadata: {
|
||||||
id: "export.as_gist",
|
id: "export.as_gist",
|
||||||
name: "export.create_secret_gist",
|
name: "export.create_secret_gist",
|
||||||
title:
|
title: !currentUser
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
? "export.require_github"
|
||||||
// @ts-ignore
|
: // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
currentUser?.value?.provider === "github.com"
|
// @ts-ignore
|
||||||
? "export.create_secret_gist_tooltip_text"
|
currentUser.provider !== "github.com"
|
||||||
: "export.require_github",
|
? `export.require_github`
|
||||||
|
: "export.create_secret_gist",
|
||||||
icon: IconUser,
|
icon: IconUser,
|
||||||
disabled: !currentUser.value
|
disabled: !currentUser.value
|
||||||
? true
|
? true
|
||||||
: currentUser.value?.provider !== "github.com",
|
: currentUser.value.provider !== "github.com",
|
||||||
applicableTo: ["personal-workspace"],
|
applicableTo: ["personal-workspace"],
|
||||||
isLoading: isGqlCollectionGistExportInProgress,
|
|
||||||
},
|
},
|
||||||
action: async () => {
|
action: async () => {
|
||||||
if (!gqlCollections.value.length) {
|
|
||||||
return toast.error(t("error.no_collections_to_export"))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!currentUser.value) {
|
if (!currentUser.value) {
|
||||||
toast.error(t("profile.no_permission"))
|
toast.error(t("profile.no_permission"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
isGqlCollectionGistExportInProgress.value = true
|
|
||||||
|
|
||||||
const accessToken = currentUser.value?.accessToken
|
const accessToken = currentUser.value?.accessToken
|
||||||
|
|
||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
const res = await gistExporter(
|
const res = await gqlCollectionsGistExporter(
|
||||||
JSON.stringify(gqlCollections.value),
|
JSON.stringify(gqlCollections.value),
|
||||||
accessToken
|
accessToken
|
||||||
)
|
)
|
||||||
@@ -200,7 +191,7 @@ const GqlCollectionsGistExporter: ImporterOrExporter = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.success(t("export.secret_gist_success"))
|
toast.success(t("export.success"))
|
||||||
|
|
||||||
platform.analytics?.logEvent({
|
platform.analytics?.logEvent({
|
||||||
type: "HOPP_EXPORT_COLLECTION",
|
type: "HOPP_EXPORT_COLLECTION",
|
||||||
@@ -210,8 +201,6 @@ const GqlCollectionsGistExporter: ImporterOrExporter = {
|
|||||||
|
|
||||||
platform.io.openExternalLink(res.right)
|
platform.io.openExternalLink(res.right)
|
||||||
}
|
}
|
||||||
|
|
||||||
isGqlCollectionGistExportInProgress.value = false
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,17 +9,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Environment } from "@hoppscotch/data"
|
|
||||||
import * as E from "fp-ts/Either"
|
|
||||||
import { ref } from "vue"
|
|
||||||
|
|
||||||
import { useI18n } from "~/composables/i18n"
|
import { useI18n } from "~/composables/i18n"
|
||||||
import { useToast } from "~/composables/toast"
|
import { useToast } from "~/composables/toast"
|
||||||
|
import { Environment } from "@hoppscotch/data"
|
||||||
import { ImporterOrExporter } from "~/components/importExport/types"
|
import { ImporterOrExporter } from "~/components/importExport/types"
|
||||||
import { FileSource } from "~/helpers/import-export/import/import-sources/FileSource"
|
import { FileSource } from "~/helpers/import-export/import/import-sources/FileSource"
|
||||||
import { GistSource } from "~/helpers/import-export/import/import-sources/GistSource"
|
import { GistSource } from "~/helpers/import-export/import/import-sources/GistSource"
|
||||||
import { hoppEnvImporter } from "~/helpers/import-export/import/hoppEnv"
|
import { hoppEnvImporter } from "~/helpers/import-export/import/hoppEnv"
|
||||||
|
|
||||||
|
import * as E from "fp-ts/Either"
|
||||||
import {
|
import {
|
||||||
appendEnvironments,
|
appendEnvironments,
|
||||||
addGlobalEnvVariable,
|
addGlobalEnvVariable,
|
||||||
@@ -41,7 +39,7 @@ import { initializeDownloadCollection } from "~/helpers/import-export/export"
|
|||||||
import { computed } from "vue"
|
import { computed } from "vue"
|
||||||
import { useReadonlyStream } from "~/composables/stream"
|
import { useReadonlyStream } from "~/composables/stream"
|
||||||
import { environmentsExporter } from "~/helpers/import-export/export/environments"
|
import { environmentsExporter } from "~/helpers/import-export/export/environments"
|
||||||
import { gistExporter } from "~/helpers/import-export/export/gist"
|
import { environmentsGistExporter } from "~/helpers/import-export/export/environmentsGistExport"
|
||||||
import { platform } from "~/platform"
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
@@ -60,8 +58,6 @@ const currentUser = useReadonlyStream(
|
|||||||
platform.auth.getCurrentUser()
|
platform.auth.getCurrentUser()
|
||||||
)
|
)
|
||||||
|
|
||||||
const isEnvironmentGistExportInProgress = ref(false)
|
|
||||||
|
|
||||||
const isTeamEnvironment = computed(() => {
|
const isTeamEnvironment = computed(() => {
|
||||||
return props.environmentType === "TEAM_ENV"
|
return props.environmentType === "TEAM_ENV"
|
||||||
})
|
})
|
||||||
@@ -266,44 +262,35 @@ const HoppEnvironmentsGistExporter: ImporterOrExporter = {
|
|||||||
title:
|
title:
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
currentUser?.value?.provider === "github.com"
|
currentUser?.provider === "github.com"
|
||||||
? "export.create_secret_gist_tooltip_text"
|
? "export.create_secret_gist"
|
||||||
: "export.require_github",
|
: "export.require_github",
|
||||||
icon: IconUser,
|
icon: IconUser,
|
||||||
disabled: !currentUser.value
|
disabled: !currentUser.value
|
||||||
? true
|
? true
|
||||||
: currentUser.value?.provider !== "github.com",
|
: currentUser.value.provider !== "github.com",
|
||||||
applicableTo: ["personal-workspace", "team-workspace"],
|
applicableTo: ["personal-workspace", "team-workspace"],
|
||||||
isLoading: isEnvironmentGistExportInProgress,
|
|
||||||
},
|
},
|
||||||
action: async () => {
|
action: async () => {
|
||||||
if (!environmentJson.value.length) {
|
|
||||||
return toast.error(t("error.no_environments_to_export"))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!currentUser.value) {
|
if (!currentUser.value) {
|
||||||
toast.error(t("profile.no_permission"))
|
toast.error(t("profile.no_permission"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
isEnvironmentGistExportInProgress.value = true
|
|
||||||
|
|
||||||
const accessToken = currentUser.value?.accessToken
|
const accessToken = currentUser.value?.accessToken
|
||||||
|
|
||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
const res = await gistExporter(
|
const res = await environmentsGistExporter(
|
||||||
JSON.stringify(environmentJson.value),
|
JSON.stringify(environmentJson.value),
|
||||||
accessToken,
|
accessToken
|
||||||
"hoppscotch-environment.json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (E.isLeft(res)) {
|
if (E.isLeft(res)) {
|
||||||
toast.error(t("export.failed"))
|
toast.error(t("export.failed"))
|
||||||
isEnvironmentGistExportInProgress.value = false
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.success(t("export.secret_gist_success"))
|
toast.success(t("export.success"))
|
||||||
|
|
||||||
platform.analytics?.logEvent({
|
platform.analytics?.logEvent({
|
||||||
type: "HOPP_EXPORT_ENVIRONMENT",
|
type: "HOPP_EXPORT_ENVIRONMENT",
|
||||||
@@ -312,8 +299,6 @@ const HoppEnvironmentsGistExporter: ImporterOrExporter = {
|
|||||||
|
|
||||||
platform.io.openExternalLink(res.right)
|
platform.io.openExternalLink(res.right)
|
||||||
}
|
}
|
||||||
|
|
||||||
isEnvironmentGistExportInProgress.value = false
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,10 +140,7 @@ const runQuery = async (
|
|||||||
const runVariables = clone(request.value.variables)
|
const runVariables = clone(request.value.variables)
|
||||||
const runAuth =
|
const runAuth =
|
||||||
request.value.auth.authType === "inherit" && request.value.auth.authActive
|
request.value.auth.authType === "inherit" && request.value.auth.authActive
|
||||||
? clone(
|
? clone(tabs.currentActiveTab.value.document.inheritedProperties?.auth)
|
||||||
tabs.currentActiveTab.value.document.inheritedProperties?.auth
|
|
||||||
.inheritedAuth
|
|
||||||
)
|
|
||||||
: clone(request.value.auth)
|
: clone(request.value.auth)
|
||||||
|
|
||||||
const inheritedHeaders =
|
const inheritedHeaders =
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const getDefaultGQLRequest = (): HoppGQLRequest => ({
|
|||||||
}`,
|
}`,
|
||||||
query: DEFAULT_QUERY,
|
query: DEFAULT_QUERY,
|
||||||
auth: {
|
auth: {
|
||||||
authType: "none",
|
authType: "inherit",
|
||||||
authActive: true,
|
authActive: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import * as E from "fp-ts/Either"
|
||||||
|
import { createGist } from "~/helpers/gist"
|
||||||
|
|
||||||
|
export const environmentsGistExporter = async (
|
||||||
|
environmentsJSON: string,
|
||||||
|
accessToken: string
|
||||||
|
) => {
|
||||||
|
const res = await createGist(
|
||||||
|
environmentsJSON,
|
||||||
|
"hoppscotch-collections.json",
|
||||||
|
accessToken
|
||||||
|
)()
|
||||||
|
|
||||||
|
if (E.isLeft(res)) {
|
||||||
|
return E.left(res.left)
|
||||||
|
}
|
||||||
|
return E.right(res.right.data.html_url as string)
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import * as E from "fp-ts/Either"
|
|
||||||
import { createGist } from "~/helpers/gist"
|
|
||||||
|
|
||||||
export const gistExporter = async (
|
|
||||||
JSONFileContents: string,
|
|
||||||
accessToken: string,
|
|
||||||
fileName = "hoppscotch-collections.json"
|
|
||||||
) => {
|
|
||||||
if (!accessToken) {
|
|
||||||
return E.left("Invalid User")
|
|
||||||
}
|
|
||||||
|
|
||||||
const res = await createGist(JSONFileContents, fileName, accessToken)()
|
|
||||||
|
|
||||||
if (E.isLeft(res)) {
|
|
||||||
return E.left(res.left)
|
|
||||||
}
|
|
||||||
return E.right(res.right.data.html_url as string)
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { createGist } from "~/helpers/gist"
|
||||||
|
import * as E from "fp-ts/Either"
|
||||||
|
|
||||||
|
export const collectionsGistExporter = async (
|
||||||
|
collectionJSON: string,
|
||||||
|
accessToken: string
|
||||||
|
) => {
|
||||||
|
if (!accessToken) {
|
||||||
|
return E.left("Invalid User")
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await createGist(
|
||||||
|
collectionJSON,
|
||||||
|
"hoppscotch-collections.json",
|
||||||
|
accessToken
|
||||||
|
)()
|
||||||
|
|
||||||
|
if (E.isLeft(res)) {
|
||||||
|
return E.left(res.left)
|
||||||
|
}
|
||||||
|
return E.right(true)
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import * as E from "fp-ts/Either"
|
||||||
|
import { createGist } from "~/helpers/gist"
|
||||||
|
|
||||||
|
export const gqlCollectionsGistExporter = async (
|
||||||
|
gqlCollectionsJSON: string,
|
||||||
|
accessToken: string
|
||||||
|
) => {
|
||||||
|
const res = await createGist(
|
||||||
|
gqlCollectionsJSON,
|
||||||
|
"hoppscotch-collections.json",
|
||||||
|
accessToken
|
||||||
|
)()
|
||||||
|
|
||||||
|
if (E.isLeft(res)) {
|
||||||
|
return E.left(res.left)
|
||||||
|
}
|
||||||
|
return E.right(res.right.data.html_url as string)
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
HoppRESTRequest,
|
HoppRESTRequest,
|
||||||
HoppCollection,
|
HoppCollection,
|
||||||
makeCollection,
|
makeCollection,
|
||||||
HoppGQLAuth,
|
|
||||||
} from "@hoppscotch/data"
|
} from "@hoppscotch/data"
|
||||||
import DispatchingStore, { defineDispatchers } from "./DispatchingStore"
|
import DispatchingStore, { defineDispatchers } from "./DispatchingStore"
|
||||||
import { cloneDeep } from "lodash-es"
|
import { cloneDeep } from "lodash-es"
|
||||||
@@ -12,9 +11,6 @@ import { resolveSaveContextOnRequestReorder } from "~/helpers/collection/request
|
|||||||
import { getService } from "~/modules/dioc"
|
import { getService } from "~/modules/dioc"
|
||||||
import { RESTTabService } from "~/services/tab/rest"
|
import { RESTTabService } from "~/services/tab/rest"
|
||||||
import { HoppInheritedProperty } from "~/helpers/types/HoppInheritedProperties"
|
import { HoppInheritedProperty } from "~/helpers/types/HoppInheritedProperties"
|
||||||
import { HoppRESTAuth } from "@hoppscotch/data"
|
|
||||||
import { HoppRESTHeaders } from "@hoppscotch/data"
|
|
||||||
import { HoppGQLHeader } from "~/helpers/graphql"
|
|
||||||
|
|
||||||
const defaultRESTCollectionState = {
|
const defaultRESTCollectionState = {
|
||||||
state: [
|
state: [
|
||||||
@@ -67,12 +63,6 @@ export function navigateToFolderWithIndexPath(
|
|||||||
return target !== undefined ? target : null
|
return target !== undefined ? target : null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to obtain the inherited auth and headers for a given folder path, used for both REST and GraphQL
|
|
||||||
* @param folderPath the path of the folder to cascade the auth from
|
|
||||||
* @param type the type of collection
|
|
||||||
* @returns the inherited auth and headers for the given folder path
|
|
||||||
*/
|
|
||||||
export function cascadeParentCollectionForHeaderAuth(
|
export function cascadeParentCollectionForHeaderAuth(
|
||||||
folderPath: string | undefined,
|
folderPath: string | undefined,
|
||||||
type: "rest" | "graphql"
|
type: "rest" | "graphql"
|
||||||
@@ -113,16 +103,10 @@ export function cascadeParentCollectionForHeaderAuth(
|
|||||||
return { auth, headers }
|
return { auth, headers }
|
||||||
}
|
}
|
||||||
|
|
||||||
const parentFolderAuth = parentFolder.auth as HoppRESTAuth | HoppGQLAuth
|
const parentFolderAuth = parentFolder.auth
|
||||||
const parentFolderHeaders = parentFolder.headers as
|
const parentFolderHeaders = parentFolder.headers
|
||||||
| HoppRESTHeaders
|
|
||||||
| HoppGQLHeader[]
|
|
||||||
|
|
||||||
// check if the parent folder has authType 'inherit' and if it is the root folder
|
// check if the parent folder has authType 'inherit' and if it is the root folder
|
||||||
if (
|
if (parentFolderAuth?.authType === "inherit" && path.length === 1) {
|
||||||
parentFolderAuth?.authType === "inherit" &&
|
|
||||||
[...path.slice(0, i + 1)].length === 1
|
|
||||||
) {
|
|
||||||
auth = {
|
auth = {
|
||||||
parentID: [...path.slice(0, i + 1)].join("/"),
|
parentID: [...path.slice(0, i + 1)].join("/"),
|
||||||
parentName: parentFolder.name,
|
parentName: parentFolder.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user