Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/addServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export async function addServer(
"intersystems",
scope,
);
const serversInspection = config.inspect("servers");
const serversInspection = config.inspect<Record<string, Omit<IServerSetting, "name">>>("servers");
const servers = (
target == vscode.ConfigurationTarget.WorkspaceFolder ? serversInspection?.workspaceFolderValue :
target == vscode.ConfigurationTarget.Workspace ? serversInspection?.workspaceValue :
Expand Down
3 changes: 2 additions & 1 deletion src/api/getServerNames.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { IServerName } from "@intersystems-community/intersystems-servermanager";
import * as vscode from "vscode";
import { IServerSetting } from "../serverSetting";
import { serverDetail } from "./getServerSummary";

export function getServerNames(scope?: vscode.ConfigurationScope, sorted?: boolean): IServerName[] {
const allNames: IServerName[] = [];
const names: IServerName[] = [];
const servers = vscode.workspace.getConfiguration("intersystems", scope).get("servers");
const servers = vscode.workspace.getConfiguration("intersystems", scope).get<Record<string, IServerSetting> & { "/default"?: string }>("servers");

if (typeof servers === "object" && servers) {

Expand Down
14 changes: 8 additions & 6 deletions src/commands/importFromRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as vscode from "vscode";
import { ServerManagerAuthenticationProvider } from "../authenticationProvider";

// To avoid overhead querying the registry, cache responses (each time the command is run)
const regQueryCache = new Map<string, { data?: string }>();
const regQueryCache = new Map<string, { data?: string | null }>();

export async function importFromRegistry(secretStorage: vscode.SecretStorage, scope?: vscode.ConfigurationScope) {
const config = vscode.workspace.getConfiguration("intersystems", scope);
Expand Down Expand Up @@ -64,7 +64,7 @@ export async function importFromRegistry(secretStorage: vscode.SecretStorage, sc

async function loadRegistryData(
config: vscode.WorkspaceConfiguration,
serverDefinitions,
serverDefinitions: ServerDefinitions,
serversMissingUsernames: string[],
newServerNames: string[],
): Promise<number> {
Expand Down Expand Up @@ -206,6 +206,8 @@ async function promptForUsernames(serverDefinitions: ServerDefinitions, serversM

export interface ServerDefinition {
username?: string;
description?: string;
webServer?: { scheme: string; host?: string; port: number; pathPrefix?: string };
}

export type ServerDefinitions = Record<string, ServerDefinition>;
Expand Down Expand Up @@ -269,8 +271,8 @@ async function promptForPasswords(secretStorage: vscode.SecretStorage, serverDef
}
}

function preloadRegistryCache(cmd, fullPath) {
const regData = cmd.runSync("reg query " + fullPath + " /s");
function preloadRegistryCache(cmd: any, fullPath: string) {
const regData: { data: string | null } = cmd.runSync("reg query " + fullPath + " /s");
if (!regData.data) {
return;
}
Expand All @@ -283,9 +285,9 @@ function preloadRegistryCache(cmd, fullPath) {
});
}

function getStringRegKey(cmd, hive, path, key): string | undefined {
function getStringRegKey(cmd: any, hive: string, path: string, key: string): string | undefined {
const queryPath = hive + "\\" + path;
const regData = regQueryCache.get(queryPath) || cmd.runSync("reg query " + queryPath);
const regData: { data?: string | null } = regQueryCache.get(queryPath) || cmd.runSync("reg query " + queryPath);
if (!regData.data) {
return undefined;
}
Expand Down
4 changes: 2 additions & 2 deletions src/commonActivate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class BasicAuthorization implements Authorization {
return this.username !== "" && this.#password !== undefined;
}

public resolve({ accessToken, username }): this is ResolvedAuthorization {
public resolve({ accessToken, username }: { accessToken?: string; username?: string }): this is ResolvedAuthorization {
this.#username = username ?? this.#username;
this.#password = accessToken ?? this.#password;
return this.resolved();
Expand Down Expand Up @@ -92,7 +92,7 @@ export class OAuth2Authorization implements Authorization {
return this.#bearer ? true : false;
}

public resolve({ accessToken, username }): this is ResolvedAuthorization {
public resolve({ accessToken, username }: { accessToken?: string; username?: string }): this is ResolvedAuthorization {
// empty accessTokens are ignored.
if (accessToken) {
this.#bearer = accessToken;
Expand Down
6 changes: 3 additions & 3 deletions src/makeRESTRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function makeRESTRequest(
url += "v" + String(endpoint.apiVersion) + "/" + endpoint.namespace + endpoint.path;
}

const request: AxiosRequestConfig & { headers: {}, data?: any } = {
const request: AxiosRequestConfig & { headers: {}, data?: any, [key: string]: any } = {
httpsAgent,
headers: {},
method,
Expand Down Expand Up @@ -206,11 +206,11 @@ async function resolveCredentials(spec: IServerSpec & { auth: Authorization }):
* If `error` is `undefined`, returns the empty string.
* Borrowed from `vscode-objectscript:/src/utils/index.ts`
*/
function stringifyError(error): string {
function stringifyError(error: any): string {
try {
if (Array.isArray(error?.errors)) {
// Need to stringify the inner errors of an AggregateError
const errs = error.errors.map(stringifyError).filter((s) => s != "");
const errs = error.errors.map(stringifyError).filter((s: string) => s != "");
return errs.length ? `AggregateError:\n- ${errs.join("\n- ")}` : "";
}
return (
Expand Down
2 changes: 1 addition & 1 deletion src/test/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function main() {
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, "./suite/index");

const launchArgs = [];
const launchArgs: string[] = [];

// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs });
Expand Down
2 changes: 1 addition & 1 deletion src/ui/serverManagerView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ async function namespaceProjects(element: ProjectsTreeItem, params?: ServerParam
vscode.window.showErrorMessage(message);
return undefined;
}
response.data.result.content.map((project) => {
response.data.result.content.map((project: { Name: string; Description: string }) => {
children.push(new ProjectTreeItem({ parent: element, label: name, id: name }, project.Name, project.Description, params.serverApiVersion!));
});
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"target": "es2019",
"noImplicitAny": false,
"noImplicitAny": true,
"removeComments": false,
"noUnusedLocals": true,
"noImplicitThis": true,
Expand Down
Loading