@azure/core-client
Advanced tools
Comparing version 1.0.0-alpha.20210224.1 to 1.0.0-alpha.20210225.1
@@ -25,11 +25,3 @@ // Copyright (c) Microsoft Corporation. | ||
this._httpsClient = options.httpsClient || getCachedDefaultHttpsClient(); | ||
const credentialScopes = getCredentialScopes(options); | ||
this._pipeline = | ||
options.pipeline || | ||
createDefaultPipeline({ | ||
credentialScopes, | ||
credential: options.credential, | ||
parseXML: options.parseXML, | ||
stringifyXML: options.stringifyXML | ||
}); | ||
this.pipeline = options.pipeline || createDefaultPipeline(options); | ||
} | ||
@@ -41,3 +33,3 @@ /** | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this._pipeline.sendRequest(this._httpsClient, request); | ||
return this.pipeline.sendRequest(this._httpsClient, request); | ||
}); | ||
@@ -122,15 +114,8 @@ } | ||
} | ||
function createDefaultPipeline(options = {}) { | ||
const credentialOptions = options.credential && options.credentialScopes | ||
? { credentialScopes: options.credentialScopes, credential: options.credential } | ||
function createDefaultPipeline(options) { | ||
const credentialScopes = getCredentialScopes(options); | ||
const credentialOptions = options.credential && credentialScopes | ||
? { credentialScopes, credential: options.credential } | ||
: undefined; | ||
return createClientPipeline({ | ||
credentialOptions, | ||
deserializationOptions: { | ||
parseXML: options.parseXML | ||
}, | ||
serializationOptions: { | ||
stringifyXML: options.stringifyXML | ||
} | ||
}); | ||
return createClientPipeline(Object.assign(Object.assign({}, options), { credentialOptions })); | ||
} | ||
@@ -137,0 +122,0 @@ function getCredentialScopes(options) { |
{ | ||
"name": "@azure/core-client", | ||
"version": "1.0.0-alpha.20210224.1", | ||
"version": "1.0.0-alpha.20210225.1", | ||
"description": "Core library for interfacing with AutoRest generated code", | ||
@@ -5,0 +5,0 @@ "sdk-type": "client", |
@@ -7,2 +7,3 @@ import { AbortSignalLike } from '@azure/abort-controller'; | ||
import { Pipeline } from '@azure/core-https'; | ||
import { PipelineOptions } from '@azure/core-https'; | ||
import { PipelinePolicy } from '@azure/core-https'; | ||
@@ -73,22 +74,9 @@ import { PipelineRequest } from '@azure/core-https'; | ||
/** | ||
* Options for creating a Pipeline to use with ServiceClient. | ||
* Mostly for customizing the auth policy (if using token auth) or | ||
* the deserialization options when using XML. | ||
* The common set of options that high level clients are expected to expose. | ||
*/ | ||
export declare interface ClientPipelineOptions extends InternalPipelineOptions { | ||
export declare interface CommonClientOptions extends PipelineOptions { | ||
/** | ||
* Options to customize bearerTokenAuthenticationPolicy. | ||
* The HttpClient that will be used to send HTTP requests. | ||
*/ | ||
credentialOptions?: { | ||
credentialScopes: string | string[]; | ||
credential: TokenCredential; | ||
}; | ||
/** | ||
* Options to customize deserializationPolicy. | ||
*/ | ||
deserializationOptions?: DeserializationPolicyOptions; | ||
/** | ||
* Options to customize serializationPolicy. | ||
*/ | ||
serializationOptions?: SerializationPolicyOptions; | ||
httpsClient?: HttpsClient; | ||
} | ||
@@ -114,3 +102,3 @@ export declare interface CompositeMapper extends BaseMapper { | ||
*/ | ||
export declare function createClientPipeline(options?: ClientPipelineOptions): Pipeline; | ||
export declare function createClientPipeline(options?: InternalClientPipelineOptions): Pipeline; | ||
/** | ||
@@ -211,2 +199,24 @@ * Method that creates and returns a Serializer. | ||
} | ||
/** | ||
* Options for creating a Pipeline to use with ServiceClient. | ||
* Mostly for customizing the auth policy (if using token auth) or | ||
* the deserialization options when using XML. | ||
*/ | ||
export declare interface InternalClientPipelineOptions extends InternalPipelineOptions { | ||
/** | ||
* Options to customize bearerTokenAuthenticationPolicy. | ||
*/ | ||
credentialOptions?: { | ||
credentialScopes: string | string[]; | ||
credential: TokenCredential; | ||
}; | ||
/** | ||
* Options to customize deserializationPolicy. | ||
*/ | ||
deserializationOptions?: DeserializationPolicyOptions; | ||
/** | ||
* Options to customize serializationPolicy. | ||
*/ | ||
serializationOptions?: SerializationPolicyOptions; | ||
} | ||
export declare type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper; | ||
@@ -557,4 +567,7 @@ export declare interface MapperConstraints { | ||
private readonly _httpsClient; | ||
private readonly _pipeline; | ||
/** | ||
* The pipeline used by this client to make requests | ||
*/ | ||
readonly pipeline: Pipeline; | ||
/** | ||
* The ServiceClient constructor | ||
@@ -580,3 +593,3 @@ * @param credential - The credentials used for authentication with the service. | ||
*/ | ||
export declare interface ServiceClientOptions { | ||
export declare interface ServiceClientOptions extends CommonClientOptions { | ||
/** | ||
@@ -604,14 +617,2 @@ * If specified, this is the base URI that requests will be made against for this ServiceClient. | ||
pipeline?: Pipeline; | ||
/** | ||
* The HttpClient that will be used to send HTTP requests. | ||
*/ | ||
httpsClient?: HttpsClient; | ||
/** | ||
* A method that is able to turn an XML object model into a string. | ||
*/ | ||
stringifyXML?: (obj: any, opts?: XmlOptions) => string; | ||
/** | ||
* A method that is able to parse XML. | ||
*/ | ||
parseXML?: (str: string, opts?: XmlOptions) => Promise<any>; | ||
} | ||
@@ -618,0 +619,0 @@ export declare interface SimpleMapperType { |
@@ -7,2 +7,3 @@ import { AbortSignalLike } from '@azure/abort-controller'; | ||
import { Pipeline } from '@azure/core-https'; | ||
import { PipelineOptions } from '@azure/core-https'; | ||
import { PipelinePolicy } from '@azure/core-https'; | ||
@@ -75,22 +76,9 @@ import { PipelineRequest } from '@azure/core-https'; | ||
/** | ||
* Options for creating a Pipeline to use with ServiceClient. | ||
* Mostly for customizing the auth policy (if using token auth) or | ||
* the deserialization options when using XML. | ||
* The common set of options that high level clients are expected to expose. | ||
*/ | ||
export declare interface ClientPipelineOptions extends InternalPipelineOptions { | ||
export declare interface CommonClientOptions extends PipelineOptions { | ||
/** | ||
* Options to customize bearerTokenAuthenticationPolicy. | ||
* The HttpClient that will be used to send HTTP requests. | ||
*/ | ||
credentialOptions?: { | ||
credentialScopes: string | string[]; | ||
credential: TokenCredential; | ||
}; | ||
/** | ||
* Options to customize deserializationPolicy. | ||
*/ | ||
deserializationOptions?: DeserializationPolicyOptions; | ||
/** | ||
* Options to customize serializationPolicy. | ||
*/ | ||
serializationOptions?: SerializationPolicyOptions; | ||
httpsClient?: HttpsClient; | ||
} | ||
@@ -119,3 +107,3 @@ | ||
*/ | ||
export declare function createClientPipeline(options?: ClientPipelineOptions): Pipeline; | ||
export declare function createClientPipeline(options?: InternalClientPipelineOptions): Pipeline; | ||
@@ -228,2 +216,25 @@ /** | ||
/** | ||
* Options for creating a Pipeline to use with ServiceClient. | ||
* Mostly for customizing the auth policy (if using token auth) or | ||
* the deserialization options when using XML. | ||
*/ | ||
export declare interface InternalClientPipelineOptions extends InternalPipelineOptions { | ||
/** | ||
* Options to customize bearerTokenAuthenticationPolicy. | ||
*/ | ||
credentialOptions?: { | ||
credentialScopes: string | string[]; | ||
credential: TokenCredential; | ||
}; | ||
/** | ||
* Options to customize deserializationPolicy. | ||
*/ | ||
deserializationOptions?: DeserializationPolicyOptions; | ||
/** | ||
* Options to customize serializationPolicy. | ||
*/ | ||
serializationOptions?: SerializationPolicyOptions; | ||
} | ||
export declare type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper; | ||
@@ -599,4 +610,7 @@ | ||
private readonly _httpsClient; | ||
private readonly _pipeline; | ||
/** | ||
* The pipeline used by this client to make requests | ||
*/ | ||
readonly pipeline: Pipeline; | ||
/** | ||
* The ServiceClient constructor | ||
@@ -623,3 +637,3 @@ * @param credential - The credentials used for authentication with the service. | ||
*/ | ||
export declare interface ServiceClientOptions { | ||
export declare interface ServiceClientOptions extends CommonClientOptions { | ||
/** | ||
@@ -647,14 +661,2 @@ * If specified, this is the base URI that requests will be made against for this ServiceClient. | ||
pipeline?: Pipeline; | ||
/** | ||
* The HttpClient that will be used to send HTTP requests. | ||
*/ | ||
httpsClient?: HttpsClient; | ||
/** | ||
* A method that is able to turn an XML object model into a string. | ||
*/ | ||
stringifyXML?: (obj: any, opts?: XmlOptions) => string; | ||
/** | ||
* A method that is able to parse XML. | ||
*/ | ||
parseXML?: (str: string, opts?: XmlOptions) => Promise<any>; | ||
} | ||
@@ -661,0 +663,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
550684
5010