Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
refactor: TeamAccessRole import to workspace service (#6697)
Anwarul Islam63273f8e599e
diff --git a/.gitignore b/.gitignoreindex 4fa9e3e15..ca51ed8c9 100644--- a/.gitignore+++ b/.gitignore@@ -188,3 +188,4 @@ devenv.local.nix.cursor/.aider*.windsurfrules+.agentsdiff --git a/packages/hoppscotch-common/src/composables/__tests__/chat-context.spec.ts b/packages/hoppscotch-common/src/composables/__tests__/chat-context.spec.tsindex 1ead625b7..850ab8c9f 100644--- a/packages/hoppscotch-common/src/composables/__tests__/chat-context.spec.ts+++ b/packages/hoppscotch-common/src/composables/__tests__/chat-context.spec.ts@@ -71,7 +71,7 @@ vi.mock("~/helpers/backend/GQLClient", async (orig) => {import { useChatContext } from "~/composables/chat-context"import { WorkspaceService } from "~/services/workspace.service"import { WorkspaceTabsService } from "~/services/tab/workspace-tabs"-import { TeamAccessRole } from "~/helpers/backend/graphql"+import { TeamAccessRole } from "~/services/workspace.service"import { defineActionHandler } from "~/helpers/actions"import { getDefaultRESTRequest } from "~/helpers/rest/default"import { getDefaultGQLRequest } from "~/helpers/graphql/default"diff --git a/packages/hoppscotch-common/src/composables/chat-context.ts b/packages/hoppscotch-common/src/composables/chat-context.tsindex 5de42cb1d..c4922038e 100644--- a/packages/hoppscotch-common/src/composables/chat-context.ts+++ b/packages/hoppscotch-common/src/composables/chat-context.ts@@ -11,7 +11,11 @@ import {GQLTabConnectionService,type GQLResponseEvent,} from "~/services/gql-tab-connection.service"-import { WorkspaceService, type Workspace } from "~/services/workspace.service"+import {+ WorkspaceService,+ type TeamAccessRole,+ type Workspace,+} from "~/services/workspace.service"import { useReadonlyStream } from "~/composables/stream"import {currentEnvironment$,@@ -25,7 +29,6 @@ import { truncateText } from "~/helpers/aichat/context-serializers"import { isActionBound } from "~/helpers/actions"import TeamEnvironmentAdapter from "~/helpers/teams/TeamEnvironmentAdapter"import type { TeamEnvironment } from "~/helpers/teams/TeamEnvironment"-import type { TeamAccessRole } from "~/helpers/backend/graphql"import type { HoppRESTResponse } from "~/helpers/types/HoppRESTResponse"import type { HoppTabDocument } from "~/helpers/tab/document"import type { HoppTab } from "~/services/tab"diff --git a/packages/hoppscotch-common/src/services/__tests__/ai-chat-collection-safety.spec.ts b/packages/hoppscotch-common/src/services/__tests__/ai-chat-collection-safety.spec.tsindex ae39799f7..9dba0639e 100644--- a/packages/hoppscotch-common/src/services/__tests__/ai-chat-collection-safety.spec.ts+++ b/packages/hoppscotch-common/src/services/__tests__/ai-chat-collection-safety.spec.ts@@ -98,7 +98,7 @@ import { WorkspaceService } from "~/services/workspace.service"import { TeamCollectionsService } from "~/services/team-collection.service"import { SecretEnvironmentService } from "~/services/secret-environment.service"import { TestRunnerService } from "~/services/test-runner/test-runner.service"-import { TeamAccessRole } from "~/helpers/backend/graphql"+import { TeamAccessRole } from "~/services/workspace.service"import type { TeamCollection } from "~/helpers/teams/TeamCollection"import { getDefaultRESTRequest } from "~/helpers/rest/default"import {diff --git a/packages/hoppscotch-common/src/services/__tests__/ai-chat-confirm-workspace.spec.ts b/packages/hoppscotch-common/src/services/__tests__/ai-chat-confirm-workspace.spec.tsindex baab9a104..bb5bcadb2 100644--- a/packages/hoppscotch-common/src/services/__tests__/ai-chat-confirm-workspace.spec.ts+++ b/packages/hoppscotch-common/src/services/__tests__/ai-chat-confirm-workspace.spec.ts@@ -52,7 +52,7 @@ import { AIChatService } from "../ai-chat.service"import { WorkspaceService } from "~/services/workspace.service"import { TeamCollectionsService } from "~/services/team-collection.service"import { TestRunnerService } from "~/services/test-runner/test-runner.service"-import { TeamAccessRole } from "~/helpers/backend/graphql"+import { TeamAccessRole } from "~/services/workspace.service"import { getDefaultRESTRequest } from "~/helpers/rest/default"import { restCollectionStore, setRESTCollections } from "~/newstore/collections"diff --git a/packages/hoppscotch-common/src/services/__tests__/ai-chat-run-save.spec.ts b/packages/hoppscotch-common/src/services/__tests__/ai-chat-run-save.spec.tsindex ca64e0c1a..055daccad 100644--- a/packages/hoppscotch-common/src/services/__tests__/ai-chat-run-save.spec.ts+++ b/packages/hoppscotch-common/src/services/__tests__/ai-chat-run-save.spec.ts@@ -39,7 +39,7 @@ import { WorkspaceService } from "~/services/workspace.service"import { TeamCollectionsService } from "~/services/team-collection.service"import { TestRunnerService } from "~/services/test-runner/test-runner.service"import { GQLQueryBuilderService } from "~/services/gql-query-builder.service"-import { TeamAccessRole } from "~/helpers/backend/graphql"+import { TeamAccessRole } from "~/services/workspace.service"import { defineActionHandler } from "~/helpers/actions"import { getDefaultRESTRequest } from "~/helpers/rest/default"import { getDefaultGQLRequest } from "~/helpers/graphql/default"diff --git a/packages/hoppscotch-common/src/services/__tests__/ai-chat-turn.spec.ts b/packages/hoppscotch-common/src/services/__tests__/ai-chat-turn.spec.tsindex 608db1b40..31ecaf419 100644--- a/packages/hoppscotch-common/src/services/__tests__/ai-chat-turn.spec.ts+++ b/packages/hoppscotch-common/src/services/__tests__/ai-chat-turn.spec.ts@@ -31,7 +31,7 @@ import { AIChatService } from "../ai-chat.service"import { WorkspaceTabsService } from "~/services/tab/workspace-tabs"import { WorkspaceService } from "~/services/workspace.service"import { TeamCollectionsService } from "~/services/team-collection.service"-import { TeamAccessRole } from "~/helpers/backend/graphql"+import { TeamAccessRole } from "~/services/workspace.service"import { getDefaultRESTRequest } from "~/helpers/rest/default"import { restCollectionStore, setRESTCollections } from "~/newstore/collections"import { applySetting } from "~/newstore/settings"diff --git a/packages/hoppscotch-common/src/services/__tests__/ai-chat-ui.spec.ts b/packages/hoppscotch-common/src/services/__tests__/ai-chat-ui.spec.tsindex a29361aad..08df10114 100644--- a/packages/hoppscotch-common/src/services/__tests__/ai-chat-ui.spec.ts+++ b/packages/hoppscotch-common/src/services/__tests__/ai-chat-ui.spec.ts@@ -68,7 +68,7 @@ import { WorkspaceService } from "~/services/workspace.service"import { defineActionHandler } from "~/helpers/actions"import { hookKeybindingsListener } from "~/helpers/keybindings"import { applySetting } from "~/newstore/settings"-import { TeamAccessRole } from "~/helpers/backend/graphql"+import { TeamAccessRole } from "~/services/workspace.service"import TeamEnvironmentAdapter from "~/helpers/teams/TeamEnvironmentAdapter"import {useAIExperimentsSupport,diff --git a/packages/hoppscotch-common/src/services/ai-chat.service.ts b/packages/hoppscotch-common/src/services/ai-chat.service.tsindex 92b2f22e6..552f0b23d 100644--- a/packages/hoppscotch-common/src/services/ai-chat.service.ts+++ b/packages/hoppscotch-common/src/services/ai-chat.service.ts@@ -52,7 +52,6 @@ import { TeamNameCodec } from "~/helpers/backend/types/TeamName"import { runGQLQuery, type GQLError } from "~/helpers/backend/GQLClient"import {GetTeamEnvironmentsDocument,- TeamAccessRole,WorkspaceType,type CreatePublishedDocsArgs,type GetMyTeamsQuery,@@ -73,7 +72,11 @@ import {switchActiveTabToREST,} from "~/helpers/tab/protocol-switch"import { KernelInterceptorService } from "~/services/kernel-interceptor.service"-import { WorkspaceService, type Workspace } from "~/services/workspace.service"+import {+ WorkspaceService,+ TeamAccessRole,+ type Workspace,+} from "~/services/workspace.service"import { platform } from "~/platform"import type { AIChatModelOption, AIChatSelection } from "~/platform/experiments"import {diff --git a/packages/hoppscotch-common/src/services/workspace.service.ts b/packages/hoppscotch-common/src/services/workspace.service.tsindex 707289471..1856d528c 100644--- a/packages/hoppscotch-common/src/services/workspace.service.ts+++ b/packages/hoppscotch-common/src/services/workspace.service.ts@@ -5,7 +5,6 @@ import { useStreamStatic } from "~/composables/stream"import TeamListAdapter from "~/helpers/teams/TeamListAdapter"import { platform } from "~/platform"import { isEqual, min } from "lodash-es"-import { TeamAccessRole } from "~/helpers/backend/graphql"import { applyLocalState } from "~/newstore/localstate"import { TeamCollectionsService } from "./team-collection.service"import { DocumentationService } from "./documentation.service"@@ -15,6 +14,12 @@ import {setSelectedEnvironmentIndex,} from "~/newstore/environments"+export enum TeamAccessRole {+ Editor = "EDITOR",+ Owner = "OWNER",+ Viewer = "VIEWER",+}+/*** Defines a workspace and its information*/