Skip to content

Commit

Permalink
Fix a couple of typos that snuck in #434
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Cauchois authored and pierreca committed Nov 29, 2018
1 parent 80f14df commit 978e014
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 0 additions & 2 deletions common/core/src/promise_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ export type HttpResponseCallback<TResult> = TripleValueCallback<TResult, any>;
* const param = 42;
* callbackToPromise((_callback) => foo(param, _callback)).then(result => { console.log(result); }, error => { console.error(error); });
*/
export function callbackToPromise<TResult>(callBackOperation: (callback: Callback<TResult>) => void, userCallback: Callback<TResult>): void;
export function callbackToPromise<TResult>(callBackOperation: (callback: Callback<TResult>) => void): Promise<TResult>;
export function callbackToPromise<TResult>(callBackOperation: (callback: Callback<TResult>) => void, userCallback?: Callback<TResult>): Promise<TResult> | void {
if (userCallback) {
if (!(typeof userCallback === 'function')) {
Expand Down
4 changes: 2 additions & 2 deletions provisioning/service/src/provisioningserviceclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class ProvisioningServiceClient {
*/
public deleteIndividualEnrollment(enrollmentOrId: string | IndividualEnrollment, etag: string, deleteCallback: ErrorCallback): void;
public deleteIndividualEnrollment(enrollmentOrId: string | IndividualEnrollment, deleteCallback: ErrorCallback): void;
public deleteIndividualEnrollment(enrollmentOrId: string | IndividualEnrollment, etagOr: string): Promise<void>;
public deleteIndividualEnrollment(enrollmentOrId: string | IndividualEnrollment, etag: string): Promise<void>;
public deleteIndividualEnrollment(enrollmentOrId: string | IndividualEnrollment): Promise<void>;
public deleteIndividualEnrollment(enrollmentOrId: string | IndividualEnrollment, etagOrCallback?: string | ErrorCallback, deleteCallback?: ErrorCallback): Promise<void> | void {
if (deleteCallback && !(typeof deleteCallback === 'function')) {
Expand Down Expand Up @@ -254,7 +254,7 @@ export class ProvisioningServiceClient {
*/
public deleteDeviceRegistrationState(idOrRegistrationState: string | DeviceRegistrationState, etag: string, deleteCallback: ErrorCallback): void;
public deleteDeviceRegistrationState(idOrRegistrationState: string | DeviceRegistrationState, deleteCallback: ErrorCallback): void;
public deleteDeviceRegistrationState(idOrRegistrationState: string | DeviceRegistrationState, etagOrCallback: string): Promise<void>;
public deleteDeviceRegistrationState(idOrRegistrationState: string | DeviceRegistrationState, etag: string): Promise<void>;
public deleteDeviceRegistrationState(idOrRegistrationState: string | DeviceRegistrationState): Promise<void>;
public deleteDeviceRegistrationState(idOrRegistrationState: string | DeviceRegistrationState, etagOrCallback?: string | ErrorCallback, deleteCallback?: ErrorCallback): Promise<void> | void {
if (deleteCallback && !(typeof deleteCallback === 'function')) {
Expand Down
10 changes: 7 additions & 3 deletions security/tpm/src/tpm_authentication_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const debug = dbg('azure-iot-device:TPMAuthenticationProvider');

import { EventEmitter } from 'events';
import * as machina from 'machina';
import { AuthenticationType, SharedAccessSignature, errors, TransportConfig, AuthenticationProvider } from 'azure-iot-common';
import { AuthenticationType, SharedAccessSignature, errors, TransportConfig, AuthenticationProvider, Callback, callbackToPromise } from 'azure-iot-common';
import { TpmSecurityClient } from './tpm';

/**
Expand Down Expand Up @@ -106,8 +106,12 @@ export class TpmAuthenticationProvider extends EventEmitter implements Authentic
});
}

getDeviceCredentials(callback: (err: Error, credentials?: TransportConfig) => void): void {
this._fsm.handle('getDeviceCredentials', callback);
getDeviceCredentials(): Promise<TransportConfig>;
getDeviceCredentials(callback: Callback<TransportConfig>): void;
getDeviceCredentials(callback?: Callback<TransportConfig>): void | Promise<TransportConfig> {
return callbackToPromise((_callback) => {
this._fsm.handle('getDeviceCredentials', _callback);
}, callback);
}

updateSharedAccessSignature(sharedAccessSignature: string): void {
Expand Down
2 changes: 1 addition & 1 deletion service/src/job_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export class JobClient {
scheduleTwinUpdate(jobId: string | number, queryCondition: string, patch: any, jobStartTime: Date, maxExecutionTimeInSeconds: number, done: TripleValueCallback<any, any>): void;
scheduleTwinUpdate(jobId: string | number, queryCondition: string, patch: any, jobStartTime: Date, done: TripleValueCallback<any, any>): void;
scheduleTwinUpdate(jobId: string | number, queryCondition: string, patch: any, done: TripleValueCallback<any, any>): void;
scheduleTwinUpdate(jobId: string | number, queryCondition: string, patch: any, jobStartTime: Date, maxExecutionTimeInSeconds?: number | TripleValueCallback<any, any>): Promise<JobStatusResponse>;
scheduleTwinUpdate(jobId: string | number, queryCondition: string, patch: any, jobStartTime: Date, maxExecutionTimeInSeconds?: number): Promise<JobStatusResponse>;
scheduleTwinUpdate(jobId: string | number, queryCondition: string, patch: any, jobStartTime: Date): Promise<JobStatusResponse>;
scheduleTwinUpdate(jobId: string | number, queryCondition: string, patch: any): Promise<JobStatusResponse>;
scheduleTwinUpdate(jobId: string | number, queryCondition: string, patch: any, jobStartTime?: Date | TripleValueCallback<any, any>, maxExecutionTimeInSeconds?: number | TripleValueCallback<any, any>, done?: TripleValueCallback<any, any>): Promise<JobStatusResponse> | void {
Expand Down
2 changes: 1 addition & 1 deletion service/src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ export class Registry {
* an error happened, (null otherwise) and the job status that can be used to track progress of the devices export.
* @returns {Promise<Registry.JobStatus> | void} Promise if no callback function was passed, void otherwise.
*/
exportDevicesToBlob(outputBlobContainerUri: string, excludeKeys: boolean, done: Callback<Registry.JobStatus>): void;
exportDevicesToBlob(outputBlobContainerUri: string, excludeKeys: boolean, done: Callback<Registry.JobStatus>): void;
exportDevicesToBlob(outputBlobContainerUri: string, excludeKeys: boolean): Promise<Registry.JobStatus>;
exportDevicesToBlob(outputBlobContainerUri: string, excludeKeys: boolean, done?: Callback<Registry.JobStatus>): Promise<Registry.JobStatus> | void {
return callbackToPromise((_callback) => {
Expand Down

0 comments on commit 978e014

Please sign in to comment.