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: update to dioc v3 (#4009)
Andrew Bastinbe57255bf768
diff --git a/packages/hoppscotch-common/package.json b/packages/hoppscotch-common/package.jsonindex 1815dc138..156e3b2c6 100644--- a/packages/hoppscotch-common/package.json+++ b/packages/hoppscotch-common/package.json@@ -50,7 +50,7 @@"axios": "1.6.2","buffer": "6.0.3","cookie-es": "1.0.0",- "dioc": "1.0.1",+ "dioc": "3.0.1","esprima": "4.0.1","events": "3.3.0","fp-ts": "2.16.1",diff --git a/packages/hoppscotch-common/src/components.d.ts b/packages/hoppscotch-common/src/components.d.tsindex 88158c30a..b1ab7c333 100644--- a/packages/hoppscotch-common/src/components.d.ts+++ b/packages/hoppscotch-common/src/components.d.ts@@ -32,6 +32,7 @@ declare module 'vue' {AppSpotlightEntryRESTHistory: typeof import('./components/app/spotlight/entry/RESTHistory.vue')['default']AppSpotlightEntryRESTRequest: typeof import('./components/app/spotlight/entry/RESTRequest.vue')['default']AppSpotlightEntryRESTTeamRequestEntry: typeof import('./components/app/spotlight/entry/RESTTeamRequestEntry.vue')['default']+ AppSpotlightSearch: typeof import('./components/app/SpotlightSearch.vue')['default']AppSupport: typeof import('./components/app/Support.vue')['default']Collections: typeof import('./components/collections/index.vue')['default']CollectionsAdd: typeof import('./components/collections/Add.vue')['default']diff --git a/packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.ts b/packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.tsindex 00f6bfaf7..fc408073e 100644--- a/packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.ts+++ b/packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.ts@@ -201,7 +201,7 @@ export class TeamSearchService extends Service {expandingCollections: Ref<string[]> = ref([])expandedCollections: Ref<string[]> = ref([])- // FUTURE-TODO: ideally this should return the search results / formatted results instead of directly manipulating the result set+ // TODO: ideally this should return the search results / formatted results instead of directly manipulating the result set// eg: do the spotlight formatting in the spotlight searcher and not heresearchTeams = async (query: string, teamID: string) => {if (!query.length) {diff --git a/packages/hoppscotch-common/src/modules/dioc.ts b/packages/hoppscotch-common/src/modules/dioc.tsindex a7d24630a..9b044cb44 100644--- a/packages/hoppscotch-common/src/modules/dioc.ts+++ b/packages/hoppscotch-common/src/modules/dioc.ts@@ -1,5 +1,5 @@import { HoppModule } from "."-import { Container, Service } from "dioc"+import { Container, ServiceClassInstance } from "dioc"import { diocPlugin } from "dioc/vue"import { DebugService } from "~/services/debug.service"import { platform } from "~/platform"@@ -22,7 +22,7 @@ if (import.meta.env.DEV) {* services. Please use `useService` if within components or try to convert your* legacy subsystem into a service if possible.*/-export function getService<T extends typeof Service<any> & { ID: string }>(+export function getService<T extends ServiceClassInstance<any>>(service: T): InstanceType<T> {return serviceContainer.bind(service)@@ -30,11 +30,10 @@ export function getService<T extends typeof Service<any> & { ID: string }>(export default <HoppModule>{onVueAppInit(app) {- // TODO: look into this- // @ts-expect-error Something weird with Vue versionsapp.use(diocPlugin, {container: serviceContainer,})+for (const service of platform.addedServices ?? []) {serviceContainer.bind(service)}diff --git a/packages/hoppscotch-common/src/platform/index.ts b/packages/hoppscotch-common/src/platform/index.tsindex fc4882bcc..9caf20e89 100644--- a/packages/hoppscotch-common/src/platform/index.ts+++ b/packages/hoppscotch-common/src/platform/index.ts@@ -8,14 +8,14 @@ import { AnalyticsPlatformDef } from "./analytics"import { InterceptorsPlatformDef } from "./interceptors"import { HoppModule } from "~/modules"import { InspectorsPlatformDef } from "./inspectors"-import { Service } from "dioc"+import { ServiceClassInstance } from "dioc"import { IOPlatformDef } from "./io"import { SpotlightPlatformDef } from "./spotlight"export type PlatformDef = {ui?: UIPlatformDefaddedHoppModules?: HoppModule[]- addedServices?: Array<typeof Service<unknown> & { ID: string }>+ addedServices?: Array<ServiceClassInstance<unknown>>auth: AuthPlatformDefanalytics?: AnalyticsPlatformDefio: IOPlatformDefdiff --git a/packages/hoppscotch-common/src/platform/inspectors.ts b/packages/hoppscotch-common/src/platform/inspectors.tsindex 34d501ed5..cf392b124 100644--- a/packages/hoppscotch-common/src/platform/inspectors.ts+++ b/packages/hoppscotch-common/src/platform/inspectors.ts@@ -1,4 +1,4 @@-import { Service } from "dioc"+import { Container, ServiceClassInstance } from "dioc"import { Inspector } from "~/services/inspection"/**@@ -8,8 +8,9 @@ export type PlatformInspectorsDef = {// We are keeping this as the only mode for now// So that if we choose to add other modes, we can do without breakingtype: "service"- service: typeof Service<unknown> & { ID: string } & {- new (): Service & Inspector+ // TODO: I don't think this type is effective, we have to come up with a better impl+ service: ServiceClassInstance<unknown> & {+ new (c: Container): Inspector}}diff --git a/packages/hoppscotch-common/src/platform/interceptors.ts b/packages/hoppscotch-common/src/platform/interceptors.tsindex 551888019..6c2cd8324 100644--- a/packages/hoppscotch-common/src/platform/interceptors.ts+++ b/packages/hoppscotch-common/src/platform/interceptors.ts@@ -1,12 +1,13 @@-import { Service } from "dioc"+import { Container, ServiceClassInstance } from "dioc"import { Interceptor } from "~/services/interceptor.service"export type PlatformInterceptorDef =| { type: "standalone"; interceptor: Interceptor }| {type: "service"- service: typeof Service<unknown> & { ID: string } & {- new (): Service & Interceptor+ // TODO: I don't think this type is effective, we have to come up with a better impl+ service: ServiceClassInstance<unknown> & {+ new (c: Container): Interceptor}}diff --git a/packages/hoppscotch-common/src/platform/spotlight.ts b/packages/hoppscotch-common/src/platform/spotlight.tsindex b9dda97e0..8e0f3d272 100644--- a/packages/hoppscotch-common/src/platform/spotlight.ts+++ b/packages/hoppscotch-common/src/platform/spotlight.ts@@ -1,10 +1,10 @@-import { Service } from "dioc"+import { Container, ServiceClassInstance } from "dioc"import { SpotlightSearcher } from "~/services/spotlight"export type SpotlightPlatformDef = {additionalSearchers?: Array<- typeof Service<unknown> & { ID: string } & {- new (): Service & SpotlightSearcher+ ServiceClassInstance<unknown> & {+ new (c: Container): SpotlightSearcher}>}diff --git a/packages/hoppscotch-common/src/platform/std/inspections/extension.inspector.ts b/packages/hoppscotch-common/src/platform/std/inspections/extension.inspector.tsindex 1313f8c93..f5c61e522 100644--- a/packages/hoppscotch-common/src/platform/std/inspections/extension.inspector.ts+++ b/packages/hoppscotch-common/src/platform/std/inspections/extension.inspector.ts@@ -31,9 +31,7 @@ export class ExtensionInspectorService extends Service implements Inspector {private readonly inspection = this.bind(InspectionService)- constructor() {- super()-+ override onServiceInit() {this.inspection.registerInspector(this)}diff --git a/packages/hoppscotch-common/src/platform/std/interceptors/extension.ts b/packages/hoppscotch-common/src/platform/std/interceptors/extension.tsindex 64395b124..849c866e5 100644--- a/packages/hoppscotch-common/src/platform/std/interceptors/extension.ts+++ b/packages/hoppscotch-common/src/platform/std/interceptors/extension.ts@@ -133,9 +133,7 @@ export class ExtensionInterceptorServicepublic selectable = { type: "selectable" as const }- constructor() {- super()-+ override onServiceInit() {this.listenForExtensionStatus()}diff --git a/packages/hoppscotch-common/src/services/context-menu/menu/environment.menu.ts b/packages/hoppscotch-common/src/services/context-menu/menu/environment.menu.tsindex 26400ec07..a79b30464 100644--- a/packages/hoppscotch-common/src/services/context-menu/menu/environment.menu.ts+++ b/packages/hoppscotch-common/src/services/context-menu/menu/environment.menu.ts@@ -24,9 +24,7 @@ export class EnvironmentMenuService extends Service implements ContextMenu {private readonly contextMenu = this.bind(ContextMenuService)- constructor() {- super()-+ override onServiceInit() {this.contextMenu.registerMenu(this)}diff --git a/packages/hoppscotch-common/src/services/context-menu/menu/parameter.menu.ts b/packages/hoppscotch-common/src/services/context-menu/menu/parameter.menu.tsindex e481e21e3..53f77afa4 100644--- a/packages/hoppscotch-common/src/services/context-menu/menu/parameter.menu.ts+++ b/packages/hoppscotch-common/src/services/context-menu/menu/parameter.menu.ts@@ -41,9 +41,7 @@ export class ParameterMenuService extends Service implements ContextMenu {private readonly contextMenu = this.bind(ContextMenuService)- constructor() {- super()-+ override onServiceInit() {this.contextMenu.registerMenu(this)}diff --git a/packages/hoppscotch-common/src/services/context-menu/menu/url.menu.ts b/packages/hoppscotch-common/src/services/context-menu/menu/url.menu.tsindex 2e17dcaae..1134cc3d0 100644--- a/packages/hoppscotch-common/src/services/context-menu/menu/url.menu.ts+++ b/packages/hoppscotch-common/src/services/context-menu/menu/url.menu.ts@@ -39,9 +39,7 @@ export class URLMenuService extends Service implements ContextMenu {private readonly contextMenu = this.bind(ContextMenuService)private readonly restTab = this.bind(RESTTabService)- constructor() {- super()-+ override onServiceInit() {this.contextMenu.registerMenu(this)}diff --git a/packages/hoppscotch-common/src/services/cookie-jar.service.ts b/packages/hoppscotch-common/src/services/cookie-jar.service.tsindex b41340a7a..1c3000300 100644--- a/packages/hoppscotch-common/src/services/cookie-jar.service.ts+++ b/packages/hoppscotch-common/src/services/cookie-jar.service.ts@@ -20,10 +20,6 @@ export class CookieJarService extends Service {*/public cookieJar = ref(new Map<string, string[]>())- constructor() {- super()- }-public parseSetCookieString(setCookieString: string) {return setCookieParse(setCookieString)}diff --git a/packages/hoppscotch-common/src/services/debug.service.ts b/packages/hoppscotch-common/src/services/debug.service.tsindex 5d80797cf..5b6c88bc8 100644--- a/packages/hoppscotch-common/src/services/debug.service.ts+++ b/packages/hoppscotch-common/src/services/debug.service.ts@@ -14,9 +14,7 @@ import { Service } from "dioc"export class DebugService extends Service {public static readonly ID = "DEBUG_SERVICE"- constructor() {- super()-+ override onServiceInit() {console.log("DebugService is initialized...")const container = this.getContainer()diff --git a/packages/hoppscotch-common/src/services/inspection/index.ts b/packages/hoppscotch-common/src/services/inspection/index.tsindex 4b1d02ec1..1080e67dd 100644--- a/packages/hoppscotch-common/src/services/inspection/index.ts+++ b/packages/hoppscotch-common/src/services/inspection/index.ts@@ -107,9 +107,7 @@ export class InspectionService extends Service {private readonly restTab = this.bind(RESTTabService)- constructor() {- super()-+ override onServiceInit() {this.initializeListeners()}diff --git a/packages/hoppscotch-common/src/services/inspection/inspectors/environment.inspector.ts b/packages/hoppscotch-common/src/services/inspection/inspectors/environment.inspector.tsindex 89a603966..625bb64bf 100644--- a/packages/hoppscotch-common/src/services/inspection/inspectors/environment.inspector.ts+++ b/packages/hoppscotch-common/src/services/inspection/inspectors/environment.inspector.ts@@ -53,9 +53,7 @@ export class EnvironmentInspectorService extends Service implements Inspector {})[0]- constructor() {- super()-+ override onServiceInit() {this.inspection.registerInspector(this)}diff --git a/packages/hoppscotch-common/src/services/inspection/inspectors/header.inspector.ts b/packages/hoppscotch-common/src/services/inspection/inspectors/header.inspector.tsindex aa711be6c..9062b7ffb 100644--- a/packages/hoppscotch-common/src/services/inspection/inspectors/header.inspector.ts+++ b/packages/hoppscotch-common/src/services/inspection/inspectors/header.inspector.ts@@ -22,9 +22,7 @@ export class HeaderInspectorService extends Service implements Inspector {private readonly inspection = this.bind(InspectionService)private readonly interceptorService = this.bind(InterceptorService)- constructor() {- super()-+ override onServiceInit() {this.inspection.registerInspector(this)}diff --git a/packages/hoppscotch-common/src/services/inspection/inspectors/response.inspector.ts b/packages/hoppscotch-common/src/services/inspection/inspectors/response.inspector.tsindex fc23cdf25..4167b62a3 100644--- a/packages/hoppscotch-common/src/services/inspection/inspectors/response.inspector.ts+++ b/packages/hoppscotch-common/src/services/inspection/inspectors/response.inspector.ts@@ -23,9 +23,7 @@ export class ResponseInspectorService extends Service implements Inspector {private readonly inspection = this.bind(InspectionService)- constructor() {- super()-+ override onServiceInit() {this.inspection.registerInspector(this)}diff --git a/packages/hoppscotch-common/src/services/interceptor.service.ts b/packages/hoppscotch-common/src/services/interceptor.service.tsindex 8abf0f3f7..e35eaacee 100644--- a/packages/hoppscotch-common/src/services/interceptor.service.ts+++ b/packages/hoppscotch-common/src/services/interceptor.service.ts@@ -178,9 +178,7 @@ export class InterceptorService extends Service {return this.interceptors.get(this.currentInterceptorID.value)})- constructor() {- super()-+ override onServiceInit() {// If the current interceptor is unselectable, select the first selectable one, else nullwatch([() => this.interceptors, this.currentInterceptorID], () => {if (!this.currentInterceptorID.value) returndiff --git a/packages/hoppscotch-common/src/services/oauth/oauth.service.ts b/packages/hoppscotch-common/src/services/oauth/oauth.service.tsindex e0b01778b..85140557c 100644--- a/packages/hoppscotch-common/src/services/oauth/oauth.service.ts+++ b/packages/hoppscotch-common/src/services/oauth/oauth.service.ts@@ -109,10 +109,6 @@ export class OauthAuthService extends Service {public static readonly ID = "OAUTH_AUTH_SERVICE"static redirectURI = `${window.location.origin}/oauth`-- constructor() {- super()- }}export const generateRandomString = () => {diff --git a/packages/hoppscotch-common/src/services/persistence/index.ts b/packages/hoppscotch-common/src/services/persistence/index.tsindex d96b722f0..1be2e08e3 100644--- a/packages/hoppscotch-common/src/services/persistence/index.ts+++ b/packages/hoppscotch-common/src/services/persistence/index.ts@@ -89,10 +89,6 @@ export class PersistenceService extends Service {public hoppLocalConfigStorage: StorageLike = localStorage- constructor() {- super()- }-private showErrorToast(localStorageKey: string) {const toast = useToast()toast.error(diff --git a/packages/hoppscotch-common/src/services/secret-environment.service.ts b/packages/hoppscotch-common/src/services/secret-environment.service.tsindex 971853c48..4411df685 100644--- a/packages/hoppscotch-common/src/services/secret-environment.service.ts+++ b/packages/hoppscotch-common/src/services/secret-environment.service.ts@@ -27,10 +27,6 @@ export class SecretEnvironmentService extends Service {*/public secretEnvironments = reactive(new Map<string, SecretVariable[]>())- constructor() {- super()- }-/*** Add a new secret environment.* @param id ID of the environmentdiff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/base/__tests__/static.searcher.spec.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/base/__tests__/static.searcher.spec.tsindex 69a0c9943..cf576ff05 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/base/__tests__/static.searcher.spec.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/base/__tests__/static.searcher.spec.ts@@ -6,6 +6,7 @@ import {import { nextTick, reactive, ref } from "vue"import { SpotlightSearcherResult } from "../../.."import { TestContainer } from "dioc/testing"+import { Container } from "dioc"async function flushPromises() {return await new Promise((r) => setTimeout(r))@@ -32,12 +33,15 @@ describe("StaticSpotlightSearcherService", () => {},})- constructor() {- super({+ // TODO: dioc > v3 does not recommend using constructors, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text"],fieldWeights: {},})+ }+ override onServiceInit() {this.setDocuments(this.documents)}@@ -94,12 +98,15 @@ describe("StaticSpotlightSearcherService", () => {},})- constructor() {- super({+ // TODO: dioc > v3 does not recommend using constructors, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text"],fieldWeights: {},})+ }+ override onServiceInit() {this.setDocuments(this.documents)}@@ -159,12 +166,15 @@ describe("StaticSpotlightSearcherService", () => {},})- constructor() {- super({+ // TODO: dioc > v3 does not recommend using constructors, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text"],fieldWeights: {},})+ }+ override onServiceInit() {this.setDocuments(this.documents)}@@ -224,12 +234,15 @@ describe("StaticSpotlightSearcherService", () => {},})- constructor() {- super({+ // TODO: dioc > v3 does not recommend using constructors, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text"],fieldWeights: {},})+ }+ override onServiceInit() {this.setDocuments(this.documents)}@@ -285,12 +298,15 @@ describe("StaticSpotlightSearcherService", () => {},})- constructor() {- super({+ // TODO: dioc > v3 does not recommend using constructors, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text"],fieldWeights: {},})+ }+ override onServiceInit() {this.setDocuments(this.documents)}@@ -354,12 +370,15 @@ describe("StaticSpotlightSearcherService", () => {},})- constructor() {- super({+ // TODO: dioc > v3 does not recommend using constructors, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternate"],fieldWeights: {},})+ }+ override onServiceInit() {this.setDocuments(this.documents)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/base/static.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/base/static.searcher.tsindex 50af557f6..fc4ee7901 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/base/static.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/base/static.searcher.ts@@ -1,4 +1,4 @@-import { Service } from "dioc"+import { Container, Service } from "dioc"import {type SpotlightSearcher,type SpotlightSearcherResult,@@ -67,8 +67,12 @@ export abstract class StaticSpotlightSearcherService<private _documents: Record<string, Doc> = {}- constructor(private opts: StaticSpotlightSearcherOptions<Doc>) {- super()+ // TODO: This pattern is no longer recommended in dioc > 3, move to something else+ constructor(+ c: Container,+ private opts: StaticSpotlightSearcherOptions<Doc>+ ) {+ super(c)this.minisearch = new MiniSearch({fields: opts.searchFields as string[],diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/collections.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/collections.searcher.tsindex 376b7e8c0..13235cc1c 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/collections.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/collections.searcher.ts@@ -50,9 +50,7 @@ export class CollectionsSpotlightSearcherServiceprivate readonly spotlight = this.bind(SpotlightService)private readonly workspaceService = this.bind(WorkspaceService)- constructor() {- super()-+ override onServiceInit() {this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/environment.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/environment.searcher.tsindex 1eb6a63c1..9b1e726d7 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/environment.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/environment.searcher.ts@@ -26,7 +26,7 @@ import IconEdit from "~icons/lucide/edit"import IconLayers from "~icons/lucide/layers"import IconTrash2 from "~icons/lucide/trash-2"-import { Service } from "dioc"+import { Container, Service } from "dioc"import * as TE from "fp-ts/TaskEither"import { pipe } from "fp-ts/function"import { cloneDeep } from "lodash-es"@@ -164,15 +164,18 @@ export class EnvironmentsSpotlightSearcherService extends StaticSpotlightSearche},})- constructor() {- super({+ // TODO: This pattern is no longer recommended in dioc > 3, move to something else+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternates"],fieldWeights: {text: 2,alternates: 1,},})+ }+ override onServiceInit() {this.setDocuments(this.documents)this.spotlight.registerSearcher(this)}@@ -277,9 +280,7 @@ export class SwitchEnvSpotlightSearcherServiceprivate readonly workspaceService = this.bind(WorkspaceService)private teamEnvironmentList: TeamEnvironment[] = []- constructor() {- super()-+ override onServiceInit() {this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/general.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/general.searcher.tsindex 563d9a2f9..a6c298a04 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/general.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/general.searcher.ts@@ -15,6 +15,7 @@ import IconBook from "~icons/lucide/book"import IconLifeBuoy from "~icons/lucide/life-buoy"import IconZap from "~icons/lucide/zap"import { platform } from "~/platform"+import { Container } from "dioc"type Doc = {text: string | string[]@@ -89,15 +90,18 @@ export class GeneralSpotlightSearcherService extends StaticSpotlightSearcherServ},})- constructor() {- super({+ // TODO: This is not recommended as of dioc > 3. Move to onServiceInit instead+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternates"],fieldWeights: {text: 2,alternates: 1,},})+ }+ override onServiceInit() {this.setDocuments(this.documents)this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/history.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/history.searcher.tsindex 492be5126..73b4ea364 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/history.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/history.searcher.ts@@ -66,9 +66,7 @@ export class HistorySpotlightSearcherService})[0]- constructor() {- super()-+ override onServiceInit() {this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/interceptor.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/interceptor.searcher.tsindex 95490122d..9efcca709 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/interceptor.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/interceptor.searcher.ts@@ -31,9 +31,7 @@ export class InterceptorSpotlightSearcherServiceprivate readonly spotlight = this.bind(SpotlightService)private interceptorService = this.bind(InterceptorService)- constructor() {- super()-+ override onServiceInit() {this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/miscellaneous.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/miscellaneous.searcher.tsindex 0d0fdb0da..5fd76689c 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/miscellaneous.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/miscellaneous.searcher.ts@@ -8,6 +8,7 @@ import {} from "./base/static.searcher"import IconShare from "~icons/lucide/share"+import { Container } from "dioc"type Doc = {text: string@@ -39,15 +40,18 @@ export class MiscellaneousSpotlightSearcherService extends StaticSpotlightSearch},})- constructor() {- super({+ // TODO: Constructors are no longer recommended as of dioc > 3, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternates"],fieldWeights: {text: 2,alternates: 1,},})+ }+ override onServiceInit() {this.setDocuments(this.documents)this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/navigation.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/navigation.searcher.tsindex 61d16b499..e92a63dfa 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/navigation.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/navigation.searcher.ts@@ -8,6 +8,7 @@ import {} from "./base/static.searcher"import IconArrowRight from "~icons/lucide/arrow-right"+import { Container } from "dioc"type Doc = {text: string@@ -61,15 +62,18 @@ export class NavigationSpotlightSearcherService extends StaticSpotlightSearcherSprivate docKeys = Object.keys(this.documents)- constructor() {- super({+ // TODO: Constructors are no longer recommended as of dioc > 3, use onServiceInit instead+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternates"],fieldWeights: {text: 2,alternates: 1,},})+ }+ override onServiceInit() {this.setDocuments(this.documents)this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/request.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/request.searcher.tsindex f67a49202..5d1ed4e40 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/request.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/request.searcher.ts@@ -20,6 +20,7 @@ import IconRotateCCW from "~icons/lucide/rotate-ccw"import IconSave from "~icons/lucide/save"import { GQLOptionTabs } from "~/components/graphql/RequestOptions.vue"import { RESTTabService } from "~/services/tab/rest"+import { Container } from "dioc"type Doc = {text: string | string[]@@ -224,15 +225,18 @@ export class RequestSpotlightSearcherService extends StaticSpotlightSearcherServ},})- constructor() {- super({+ // TODO: Constructors are no longer recommended as of dioc > 3, use onServiceInit instead+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternates"],fieldWeights: {text: 2,alternates: 1,},})+ }+ override onServiceInit() {this.setDocuments(this.documents)this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/response.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/response.searcher.tsindex 3d6b107e5..40832e563 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/response.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/response.searcher.ts@@ -9,6 +9,7 @@ import {import IconDownload from "~icons/lucide/download"import IconCopy from "~icons/lucide/copy"+import { Container } from "dioc"type Doc = {text: string@@ -56,15 +57,18 @@ export class ResponseSpotlightSearcherService extends StaticSpotlightSearcherSer},})- constructor() {- super({+ // TODO: Constructors are no longer recommended as of dioc > 3, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternates"],fieldWeights: {text: 2,alternates: 1,},})+ }+ override onServiceInit() {this.setDocuments(this.documents)this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/settings.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/settings.searcher.tsindex 284c16fd9..4dae87fbc 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/settings.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/settings.searcher.ts@@ -15,6 +15,7 @@ import IconMonitor from "~icons/lucide/monitor"import IconMoon from "~icons/lucide/moon"import IconSun from "~icons/lucide/sun"import IconCheckCircle from "~icons/lucide/check-circle"+import { Container } from "dioc"type Doc = {text: string | string[]@@ -100,15 +101,18 @@ export class SettingsSpotlightSearcherService extends StaticSpotlightSearcherSer},})- constructor() {- super({+ // TODO: Constuctors are no longer recommended as of dioc > 3, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternates"],fieldWeights: {text: 2,alternates: 1,},})+ }+ override onServiceInit() {this.setDocuments(this.documents)this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.tsindex 23b9b12c2..5febcfba9 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.ts@@ -14,6 +14,7 @@ import IconXSquare from "~icons/lucide/x-square"import { invokeAction } from "~/helpers/actions"import { RESTTabService } from "~/services/tab/rest"import { GQLTabService } from "~/services/tab/graphql"+import { Container } from "dioc"type Doc = {text: string | string[]@@ -89,15 +90,18 @@ export class TabSpotlightSearcherService extends StaticSpotlightSearcherService<},})- constructor() {- super({+ // TODO: Constructors are no longer recommended as of dioc > 3, use onServiceInit instead+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternates"],fieldWeights: {text: 2,alternates: 1,},})+ }+ override onServiceInit() {this.setDocuments(this.documents)this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/teamRequest.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/teamRequest.searcher.tsindex ac3426506..777637a7e 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/teamRequest.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/teamRequest.searcher.ts@@ -39,9 +39,7 @@ export class TeamsSpotlightSearcherServiceprivate readonly tabs = this.bind(RESTTabService)- constructor() {- super()-+ override onServiceInit() {this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/user.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/user.searcher.tsindex cc92bdb4c..2013b7062 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/user.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/user.searcher.ts@@ -9,6 +9,7 @@ import { useStreamStatic } from "~/composables/stream"import IconLogin from "~icons/lucide/log-in"import IconLogOut from "~icons/lucide/log-out"import { activeActions$, invokeAction } from "~/helpers/actions"+import { Container } from "dioc"type Doc = {text: string@@ -59,15 +60,18 @@ export class UserSpotlightSearcherService extends StaticSpotlightSearcherService},})- constructor() {- super({+ // TODO: Constructors are no longer recommended as of dioc > 3, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternates"],fieldWeights: {text: 2,alternates: 1,},})+ }+ override onServiceInit(): void {this.setDocuments(this.documents)this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/workspace.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/workspace.searcher.tsindex b6e5cf8ba..4e20e91db 100644--- a/packages/hoppscotch-common/src/services/spotlight/searchers/workspace.searcher.ts+++ b/packages/hoppscotch-common/src/services/spotlight/searchers/workspace.searcher.ts@@ -21,7 +21,7 @@ import {StaticSpotlightSearcherService,} from "./base/static.searcher"-import { Service } from "dioc"+import { Container, Service } from "dioc"import * as E from "fp-ts/Either"import MiniSearch from "minisearch"import IconCheckCircle from "~/components/app/spotlight/entry/IconSelected.vue"@@ -102,15 +102,18 @@ export class WorkspaceSpotlightSearcherService extends StaticSpotlightSearcherSe},})- constructor() {- super({+ // TODO: Constructors are no longer recommended as of dioc > 3, move to onServiceInit+ constructor(c: Container) {+ super(c, {searchFields: ["text", "alternates"],fieldWeights: {text: 2,alternates: 1,},})+ }+ override onServiceInit() {this.setDocuments(this.documents)this.spotlight.registerSearcher(this)}@@ -166,9 +169,7 @@ export class SwitchWorkspaceSpotlightSearcherServiceprivate readonly spotlight = this.bind(SpotlightService)private readonly workspaceService = this.bind(WorkspaceService)- constructor() {- super()-+ override onServiceInit() {this.spotlight.registerSearcher(this)}diff --git a/packages/hoppscotch-common/src/services/tab/__tests__/tab.service.spec.ts b/packages/hoppscotch-common/src/services/tab/__tests__/tab.service.spec.tsindex 073550534..a174047a2 100644--- a/packages/hoppscotch-common/src/services/tab/__tests__/tab.service.spec.ts+++ b/packages/hoppscotch-common/src/services/tab/__tests__/tab.service.spec.ts@@ -6,9 +6,7 @@ import { reactive } from "vue"class MockTabService extends TabService<{ request: string }> {public static readonly ID = "MOCK_TAB_SERVICE"- constructor() {- super()-+ override onServiceInit() {this.tabMap = reactive(new Map([[diff --git a/packages/hoppscotch-common/src/services/tab/graphql.ts b/packages/hoppscotch-common/src/services/tab/graphql.tsindex 3e587ffea..f220b4d7e 100644--- a/packages/hoppscotch-common/src/services/tab/graphql.ts+++ b/packages/hoppscotch-common/src/services/tab/graphql.ts@@ -7,9 +7,7 @@ import { computed } from "vue"export class GQLTabService extends TabService<HoppGQLDocument> {public static readonly ID = "GQL_TAB_SERVICE"- constructor() {- super()-+ override onServiceInit() {this.tabMap.set("test", {id: "test",document: {diff --git a/packages/hoppscotch-common/src/services/tab/rest.ts b/packages/hoppscotch-common/src/services/tab/rest.tsindex cf8972bd3..604fc1217 100644--- a/packages/hoppscotch-common/src/services/tab/rest.ts+++ b/packages/hoppscotch-common/src/services/tab/rest.ts@@ -7,9 +7,7 @@ import { TabService } from "./tab"export class RESTTabService extends TabService<HoppRESTDocument> {public static readonly ID = "REST_TAB_SERVICE"- constructor() {- super()-+ override onServiceInit() {this.tabMap.set("test", {id: "test",document: {diff --git a/packages/hoppscotch-common/src/services/workspace.service.ts b/packages/hoppscotch-common/src/services/workspace.service.tsindex 09aa2aa3a..d8b300272 100644--- a/packages/hoppscotch-common/src/services/workspace.service.ts+++ b/packages/hoppscotch-common/src/services/workspace.service.ts@@ -48,8 +48,7 @@ export class WorkspaceService extends Service<WorkspaceServiceEvent> {-1)- constructor() {- super()+ override onServiceInit() {// Dispose the managed team list adapter when the user logs out// and initialize it when the user logs inwatch(diff --git a/packages/hoppscotch-selfhost-desktop/package.json b/packages/hoppscotch-selfhost-desktop/package.jsonindex 65311f21c..a979b7ab5 100644--- a/packages/hoppscotch-selfhost-desktop/package.json+++ b/packages/hoppscotch-selfhost-desktop/package.json@@ -23,7 +23,7 @@"@vueuse/core": "10.5.0","axios": "0.21.4","buffer": "6.0.3",- "dioc": "1.0.1",+ "dioc": "3.0.1","environments.api": "link:@platform/environments/environments.api","event": "link:@tauri-apps/api/event","fp-ts": "2.16.1",@@ -78,4 +78,4 @@"vite-plugin-vue-layouts": "0.7.0","vue-tsc": "1.8.8"}-}\ No newline at end of file+}diff --git a/packages/hoppscotch-selfhost-desktop/src/platform/interceptors/native.ts b/packages/hoppscotch-selfhost-desktop/src/platform/interceptors/native.tsindex 716c57436..de3bf60ef 100644--- a/packages/hoppscotch-selfhost-desktop/src/platform/interceptors/native.ts+++ b/packages/hoppscotch-selfhost-desktop/src/platform/interceptors/native.ts@@ -138,10 +138,6 @@ export class NativeInterceptorService extends Service implements Interceptor {public cookieJarService = this.bind(CookieJarService)- constructor() {- super()- }-public runRequest(req: any) {const processedReq = preProcessRequest(req)diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex b63b3060e..37ad45993 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -455,8 +455,8 @@ importers:specifier: 1.0.0version: 1.0.0dioc:- specifier: 1.0.1- version: 1.0.1([email protected]([email protected]))+ specifier: 3.0.1+ version: 3.0.1([email protected]([email protected]))esprima:specifier: 4.0.1version: 4.0.1@@ -923,8 +923,8 @@ importers:specifier: 6.0.3version: 6.0.3dioc:- specifier: 1.0.1- version: 1.0.1([email protected]([email protected]))+ specifier: 3.0.1+ version: 3.0.1([email protected]([email protected]))environments.api:specifier: link:@platform/environments/environments.apiversion: link:@platform/environments/environments.api@@ -3511,6 +3511,10 @@ packages:resolution: {integrity: sha512-4ttr/FNO29w+kBbU7HZ/U0Lzuh2cRDhP8UlWOtV9ERcjHzuyXVZmjyleESK6eVP60tGC9QtQW9yZE+JeRhDHkg==}engines: {node: '>= 14'}+ '@intlify/[email protected]':+ resolution: {integrity: sha512-OGwttsMwB2BUzhZLraoAfAqcza5UyLMEU013ort3LbmdE6ke/pFONFyxjNQdmFWzW2K868AIVgwx4zo8lbmhjg==}+ engines: {node: '>= 16'}+'@intlify/[email protected]':resolution: {integrity: sha512-IUrQW7byAKN2fMBe8z6sK6riG1pue95e5jfokn8hA5Q3Bqy4MBJ5lJAofUsawQJYHeoPJ7svMDyBaVJ4d0GTtA==}engines: {node: '>= 14'}@@ -3519,14 +3523,14 @@ packages:resolution: {integrity: sha512-hwqQXyTnDzAVZ300SU31jO0+3OJbpOdfVU6iBkrmNpS7t2HRnVACo0EwcEXzJa++4EVDreqz5OeqJbt+PeSGGA==}engines: {node: '>= 16'}- '@intlify/[email protected]':- resolution: {integrity: sha512-aN2N+dUx320108QhH51Ycd2LEpZ+NKbzyQ2kjjhqMcxhHdxtOnkgdx+MDBhOy/CObwBmhC3Nygzc6hNlfKvPNw==}- engines: {node: '>= 16'}-'@intlify/[email protected]':resolution: {integrity: sha512-McnYWhcoYmDJvssVu6QGR0shqlkJuL1HHdi5lK7fNqvQqRYaQ4lSLjYmZxwc8tRNMdIe9/KUKfyPxU9M6yCtNQ==}engines: {node: '>= 16'}+ '@intlify/[email protected]':+ resolution: {integrity: sha512-pWlpsC3IqkDuIH/5bNlyyiUbAXYymeNXkznORzPWT3qpAe8MazPOm14wMHGn/wESCdB5b9txQson4+CH0ym1hQ==}+ engines: {node: '>= 16'}+'@intlify/[email protected]':resolution: {integrity: sha512-wRwTpsslgZS5HNyM7uDQYZtxnbI12aGiBZURX3BTR9RFIKKRWpllTsgzHWvj3HKm3Y2Sh5LPC1r0PDCKEhVn9Q==}engines: {node: '>= 14'}@@ -3535,10 +3539,6 @@ packages:resolution: {integrity: sha512-RucSPqh8O9FFxlYUysQTerSw0b9HIRpyoN1Zjogpm0qLiHK+lBNSa5sh1nCJ4wSsNcjphzgpLQCyR60GZlRV8g==}engines: {node: '>= 16'}- '@intlify/[email protected]':- resolution: {integrity: sha512-A51elBmZWf1FS80inf/32diO9DeXoqg9GR9aUDHFcfHoNDuT46Q+fpPOdj8jiJnSHSBh8E1E+6qWRhAZXdK3Ng==}- engines: {node: '>= 16'}-'@intlify/[email protected]':resolution: {integrity: sha512-TmgR0RCLjzrSo+W3wT0ALf9851iFMlVI9EYNGeWvZFUQTAJx0bvfsMlPdgVtV1tDNRiAfhkFsMKu6jtUY1ZLKQ==}engines: {node: '>= 16'}@@ -6457,8 +6457,8 @@ packages:resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==}engines: {node: '>=0.3.1'}- resolution: {integrity: sha512-G3T8ThO2WehWJFrKp687wpXU//WLueJA6t5L7yirhWN/jn7BFNRKwskbJn0LEEd6gqI6rwiQE48f2Zqt5jvYVw==}+ resolution: {integrity: sha512-LawhI08/B5f5sA6zqrNdtZY9URCjIzmebKVZhmR8lH05HFlx/spAoz4kJ7x1E6pRf/kvWsePSkudv18OR5FT6Q==}peerDependencies:vue: 3.3.9peerDependenciesMeta:@@ -9163,8 +9163,8 @@ packages:resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==}- resolution: {integrity: sha512-zcGgwoXbzw9NczqbGzAWL/ToDYAxv1V8gL1D67ClbdkIfeeDBbY0GelZtC25ayLvVjr2q2cloHeQV1R0QAWqRQ==}+ resolution: {integrity: sha512-Dp+A9JWxRaKuHP35H77I4kCKesDy5HUDEmScia2FyncMTOXASMyg251F5PhFoDA5uqBrDDffiLpbqnrZmNXW+g==}engines: {node: '>=10'}@@ -12132,6 +12132,7 @@ packages:resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==}+ deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintainedresolution: {integrity: sha512-juWCSrxo/fiMz3RsvDspeSLGmbgC0U9tKqcUPZBCf35s64wlaLXyn2KdHHXVQrb2cqF7I0Hc9siQalainmnXJA==}@@ -15444,8 +15445,8 @@ snapshots:dependencies:- '@intlify/message-compiler': 9.4.1- '@intlify/shared': 9.4.1+ '@intlify/message-compiler': 10.0.0-alpha.2+ '@intlify/shared': 10.0.0-alpha.2jsonc-eslint-parser: 1.4.1source-map: 0.6.1yaml-eslint-parser: 0.3.2@@ -15498,6 +15499,11 @@ snapshots:dependencies:'@intlify/shared': 9.2.2+ '@intlify/[email protected]':+ dependencies:+ '@intlify/shared': 10.0.0-alpha.2+ source-map-js: 1.0.2+'@intlify/[email protected]':dependencies:'@intlify/shared': 9.2.2@@ -15508,22 +15514,17 @@ snapshots:'@intlify/shared': 9.3.0-beta.20source-map-js: 1.0.2- '@intlify/[email protected]':- dependencies:- '@intlify/shared': 9.4.1- source-map-js: 1.0.2-'@intlify/[email protected]':dependencies:'@intlify/shared': 9.8.0source-map-js: 1.0.2+ '@intlify/[email protected]': {}+'@intlify/[email protected]': {}'@intlify/[email protected]': {}- '@intlify/[email protected]': {}-'@intlify/[email protected]': {}'@intlify/[email protected]([email protected])([email protected]([email protected]([email protected])))':@@ -15549,7 +15550,7 @@ snapshots:'@intlify/[email protected]([email protected](@types/[email protected])([email protected])([email protected]))([email protected]([email protected]([email protected])))':dependencies:- '@intlify/shared': 9.4.1+ '@intlify/shared': 10.0.0-alpha.2'@rollup/pluginutils': 4.2.1debug: 4.3.4([email protected])fast-glob: 3.3.2@@ -15563,7 +15564,7 @@ snapshots:'@intlify/[email protected]([email protected](@types/[email protected])([email protected])([email protected]))([email protected]([email protected]([email protected])))':dependencies:- '@intlify/shared': 9.4.1+ '@intlify/shared': 10.0.0-alpha.2'@rollup/pluginutils': 4.2.1debug: 4.3.4([email protected])fast-glob: 3.3.2@@ -16673,7 +16674,7 @@ snapshots:'@types/[email protected]':dependencies:- '@types/node': 18.18.8+ '@types/node': 17.0.45'@types/[email protected]': {}@@ -19340,13 +19341,13 @@ snapshots:dependencies:rxjs: 7.8.1optionalDependencies:vue: 3.3.9([email protected])dependencies:rxjs: 7.8.1optionalDependencies:@@ -23232,7 +23233,7 @@ snapshots:lower-case: 2.0.2tslib: 2.6.2dependencies:semver: 7.6.0@@ -23808,7 +23809,7 @@ snapshots:minimist: 1.2.6mkdirp-classic: 0.5.3napi-build-utils: 1.0.2- node-abi: 3.60.0+ node-abi: 3.57.0pump: 3.0.0rc: 1.2.8simple-get: 4.0.1