@scalar/api-client
Version:
the open source API testing client
387 lines • 17.2 kB
TypeScript
import type { Cookie } from '@scalar/oas-utils/entities/cookie';
import { type Environment } from '@scalar/oas-utils/entities/environment';
import type { Collection, Request, RequestExample, Server } from '@scalar/oas-utils/entities/spec';
import type { Workspace } from '@scalar/oas-utils/entities/workspace';
import { type InjectionKey } from 'vue';
import type { Router } from 'vue-router';
type CreateActiveEntitiesStoreParams = {
collections: Record<string, Collection>;
environments: Record<string, Environment>;
requestExamples: Record<string, RequestExample>;
requests: Record<string, Request>;
servers: Record<string, Server>;
workspaces: Record<string, Workspace>;
router?: Router;
};
export type EnvVariable = {
key: string;
value: any;
source: 'global' | 'collection';
};
/**
* Create the active entities store
*
* We need the factory function to pass the router instance
*/
export declare const createActiveEntitiesStore: ({ collections, requestExamples, requests, router, servers, workspaces, }: CreateActiveEntitiesStoreParams) => {
activeCollection: import("vue").ComputedRef<{
type: "collection";
openapi: string;
info: {
title: string;
version: string;
summary?: string | undefined;
description?: string | undefined;
termsOfService?: string | undefined;
contact?: {
name?: string | undefined;
url?: string | undefined;
email?: string | undefined;
} | undefined;
license?: {
name?: string | null | undefined;
identifier?: string | undefined;
url?: string | undefined;
} | undefined;
'x-scalar-sdk-installation'?: {
lang: string;
source?: string | undefined;
description?: string | undefined;
}[] | undefined;
};
security: Record<string, string[]>[];
'x-scalar-icon': string;
uid: string & import("zod").$brand<"collection">;
securitySchemes: string[];
selectedSecuritySchemeUids: ((string & import("zod").$brand<"securityScheme">) | (string & import("zod").$brand<"securityScheme">)[])[];
servers: (string & import("zod").$brand<"server">)[];
requests: (string & import("zod").$brand<"operation">)[];
tags: (string & import("zod").$brand<"tag">)[];
children: ((string & import("zod").$brand<"operation">) | (string & import("zod").$brand<"tag">))[];
watchMode: boolean;
useCollectionSecurity: boolean;
watchModeStatus: "IDLE" | "WATCHING" | "ERROR";
jsonSchemaDialect?: string | undefined;
externalDocs?: {
url: string;
description?: string | undefined;
} | undefined;
components?: Record<string, unknown> | undefined;
webhooks?: Record<string, unknown> | undefined;
'x-scalar-active-environment'?: string | undefined;
'x-scalar-environments'?: Record<string, {
variables: Record<string, string | {
default: string;
description?: string | undefined;
}>;
description?: string | undefined;
color?: string | undefined;
}> | undefined;
'x-scalar-secrets'?: Record<string, {
description?: string | undefined;
example?: string | undefined;
}> | undefined;
selectedServerUid?: (string & import("zod").$brand<"server">) | undefined;
documentUrl?: string | undefined;
integration?: string | null | undefined;
} | undefined>;
activeCookieId: import("vue").ComputedRef<string & import("zod").$brand<"cookie">>;
activeExample: import("vue").ComputedRef<{
uid: string & import("zod").$brand<"example">;
type: "requestExample";
name: string;
body: {
activeBody: "raw" | "formData" | "binary";
raw?: {
encoding: "html" | "xml" | "json" | "text" | "javascript" | "yaml" | "edn";
value: string;
mimeType?: string | undefined;
} | undefined;
formData?: {
encoding: "form-data" | "urlencoded";
value: {
key: string;
value: string;
enabled: boolean;
file?: any;
description?: string | undefined;
required?: boolean | undefined;
enum?: string[] | undefined;
examples?: any[] | undefined;
type?: string | string[] | undefined;
format?: string | undefined;
minimum?: number | undefined;
maximum?: number | undefined;
default?: any;
nullable?: boolean | undefined;
}[];
} | undefined;
binary?: Blob | undefined;
};
parameters: {
path: {
key: string;
value: string;
enabled: boolean;
file?: any;
description?: string | undefined;
required?: boolean | undefined;
enum?: string[] | undefined;
examples?: any[] | undefined;
type?: string | string[] | undefined;
format?: string | undefined;
minimum?: number | undefined;
maximum?: number | undefined;
default?: any;
nullable?: boolean | undefined;
}[];
query: {
key: string;
value: string;
enabled: boolean;
file?: any;
description?: string | undefined;
required?: boolean | undefined;
enum?: string[] | undefined;
examples?: any[] | undefined;
type?: string | string[] | undefined;
format?: string | undefined;
minimum?: number | undefined;
maximum?: number | undefined;
default?: any;
nullable?: boolean | undefined;
}[];
headers: {
key: string;
value: string;
enabled: boolean;
file?: any;
description?: string | undefined;
required?: boolean | undefined;
enum?: string[] | undefined;
examples?: any[] | undefined;
type?: string | string[] | undefined;
format?: string | undefined;
minimum?: number | undefined;
maximum?: number | undefined;
default?: any;
nullable?: boolean | undefined;
}[];
cookies: {
key: string;
value: string;
enabled: boolean;
file?: any;
description?: string | undefined;
required?: boolean | undefined;
enum?: string[] | undefined;
examples?: any[] | undefined;
type?: string | string[] | undefined;
format?: string | undefined;
minimum?: number | undefined;
maximum?: number | undefined;
default?: any;
nullable?: boolean | undefined;
}[];
};
requestUid?: (string & import("zod").$brand<"operation">) | undefined;
serverVariables?: Record<string, string[]> | undefined;
} | undefined>;
activeRequest: import("vue").ComputedRef<{
type: "request";
uid: string & import("zod").$brand<"operation">;
path: string;
method: "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
servers: (string & import("zod").$brand<"server">)[];
selectedServerUid: (string & import("zod").$brand<"server">) | null;
examples: (string & import("zod").$brand<"example">)[];
selectedSecuritySchemeUids: ((string & import("zod").$brand<"securityScheme">) | (string & import("zod").$brand<"securityScheme">)[])[];
description?: string | undefined;
summary?: string | undefined;
externalDocs?: {
url: string;
description?: string | undefined;
} | undefined;
'x-internal'?: boolean | undefined;
'x-scalar-ignore'?: boolean | undefined;
security?: Record<string, string[]>[] | undefined;
tags?: string[] | undefined;
deprecated?: boolean | undefined;
operationId?: string | undefined;
requestBody?: any;
parameters?: {
in: "path" | "cookie" | "query" | "header";
name: string;
required: boolean;
deprecated: boolean;
description?: string | undefined;
schema?: unknown;
content?: unknown;
style?: "matrix" | "label" | "form" | "simple" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
explode?: boolean | undefined;
example?: unknown;
examples?: Record<string, {
value?: unknown;
summary?: string | undefined;
externalValue?: string | undefined;
}> | unknown[] | undefined;
}[] | undefined;
responses?: Record<string, any> | undefined;
callbacks?: Record<string, Record<string, Record<string, any>>> | undefined;
'x-codeSamples'?: {
source: string;
lang?: string | undefined;
label?: string | undefined;
}[] | undefined;
'x-code-samples'?: {
source: string;
lang?: string | undefined;
label?: string | undefined;
}[] | undefined;
'x-custom-examples'?: {
source: string;
lang?: string | undefined;
label?: string | undefined;
}[] | undefined;
'x-scalar-stability'?: import("@scalar/types/legacy").XScalarStability | undefined;
'x-post-response'?: string | undefined;
} | undefined>;
activeRouterParams: import("vue").ComputedRef<{
readonly collection: Collection["uid"];
readonly environment: Environment["uid"];
readonly request: Request["uid"];
readonly examples: RequestExample["uid"];
readonly schema: string;
readonly cookies: Cookie["uid"];
readonly servers: Server["uid"];
readonly workspace: Workspace["uid"];
readonly settings: string;
}>;
activeEnvironment: import("vue").ComputedRef<{
uid: string & import("zod").$brand<"environment">;
name: string;
color: string;
value: string;
isDefault?: boolean | undefined;
}>;
activeServer: import("vue").ComputedRef<{
url: string;
uid: string & import("zod").$brand<"server">;
description?: string | undefined;
variables?: Record<string, {
enum?: string[] | undefined;
default?: string | undefined;
description?: string | undefined;
value?: string | undefined;
}> | undefined;
} | undefined>;
activeWorkspace: import("vue").ComputedRef<{
uid: string & import("zod").$brand<"workspace">;
name: string;
description: string;
collections: (string & import("zod").$brand<"collection">)[];
environments: Record<string, string>;
activeEnvironmentId: string;
cookies: (string & import("zod").$brand<"cookie">)[];
themeId: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "laserwave" | "none";
selectedHttpClient: {
targetKey: string;
clientKey: string;
};
hotKeyConfig?: {
modifiers: ("default" | "Meta" | "Control" | "Shift" | "Alt")[];
hotKeys?: Partial<Record<"" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "0" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "*" | "+" | "-" | "." | "/" | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]" | "4" | "1" | "2" | "3" | "5" | "6" | "7" | "8" | "9", {
event: "addTopNav" | "closeModal" | "closeTopNav" | "createNew" | "executeRequest" | "focusAddressBar" | "focusRequestSearch" | "jumpToLastTab" | "jumpToTab" | "navigateSearchResultsDown" | "navigateSearchResultsUp" | "navigateTopNavLeft" | "navigateTopNavRight" | "openCommandPalette" | "selectSearchResult" | "toggleSidebar";
modifiers?: ("default" | "Meta" | "Control" | "Shift" | "Alt")[] | undefined;
}>> | undefined;
} | undefined;
proxyUrl?: string | undefined;
} | undefined>;
activeWorkspaceCollections: import("vue").ComputedRef<{
type: "collection";
openapi: string;
info: {
title: string;
version: string;
summary?: string | undefined;
description?: string | undefined;
termsOfService?: string | undefined;
contact?: {
name?: string | undefined;
url?: string | undefined;
email?: string | undefined;
} | undefined;
license?: {
name?: string | null | undefined;
identifier?: string | undefined;
url?: string | undefined;
} | undefined;
'x-scalar-sdk-installation'?: {
lang: string;
source?: string | undefined;
description?: string | undefined;
}[] | undefined;
};
security: Record<string, string[]>[];
'x-scalar-icon': string;
uid: string & import("zod").$brand<"collection">;
securitySchemes: string[];
selectedSecuritySchemeUids: ((string & import("zod").$brand<"securityScheme">) | (string & import("zod").$brand<"securityScheme">)[])[];
servers: (string & import("zod").$brand<"server">)[];
requests: (string & import("zod").$brand<"operation">)[];
tags: (string & import("zod").$brand<"tag">)[];
children: ((string & import("zod").$brand<"operation">) | (string & import("zod").$brand<"tag">))[];
watchMode: boolean;
useCollectionSecurity: boolean;
watchModeStatus: "IDLE" | "WATCHING" | "ERROR";
jsonSchemaDialect?: string | undefined;
externalDocs?: {
url: string;
description?: string | undefined;
} | undefined;
components?: Record<string, unknown> | undefined;
webhooks?: Record<string, unknown> | undefined;
'x-scalar-active-environment'?: string | undefined;
'x-scalar-environments'?: Record<string, {
variables: Record<string, string | {
default: string;
description?: string | undefined;
}>;
description?: string | undefined;
color?: string | undefined;
}> | undefined;
'x-scalar-secrets'?: Record<string, {
description?: string | undefined;
example?: string | undefined;
}> | undefined;
selectedServerUid?: (string & import("zod").$brand<"server">) | undefined;
documentUrl?: string | undefined;
integration?: string | null | undefined;
}[]>;
activeWorkspaceServers: import("vue").ComputedRef<({
url: string;
uid: string & import("zod").$brand<"server">;
description?: string | undefined;
variables?: Record<string, {
enum?: string[] | undefined;
default?: string | undefined;
description?: string | undefined;
value?: string | undefined;
}> | undefined;
} | undefined)[]>;
activeEnvVariables: import("vue").ComputedRef<EnvVariable[]>;
activeWorkspaceRequests: import("vue").ComputedRef<(string & import("zod").$brand<"operation">)[]>;
};
export type ActiveEntitiesStore = ReturnType<typeof createActiveEntitiesStore>;
export declare const ACTIVE_ENTITIES_SYMBOL: InjectionKey<ActiveEntitiesStore>;
/**
* The active entities store
*
* This store returns anything related to the currently active entities
* The only reason this is a store and not a simple hook is due to storing the current router here
*
* @deprecated due to components being used outside of the client now, we should prop drill instead of this hook/store
*/
export declare const useActiveEntities: () => ActiveEntitiesStore;
export {};
//# sourceMappingURL=active-entities.d.ts.map