mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Enable strict null in MSSQL extension (#22433)
This commit is contained in:
@@ -8,9 +8,14 @@ import { Credential } from 'azdata';
|
|||||||
|
|
||||||
// --------------------------------- < Read Credential Request > -------------------------------------------------
|
// --------------------------------- < Read Credential Request > -------------------------------------------------
|
||||||
|
|
||||||
|
// We don't need to include the actual password field when making read/delete requests, so for now just
|
||||||
|
// creating a custom type here to avoid issues with strict null checking until we can get STS updated
|
||||||
|
// to expect just the ID itself instead of the full credential object type
|
||||||
|
export type CredentialId = Omit<Credential, 'password'>;
|
||||||
|
|
||||||
// Read Credential request message callback declaration
|
// Read Credential request message callback declaration
|
||||||
export namespace ReadCredentialRequest {
|
export namespace ReadCredentialRequest {
|
||||||
export const type = new RequestType<Credential, Credential, void, void>('credential/read');
|
export const type = new RequestType<CredentialId, Credential, void, void>('credential/read');
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------- </ Read Credential Request > -------------------------------------------------
|
// --------------------------------- </ Read Credential Request > -------------------------------------------------
|
||||||
@@ -28,6 +33,6 @@ export namespace SaveCredentialRequest {
|
|||||||
|
|
||||||
// Delete Credential request message callback declaration
|
// Delete Credential request message callback declaration
|
||||||
export namespace DeleteCredentialRequest {
|
export namespace DeleteCredentialRequest {
|
||||||
export const type = new RequestType<Credential, boolean, void, void>('credential/delete');
|
export const type = new RequestType<CredentialId, boolean, void, void>('credential/delete');
|
||||||
}
|
}
|
||||||
// --------------------------------- </ Delete Credential Request > -------------------------------------------------
|
// --------------------------------- </ Delete Credential Request > -------------------------------------------------
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ export class SqlCredentialService extends SqlOpsFeature<any> {
|
|||||||
const password = await this._secretStorage.get(credentialId);
|
const password = await this._secretStorage.get(credentialId);
|
||||||
return {
|
return {
|
||||||
credentialId: credentialId,
|
credentialId: credentialId,
|
||||||
password: password
|
password: password || ''
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return this._client.sendRequest(Contracts.ReadCredentialRequest.type, { credentialId, password: undefined });
|
return this._client.sendRequest(Contracts.ReadCredentialRequest.type, { credentialId });
|
||||||
};
|
};
|
||||||
|
|
||||||
let saveCredential = async (credentialId: string, password: string): Promise<boolean> => {
|
let saveCredential = async (credentialId: string, password: string): Promise<boolean> => {
|
||||||
@@ -70,7 +70,7 @@ export class SqlCredentialService extends SqlOpsFeature<any> {
|
|||||||
console.log('credential does not exist in native secret store');
|
console.log('credential does not exist in native secret store');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this._client.sendRequest(Contracts.DeleteCredentialRequest.type, { credentialId, password: undefined });
|
return this._client.sendRequest(Contracts.DeleteCredentialRequest.type, { credentialId });
|
||||||
};
|
};
|
||||||
|
|
||||||
return azdata.credentials.registerProvider({
|
return azdata.credentials.registerProvider({
|
||||||
@@ -87,7 +87,11 @@ export class SqlCredentialService extends SqlOpsFeature<any> {
|
|||||||
|
|
||||||
initialize(capabilities: ServerCapabilities): void { }
|
initialize(capabilities: ServerCapabilities): void { }
|
||||||
|
|
||||||
protected registerProvider(options: any): Disposable { return undefined; }
|
protected registerProvider(options: any): Disposable {
|
||||||
|
return {
|
||||||
|
dispose: () => { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private constructor(context: AppContext, protected readonly client: SqlOpsDataClient) {
|
private constructor(context: AppContext, protected readonly client: SqlOpsDataClient) {
|
||||||
super(client, SqlCredentialService.messagesTypes);
|
super(client, SqlCredentialService.messagesTypes);
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ export class AccountFeature implements StaticFeature {
|
|||||||
}
|
}
|
||||||
let params: contracts.TokenRefreshedParams = {
|
let params: contracts.TokenRefreshedParams = {
|
||||||
token: securityToken.token,
|
token: securityToken.token,
|
||||||
expiresOn: securityToken.expiresOn,
|
expiresOn: securityToken.expiresOn!,
|
||||||
uri: request.uri
|
uri: request.uri
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export abstract class ObjectManagementDialogBase<ObjectInfoType extends ObjectMa
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected get objectInfo(): ObjectInfoType {
|
protected get objectInfo(): ObjectInfoType {
|
||||||
return this._viewInfo?.objectInfo;
|
return this._viewInfo.objectInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected get originalObjectInfo(): ObjectInfoType {
|
protected get originalObjectInfo(): ObjectInfoType {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export class DataItemCache<T> {
|
|||||||
|
|
||||||
millisecondsToLive: number;
|
millisecondsToLive: number;
|
||||||
getValueFunction: (...args: any[]) => Promise<T>;
|
getValueFunction: (...args: any[]) => Promise<T>;
|
||||||
cachedItem: T;
|
cachedItem: T | undefined;
|
||||||
fetchDate: Date;
|
fetchDate: Date;
|
||||||
|
|
||||||
constructor(getValueFunction: (...args: any[]) => Promise<T>, secondsToLive: number) {
|
constructor(getValueFunction: (...args: any[]) => Promise<T>, secondsToLive: number) {
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./out",
|
"outDir": "./out",
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUnusedParameters": false,
|
"noUnusedParameters": false
|
||||||
"strictNullChecks": false
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*"
|
"src/**/*"
|
||||||
|
|||||||
Reference in New Issue
Block a user