@azure/core-client
Advanced tools
Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
# Release History | ||
## 1.0.0-beta.2 (2021-03-10) | ||
- [Breaking] Removed `createSpanFunction` and `SpanConfig`. These have been moved into | ||
`@azure/core-tracing`. | ||
## 1.0.0-beta.1 (2021-02-04) | ||
@@ -8,3 +13,3 @@ | ||
- Replace URLBuilder with runtime-supported URL primitive. | ||
- Rewrite `ServiceClient` on top of `core-https` and remove unused codepaths. | ||
- Rewrite `ServiceClient` on top of `core-rest-pipeline` and remove unused codepaths. | ||
- Remove `_response` on operation results and replace with `onResponse` callback. |
@@ -5,3 +5,3 @@ // Copyright (c) Microsoft Corporation. | ||
* Encodes a string in base64 format. | ||
* @param value the string to encode | ||
* @param value - the string to encode | ||
*/ | ||
@@ -13,3 +13,3 @@ export function encodeString(value) { | ||
* Encodes a byte array in base64 format. | ||
* @param value the Uint8Aray to encode | ||
* @param value - the Uint8Aray to encode | ||
*/ | ||
@@ -25,3 +25,3 @@ export function encodeByteArray(value) { | ||
* Decodes a base64 string into a byte array. | ||
* @param value the base64 string to decode | ||
* @param value - the base64 string to decode | ||
*/ | ||
@@ -28,0 +28,0 @@ export function decodeString(value) { |
@@ -5,4 +5,4 @@ // Copyright (c) Microsoft Corporation. | ||
* Encodes a string in base64 format. | ||
* @param value the string to encode | ||
* @internal @hidden | ||
* @param value - the string to encode | ||
* @internal | ||
*/ | ||
@@ -14,4 +14,4 @@ export function encodeString(value) { | ||
* Encodes a byte array in base64 format. | ||
* @param value the Uint8Aray to encode | ||
* @internal @hidden | ||
* @param value - the Uint8Aray to encode | ||
* @internal | ||
*/ | ||
@@ -26,4 +26,4 @@ export function encodeByteArray(value) { | ||
* Decodes a base64 string into a byte array. | ||
* @param value the base64 string to decode | ||
* @internal @hidden | ||
* @param value - the base64 string to decode | ||
* @internal | ||
*/ | ||
@@ -30,0 +30,0 @@ export function decodeString(value) { |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __awaiter } from "tslib"; | ||
import { RestError } from "@azure/core-https"; | ||
import { RestError } from "@azure/core-rest-pipeline"; | ||
import { XML_CHARKEY } from "./interfaces"; | ||
@@ -104,4 +104,4 @@ import { MapperTypeNames } from "./serializer"; | ||
} | ||
catch (error) { | ||
const restError = new RestError(`Error ${error} occurred in deserializing the responseBody - ${parsedResponse.bodyAsText}`, { | ||
catch (deserializeError) { | ||
const restError = new RestError(`Error ${deserializeError} occurred in deserializing the responseBody - ${parsedResponse.bodyAsText}`, { | ||
statusCode: parsedResponse.status, | ||
@@ -108,0 +108,0 @@ request: parsedResponse.request, |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { DefaultHttpsClient } from "@azure/core-https"; | ||
let cachedHttpsClient; | ||
export function getCachedDefaultHttpsClient() { | ||
if (!cachedHttpsClient) { | ||
cachedHttpsClient = new DefaultHttpsClient(); | ||
import { createDefaultHttpClient } from "@azure/core-rest-pipeline"; | ||
let cachedHttpClient; | ||
export function getCachedDefaultHttpClient() { | ||
if (!cachedHttpClient) { | ||
cachedHttpClient = createDefaultHttpClient(); | ||
} | ||
return cachedHttpsClient; | ||
return cachedHttpClient; | ||
} | ||
//# sourceMappingURL=httpClientCache.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
export { createSerializer, MapperTypeNames } from "./serializer"; | ||
export { createSpanFunction } from "./createSpan"; | ||
export { ServiceClient, createClientPipeline } from "./serviceClient"; | ||
export { ServiceClient } from "./serviceClient"; | ||
export { createClientPipeline } from "./pipeline"; | ||
export { XML_ATTRKEY, XML_CHARKEY } from "./interfaces"; | ||
export { deserializationPolicy, deserializationPolicyName } from "./deserializationPolicy"; | ||
export { serializationPolicy, serializationPolicyName } from "./serializationPolicy"; | ||
import "@azure/core-asynciterator-polyfill"; | ||
//# sourceMappingURL=index.js.map |
@@ -6,3 +6,3 @@ // Copyright (c) Microsoft Corporation. | ||
* Gets the list of status codes for streaming responses. | ||
* @internal @hidden | ||
* @internal | ||
*/ | ||
@@ -22,5 +22,5 @@ export function getStreamingResponseStatusCodes(operationSpec) { | ||
* Get the path to this parameter's value as a dotted string (a.b.c). | ||
* @param parameter The parameter to get the path string for. | ||
* @param parameter - The parameter to get the path string for. | ||
* @returns The path to this parameter's value as a dotted string. | ||
* @internal @hidden | ||
* @internal | ||
*/ | ||
@@ -27,0 +27,0 @@ export function getPathStringFromParameter(parameter) { |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
/** | ||
* @internal @hidden | ||
* @internal | ||
* Retrieves the value to use for a given operation argument | ||
* @param operationArguments The arguments passed from the generated client | ||
* @param parameter The parameter description | ||
* @param fallbackObject If something isn't found in the arguments bag, look here. | ||
* @param operationArguments - The arguments passed from the generated client | ||
* @param parameter - The parameter description | ||
* @param fallbackObject - If something isn't found in the arguments bag, look here. | ||
* Generally used to look at the service client properties. | ||
@@ -10,0 +10,0 @@ */ |
@@ -55,3 +55,3 @@ // Copyright (c) Microsoft Corporation. | ||
/** | ||
* @internal @hidden | ||
* @internal | ||
*/ | ||
@@ -74,6 +74,8 @@ export function serializeRequestBody(request, operationArguments, operationSpec, stringifyXML = function () { | ||
const bodyMapper = operationSpec.requestBody.mapper; | ||
const { required, serializedName, xmlName, xmlElementName, xmlNamespace, xmlNamespacePrefix } = bodyMapper; | ||
const { required, serializedName, xmlName, xmlElementName, xmlNamespace, xmlNamespacePrefix, nullable } = bodyMapper; | ||
const typeName = bodyMapper.type.name; | ||
try { | ||
if (request.body || required) { | ||
if ((request.body !== undefined && request.body !== null) || | ||
(nullable && request.body === null) || | ||
required) { | ||
const requestBodyParameterPathString = getPathStringFromParameter(operationSpec.requestBody); | ||
@@ -80,0 +82,0 @@ request.body = operationSpec.serializer.serialize(bodyMapper, request.body, requestBodyParameterPathString, updatedOptions); |
@@ -59,11 +59,11 @@ // Copyright (c) Microsoft Corporation. | ||
* | ||
* @param {Mapper} mapper The mapper which defines the metadata of the serializable object | ||
* @param mapper - The mapper which defines the metadata of the serializable object | ||
* | ||
* @param {object|string|Array|number|boolean|Date|stream} object A valid Javascript object to be serialized | ||
* @param object - A valid Javascript object to be serialized | ||
* | ||
* @param {string} objectName Name of the serialized object | ||
* @param objectName - Name of the serialized object | ||
* | ||
* @param {options} options additional options to serialization | ||
* @param options - additional options to serialization | ||
* | ||
* @returns {object|string|Array|number|boolean|Date|stream} A valid serialized Javascript object | ||
* @returns A valid serialized Javascript object | ||
*/ | ||
@@ -149,11 +149,11 @@ serialize(mapper, object, objectName, options = { xml: {} }) { | ||
* | ||
* @param {object} mapper The mapper which defines the metadata of the serializable object | ||
* @param mapper - The mapper which defines the metadata of the serializable object | ||
* | ||
* @param {object|string|Array|number|boolean|Date|stream} responseBody A valid Javascript entity to be deserialized | ||
* @param responseBody - A valid Javascript entity to be deserialized | ||
* | ||
* @param {string} objectName Name of the deserialized object | ||
* @param objectName - Name of the deserialized object | ||
* | ||
* @param options Controls behavior of XML parser and builder. | ||
* @param options - Controls behavior of XML parser and builder. | ||
* | ||
* @returns {object|string|Array|number|boolean|Date|stream} A valid deserialized Javascript object | ||
* @returns A valid deserialized Javascript object | ||
*/ | ||
@@ -249,4 +249,4 @@ deserialize(mapper, responseBody, objectName, options = { xml: {} }) { | ||
* Method that creates and returns a Serializer. | ||
* @param modelMappers Known models to map | ||
* @param isXML If XML should be supported | ||
* @param modelMappers - Known models to map | ||
* @param isXML - If XML should be supported | ||
*/ | ||
@@ -348,7 +348,7 @@ export function createSerializer(modelMappers = {}, isXML = false) { | ||
if (objectType !== "string" && | ||
objectType !== "function" && | ||
typeof value.pipe !== "function" && | ||
!(value instanceof ArrayBuffer) && | ||
!ArrayBuffer.isView(value) && | ||
!(((_a = value === null || value === void 0 ? void 0 : value.constructor) === null || _a === void 0 ? void 0 : _a.name) === "Blob")) { | ||
throw new Error(`${objectName} must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream.`); | ||
throw new Error(`${objectName} must be a string, Blob, ArrayBuffer, ArrayBufferView, or NodeJS.ReadableStream.`); | ||
} | ||
@@ -492,5 +492,5 @@ } | ||
* Resolves the additionalProperties property from a referenced mapper | ||
* @param serializer the serializer containing the entire set of mappers | ||
* @param mapper the composite mapper to resolve | ||
* @param objectName name of the object being serialized | ||
* @param serializer - the serializer containing the entire set of mappers | ||
* @param mapper - the composite mapper to resolve | ||
* @param objectName - name of the object being serialized | ||
*/ | ||
@@ -507,5 +507,5 @@ function resolveAdditionalProperties(serializer, mapper, objectName) { | ||
* Finds the mapper referenced by className | ||
* @param serializer the serializer containing the entire set of mappers | ||
* @param mapper the composite mapper to resolve | ||
* @param objectName name of the object being serialized | ||
* @param serializer - the serializer containing the entire set of mappers | ||
* @param mapper - the composite mapper to resolve | ||
* @param objectName - name of the object being serialized | ||
*/ | ||
@@ -521,4 +521,4 @@ function resolveReferencedMapper(serializer, mapper, objectName) { | ||
* Resolves a composite mapper's modelProperties. | ||
* @param serializer the serializer containing the entire set of mappers | ||
* @param mapper the composite mapper to resolve | ||
* @param serializer - the serializer containing the entire set of mappers | ||
* @param mapper - the composite mapper to resolve | ||
*/ | ||
@@ -525,0 +525,0 @@ function resolveModelProperties(serializer, mapper, objectName) { |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __awaiter } from "tslib"; | ||
import { createPipelineRequest, createPipelineFromOptions, bearerTokenAuthenticationPolicy } from "@azure/core-https"; | ||
import { createPipelineRequest } from "@azure/core-rest-pipeline"; | ||
import { getStreamingResponseStatusCodes } from "./interfaceHelpers"; | ||
import { getRequestUrl } from "./urlHelpers"; | ||
import { isPrimitiveType } from "./utils"; | ||
import { deserializationPolicy } from "./deserializationPolicy"; | ||
import { flattenResponse } from "./utils"; | ||
import { URL } from "./url"; | ||
import { serializationPolicy } from "./serializationPolicy"; | ||
import { getCachedDefaultHttpsClient } from "./httpClientCache"; | ||
import { getCachedDefaultHttpClient } from "./httpClientCache"; | ||
import { getOperationRequestInfo } from "./operationHelpers"; | ||
import { createClientPipeline } from "./pipeline"; | ||
/** | ||
@@ -19,5 +18,4 @@ * Initializes a new instance of the ServiceClient. | ||
* The ServiceClient constructor | ||
* @constructor | ||
* @param credential The credentials used for authentication with the service. | ||
* @param options The service client options that govern the behavior of the client. | ||
* @param credential - The credentials used for authentication with the service. | ||
* @param options - The service client options that govern the behavior of the client. | ||
*/ | ||
@@ -27,12 +25,4 @@ constructor(options = {}) { | ||
this._baseUri = options.baseUri; | ||
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._httpClient = options.httpClient || getCachedDefaultHttpClient(); | ||
this.pipeline = options.pipeline || createDefaultPipeline(options); | ||
} | ||
@@ -44,3 +34,3 @@ /** | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this._pipeline.sendRequest(this._httpsClient, request); | ||
return this.pipeline.sendRequest(this._httpClient, request); | ||
}); | ||
@@ -50,8 +40,7 @@ } | ||
* Send an HTTP request that is populated using the provided OperationSpec. | ||
* @typeParam T The typed result of the request, based on the OperationSpec. | ||
* @param {OperationArguments} operationArguments The arguments that the HTTP request's templated values will be populated from. | ||
* @param {OperationSpec} operationSpec The OperationSpec to use to populate the httpRequest. | ||
* @typeParam T - The typed result of the request, based on the OperationSpec. | ||
* @param operationArguments - The arguments that the HTTP request's templated values will be populated from. | ||
* @param operationSpec - The OperationSpec to use to populate the httpRequest. | ||
*/ | ||
sendOperationRequest(operationArguments, operationSpec) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -102,4 +91,4 @@ const baseUri = operationSpec.baseUrl || this._baseUri; | ||
} | ||
if ((_a = options.tracingOptions) === null || _a === void 0 ? void 0 : _a.spanOptions) { | ||
request.spanOptions = options.tracingOptions.spanOptions; | ||
if (options.tracingOptions) { | ||
request.tracingOptions = options.tracingOptions; | ||
} | ||
@@ -127,72 +116,9 @@ } | ||
} | ||
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 })); | ||
} | ||
/** | ||
* Creates a new Pipeline for use with a Service Client. | ||
* Adds in deserializationPolicy by default. | ||
* Also adds in bearerTokenAuthenticationPolicy if passed a TokenCredential. | ||
* @param options Options to customize the created pipeline. | ||
*/ | ||
export function createClientPipeline(options = {}) { | ||
const pipeline = createPipelineFromOptions(options !== null && options !== void 0 ? options : {}); | ||
if (options.credentialOptions) { | ||
pipeline.addPolicy(bearerTokenAuthenticationPolicy({ | ||
credential: options.credentialOptions.credential, | ||
scopes: options.credentialOptions.credentialScopes | ||
})); | ||
} | ||
pipeline.addPolicy(serializationPolicy(options.serializationOptions), { phase: "Serialize" }); | ||
pipeline.addPolicy(deserializationPolicy(options.deserializationOptions), { | ||
phase: "Deserialize" | ||
}); | ||
return pipeline; | ||
} | ||
function flattenResponse(fullResponse, responseSpec) { | ||
var _a, _b; | ||
const parsedHeaders = fullResponse.parsedHeaders; | ||
const bodyMapper = responseSpec && responseSpec.bodyMapper; | ||
if (bodyMapper) { | ||
const typeName = bodyMapper.type.name; | ||
if (typeName === "Stream") { | ||
return Object.assign(Object.assign({}, parsedHeaders), { blobBody: fullResponse.blobBody, readableStreamBody: fullResponse.readableStreamBody }); | ||
} | ||
const modelProperties = (typeName === "Composite" && bodyMapper.type.modelProperties) || {}; | ||
const isPageableResponse = Object.keys(modelProperties).some((k) => modelProperties[k].serializedName === ""); | ||
if (typeName === "Sequence" || isPageableResponse) { | ||
const arrayResponse = (_a = fullResponse.parsedBody) !== null && _a !== void 0 ? _a : []; | ||
for (const key of Object.keys(modelProperties)) { | ||
if (modelProperties[key].serializedName) { | ||
arrayResponse[key] = (_b = fullResponse.parsedBody) === null || _b === void 0 ? void 0 : _b[key]; | ||
} | ||
} | ||
if (parsedHeaders) { | ||
for (const key of Object.keys(parsedHeaders)) { | ||
arrayResponse[key] = parsedHeaders[key]; | ||
} | ||
} | ||
return arrayResponse; | ||
} | ||
if (typeName === "Composite" || typeName === "Dictionary") { | ||
return Object.assign(Object.assign({}, parsedHeaders), fullResponse.parsedBody); | ||
} | ||
} | ||
if (bodyMapper || | ||
fullResponse.request.method === "HEAD" || | ||
isPrimitiveType(fullResponse.parsedBody)) { | ||
return Object.assign(Object.assign({}, parsedHeaders), { body: fullResponse.parsedBody }); | ||
} | ||
return Object.assign(Object.assign({}, parsedHeaders), fullResponse.parsedBody); | ||
} | ||
function getCredentialScopes(options) { | ||
@@ -199,0 +125,0 @@ if (options.credentialScopes) { |
@@ -6,4 +6,4 @@ // Copyright (c) Microsoft Corporation. | ||
* (string, number, boolean, null, undefined). | ||
* @param value Value to test | ||
* @hidden @internal | ||
* @param value - Value to test | ||
* @internal | ||
*/ | ||
@@ -16,4 +16,4 @@ export function isPrimitiveType(value) { | ||
* Returns true if the given string is in ISO 8601 format. | ||
* @param value The value to be validated for ISO 8601 duration format. | ||
* @hidden @internal | ||
* @param value - The value to be validated for ISO 8601 duration format. | ||
* @internal | ||
*/ | ||
@@ -27,5 +27,5 @@ export function isDuration(value) { | ||
* | ||
* @param uuid The uuid that needs to be validated. | ||
* @param uuid - The uuid that needs to be validated. | ||
* | ||
* @hidden @internal | ||
* @internal | ||
*/ | ||
@@ -35,2 +35,46 @@ export function isValidUuid(uuid) { | ||
} | ||
/** | ||
* Take a `FullOperationResponse` and turn it into a flat | ||
* response object to hand back to the consumer. | ||
* @param fullResponse - The processed response from the operation request | ||
* @param responseSpec - The response map from the OperationSpec | ||
* | ||
* @internal | ||
*/ | ||
export function flattenResponse(fullResponse, responseSpec) { | ||
var _a, _b; | ||
const parsedHeaders = fullResponse.parsedHeaders; | ||
const bodyMapper = responseSpec && responseSpec.bodyMapper; | ||
if (bodyMapper) { | ||
const typeName = bodyMapper.type.name; | ||
if (typeName === "Stream") { | ||
return Object.assign(Object.assign({}, parsedHeaders), { blobBody: fullResponse.blobBody, readableStreamBody: fullResponse.readableStreamBody }); | ||
} | ||
const modelProperties = (typeName === "Composite" && bodyMapper.type.modelProperties) || {}; | ||
const isPageableResponse = Object.keys(modelProperties).some((k) => modelProperties[k].serializedName === ""); | ||
if (typeName === "Sequence" || isPageableResponse) { | ||
const arrayResponse = (_a = fullResponse.parsedBody) !== null && _a !== void 0 ? _a : []; | ||
for (const key of Object.keys(modelProperties)) { | ||
if (modelProperties[key].serializedName) { | ||
arrayResponse[key] = (_b = fullResponse.parsedBody) === null || _b === void 0 ? void 0 : _b[key]; | ||
} | ||
} | ||
if (parsedHeaders) { | ||
for (const key of Object.keys(parsedHeaders)) { | ||
arrayResponse[key] = parsedHeaders[key]; | ||
} | ||
} | ||
return arrayResponse; | ||
} | ||
if (typeName === "Composite" || typeName === "Dictionary") { | ||
return Object.assign(Object.assign({}, parsedHeaders), fullResponse.parsedBody); | ||
} | ||
} | ||
if (bodyMapper || | ||
fullResponse.request.method === "HEAD" || | ||
isPrimitiveType(fullResponse.parsedBody)) { | ||
return Object.assign(Object.assign({}, parsedHeaders), { body: fullResponse.parsedBody }); | ||
} | ||
return Object.assign(Object.assign({}, parsedHeaders), fullResponse.parsedBody); | ||
} | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@azure/core-client", | ||
"version": "1.0.0-beta.1", | ||
"version": "1.0.0-beta.2", | ||
"description": "Core library for interfacing with AutoRest generated code", | ||
@@ -43,3 +43,3 @@ "sdk-type": "client", | ||
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", | ||
"lint": "eslint package.json api-extractor.json src test --ext .ts -f html -o coreClient-lintReport.html || exit 0", | ||
"lint": "eslint package.json api-extractor.json src test --ext .ts", | ||
"pack": "npm pack 2>&1", | ||
@@ -81,5 +81,6 @@ "prebuild": "npm run clean", | ||
"@azure/abort-controller": "^1.0.0", | ||
"@azure/core-auth": "^1.1.3", | ||
"@azure/core-https": "1.0.0-beta.1", | ||
"@azure/core-tracing": "1.0.0-preview.9", | ||
"@azure/core-asynciterator-polyfill": "^1.0.0", | ||
"@azure/core-auth": "^1.2.0", | ||
"@azure/core-rest-pipeline": "1.0.0-beta.2", | ||
"@azure/core-tracing": "1.0.0-preview.10", | ||
"@opentelemetry/api": "^0.10.2", | ||
@@ -86,0 +87,0 @@ "tslib": "^2.0.0" |
@@ -21,3 +21,3 @@ # Azure Core Service client library for JavaScript (Experimental) | ||
`sendRequest` simply makes an HTTP request using a `Pipeline` (see `@azure/core-https` for details.) | ||
`sendRequest` simply makes an HTTP request using a `Pipeline` (see `@azure/core-rest-pipeline` for details.) | ||
@@ -24,0 +24,0 @@ `sendOperationRequest` is used by generated code to make a request using an `OperationSpec` and `OperationArguments`. An `OperationSpec` is a translation of request requirements from the OpenAPI/Swagger file that describes the service. |
import { AbortSignalLike } from '@azure/abort-controller'; | ||
import { HttpMethods } from '@azure/core-https'; | ||
import { HttpsClient } from '@azure/core-https'; | ||
import { InternalPipelineOptions } from '@azure/core-https'; | ||
import { HttpClient } from '@azure/core-rest-pipeline'; | ||
import { HttpMethods } from '@azure/core-rest-pipeline'; | ||
import { InternalPipelineOptions } from '@azure/core-rest-pipeline'; | ||
import { OperationTracingOptions } from '@azure/core-tracing'; | ||
import { Pipeline } from '@azure/core-https'; | ||
import { PipelinePolicy } from '@azure/core-https'; | ||
import { PipelineRequest } from '@azure/core-https'; | ||
import { PipelineResponse } from '@azure/core-https'; | ||
import { Span } from '@opentelemetry/api'; | ||
import { Pipeline } from '@azure/core-rest-pipeline'; | ||
import { PipelineOptions } from '@azure/core-rest-pipeline'; | ||
import { PipelinePolicy } from '@azure/core-rest-pipeline'; | ||
import { PipelineRequest } from '@azure/core-rest-pipeline'; | ||
import { PipelineResponse } from '@azure/core-rest-pipeline'; | ||
import { TokenCredential } from '@azure/core-auth'; | ||
import { TransferProgressEvent } from '@azure/core-https'; | ||
import { TransferProgressEvent } from '@azure/core-rest-pipeline'; | ||
export declare interface BaseMapper { | ||
@@ -72,22 +72,9 @@ /** | ||
/** | ||
* 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; | ||
httpClient?: HttpClient; | ||
} | ||
@@ -111,9 +98,9 @@ export declare interface CompositeMapper extends BaseMapper { | ||
* Also adds in bearerTokenAuthenticationPolicy if passed a TokenCredential. | ||
* @param options Options to customize the created pipeline. | ||
* @param options - Options to customize the created pipeline. | ||
*/ | ||
export declare function createClientPipeline(options?: ClientPipelineOptions): Pipeline; | ||
export declare function createClientPipeline(options?: InternalClientPipelineOptions): Pipeline; | ||
/** | ||
* Method that creates and returns a Serializer. | ||
* @param modelMappers Known models to map | ||
* @param isXML If XML should be supported | ||
* @param modelMappers - Known models to map | ||
* @param isXML - If XML should be supported | ||
*/ | ||
@@ -124,12 +111,2 @@ export declare function createSerializer(modelMappers?: { | ||
/** | ||
* Creates a function called createSpan to create spans using the global tracer. | ||
* @hidden | ||
* @param spanConfig The name of the operation being performed. | ||
* @param tracingOptions The options for the underlying http request. | ||
*/ | ||
export declare function createSpanFunction({ packagePrefix, namespace }: SpanConfig): <T extends OperationOptions>(operationName: string, operationOptions: T) => { | ||
span: Span; | ||
updatedOptions: T; | ||
}; | ||
/** | ||
* The content-types that will indicate that an operation response should be deserialized in a | ||
@@ -211,2 +188,24 @@ * particular way. | ||
} | ||
/** | ||
* 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; | ||
@@ -349,3 +348,3 @@ export declare interface MapperConstraints { | ||
/** | ||
* @property {object} [customHeaders] User defined custom request headers that | ||
* User defined custom request headers that | ||
* will be applied before the request is sent. | ||
@@ -499,3 +498,3 @@ */ | ||
*/ | ||
export declare function serializationPolicy(options?: serializationPolicyOptions): PipelinePolicy; | ||
export declare function serializationPolicy(options?: SerializationPolicyOptions): PipelinePolicy; | ||
/** | ||
@@ -508,3 +507,3 @@ * The programmatic identifier of the serializationPolicy. | ||
*/ | ||
export declare interface serializationPolicyOptions { | ||
export declare interface SerializationPolicyOptions { | ||
/** | ||
@@ -559,9 +558,11 @@ * A function that is able to write XML. Required for XML support. | ||
*/ | ||
private readonly _httpsClient; | ||
private readonly _pipeline; | ||
private readonly _httpClient; | ||
/** | ||
* The pipeline used by this client to make requests | ||
*/ | ||
readonly pipeline: Pipeline; | ||
/** | ||
* The ServiceClient constructor | ||
* @constructor | ||
* @param credential The credentials used for authentication with the service. | ||
* @param options The service client options that govern the behavior of the client. | ||
* @param credential - The credentials used for authentication with the service. | ||
* @param options - The service client options that govern the behavior of the client. | ||
*/ | ||
@@ -575,5 +576,5 @@ constructor(options?: ServiceClientOptions); | ||
* Send an HTTP request that is populated using the provided OperationSpec. | ||
* @typeParam T The typed result of the request, based on the OperationSpec. | ||
* @param {OperationArguments} operationArguments The arguments that the HTTP request's templated values will be populated from. | ||
* @param {OperationSpec} operationSpec The OperationSpec to use to populate the httpRequest. | ||
* @typeParam T - The typed result of the request, based on the OperationSpec. | ||
* @param operationArguments - The arguments that the HTTP request's templated values will be populated from. | ||
* @param operationSpec - The OperationSpec to use to populate the httpRequest. | ||
*/ | ||
@@ -585,3 +586,3 @@ sendOperationRequest<T>(operationArguments: OperationArguments, operationSpec: OperationSpec): Promise<T>; | ||
*/ | ||
export declare interface ServiceClientOptions { | ||
export declare interface ServiceClientOptions extends CommonClientOptions { | ||
/** | ||
@@ -609,14 +610,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>; | ||
} | ||
@@ -623,0 +612,0 @@ export declare interface SimpleMapperType { |
import { AbortSignalLike } from '@azure/abort-controller'; | ||
import { HttpMethods } from '@azure/core-https'; | ||
import { HttpsClient } from '@azure/core-https'; | ||
import { InternalPipelineOptions } from '@azure/core-https'; | ||
import { HttpClient } from '@azure/core-rest-pipeline'; | ||
import { HttpMethods } from '@azure/core-rest-pipeline'; | ||
import { InternalPipelineOptions } from '@azure/core-rest-pipeline'; | ||
import { OperationTracingOptions } from '@azure/core-tracing'; | ||
import { Pipeline } from '@azure/core-https'; | ||
import { PipelinePolicy } from '@azure/core-https'; | ||
import { PipelineRequest } from '@azure/core-https'; | ||
import { PipelineResponse } from '@azure/core-https'; | ||
import { Span } from '@opentelemetry/api'; | ||
import { Pipeline } from '@azure/core-rest-pipeline'; | ||
import { PipelineOptions } from '@azure/core-rest-pipeline'; | ||
import { PipelinePolicy } from '@azure/core-rest-pipeline'; | ||
import { PipelineRequest } from '@azure/core-rest-pipeline'; | ||
import { PipelineResponse } from '@azure/core-rest-pipeline'; | ||
import { TokenCredential } from '@azure/core-auth'; | ||
import { TransferProgressEvent } from '@azure/core-https'; | ||
import { TransferProgressEvent } from '@azure/core-rest-pipeline'; | ||
@@ -74,22 +74,9 @@ export declare interface BaseMapper { | ||
/** | ||
* 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; | ||
httpClient?: HttpClient; | ||
} | ||
@@ -116,10 +103,10 @@ | ||
* Also adds in bearerTokenAuthenticationPolicy if passed a TokenCredential. | ||
* @param options Options to customize the created pipeline. | ||
* @param options - Options to customize the created pipeline. | ||
*/ | ||
export declare function createClientPipeline(options?: ClientPipelineOptions): Pipeline; | ||
export declare function createClientPipeline(options?: InternalClientPipelineOptions): Pipeline; | ||
/** | ||
* Method that creates and returns a Serializer. | ||
* @param modelMappers Known models to map | ||
* @param isXML If XML should be supported | ||
* @param modelMappers - Known models to map | ||
* @param isXML - If XML should be supported | ||
*/ | ||
@@ -131,13 +118,2 @@ export declare function createSerializer(modelMappers?: { | ||
/** | ||
* Creates a function called createSpan to create spans using the global tracer. | ||
* @hidden | ||
* @param spanConfig The name of the operation being performed. | ||
* @param tracingOptions The options for the underlying http request. | ||
*/ | ||
export declare function createSpanFunction({ packagePrefix, namespace }: SpanConfig): <T extends OperationOptions>(operationName: string, operationOptions: T) => { | ||
span: Span; | ||
updatedOptions: T; | ||
}; | ||
/** | ||
* The content-types that will indicate that an operation response should be deserialized in a | ||
@@ -228,2 +204,25 @@ * particular way. | ||
/** | ||
* 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; | ||
@@ -376,3 +375,3 @@ | ||
/** | ||
* @property {object} [customHeaders] User defined custom request headers that | ||
* User defined custom request headers that | ||
* will be applied before the request is sent. | ||
@@ -536,3 +535,3 @@ */ | ||
*/ | ||
export declare function serializationPolicy(options?: serializationPolicyOptions): PipelinePolicy; | ||
export declare function serializationPolicy(options?: SerializationPolicyOptions): PipelinePolicy; | ||
@@ -547,3 +546,3 @@ /** | ||
*/ | ||
export declare interface serializationPolicyOptions { | ||
export declare interface SerializationPolicyOptions { | ||
/** | ||
@@ -601,9 +600,11 @@ * A function that is able to write XML. Required for XML support. | ||
*/ | ||
private readonly _httpsClient; | ||
private readonly _pipeline; | ||
private readonly _httpClient; | ||
/** | ||
* The pipeline used by this client to make requests | ||
*/ | ||
readonly pipeline: Pipeline; | ||
/** | ||
* The ServiceClient constructor | ||
* @constructor | ||
* @param credential The credentials used for authentication with the service. | ||
* @param options The service client options that govern the behavior of the client. | ||
* @param credential - The credentials used for authentication with the service. | ||
* @param options - The service client options that govern the behavior of the client. | ||
*/ | ||
@@ -617,5 +618,5 @@ constructor(options?: ServiceClientOptions); | ||
* Send an HTTP request that is populated using the provided OperationSpec. | ||
* @typeParam T The typed result of the request, based on the OperationSpec. | ||
* @param {OperationArguments} operationArguments The arguments that the HTTP request's templated values will be populated from. | ||
* @param {OperationSpec} operationSpec The OperationSpec to use to populate the httpRequest. | ||
* @typeParam T - The typed result of the request, based on the OperationSpec. | ||
* @param operationArguments - The arguments that the HTTP request's templated values will be populated from. | ||
* @param operationSpec - The OperationSpec to use to populate the httpRequest. | ||
*/ | ||
@@ -628,3 +629,3 @@ sendOperationRequest<T>(operationArguments: OperationArguments, operationSpec: OperationSpec): Promise<T>; | ||
*/ | ||
export declare interface ServiceClientOptions { | ||
export declare interface ServiceClientOptions extends CommonClientOptions { | ||
/** | ||
@@ -652,14 +653,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>; | ||
} | ||
@@ -666,0 +655,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 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 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
541290
7
4931
+ Added@azure/core-asynciterator-polyfill@1.0.2(transitive)
+ Added@azure/core-rest-pipeline@1.0.0-beta.2(transitive)
+ Added@azure/core-tracing@1.0.0-preview.10(transitive)
- Removed@azure/core-https@1.0.0-beta.1
- Removed@azure/core-https@1.0.0-beta.1(transitive)
- Removed@azure/core-tracing@1.0.0-preview.9(transitive)
Updated@azure/core-auth@^1.2.0