@azure/core-http
Advanced tools
Comparing version 3.0.1 to 3.0.2-alpha.20230518.7
@@ -5,2 +5,3 @@ // Copyright (c) Microsoft Corporation. | ||
import * as https from "https"; | ||
import * as tough from "tough-cookie"; | ||
import { AbortController, AbortError } from "@azure/abort-controller"; | ||
@@ -18,7 +19,2 @@ import { HttpHeaders } from "./httpHeaders"; | ||
export class ReportTransform extends Transform { | ||
constructor(progressCallback) { | ||
super(); | ||
this.progressCallback = progressCallback; | ||
this.loadedBytes = 0; | ||
} | ||
_transform(chunk, _encoding, callback) { | ||
@@ -30,2 +26,7 @@ this.push(chunk); | ||
} | ||
constructor(progressCallback) { | ||
super(); | ||
this.progressCallback = progressCallback; | ||
this.loadedBytes = 0; | ||
} | ||
} | ||
@@ -63,2 +64,3 @@ function isReadableStream(body) { | ||
this.keepAliveAgents = {}; | ||
this.cookieJar = new tough.CookieJar(undefined, { looseMode: true }); | ||
} | ||
@@ -280,2 +282,15 @@ /** | ||
const requestInit = {}; | ||
if (this.cookieJar && !httpRequest.headers.get("Cookie")) { | ||
const cookieString = await new Promise((resolve, reject) => { | ||
this.cookieJar.getCookieString(httpRequest.url, (err, cookie) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(cookie); | ||
} | ||
}); | ||
}); | ||
httpRequest.headers.set("Cookie", cookieString); | ||
} | ||
// Set the http(s) agent | ||
@@ -287,8 +302,22 @@ requestInit.agent = this.getOrCreateAgent(httpRequest); | ||
/** | ||
* Process an HTTP response. | ||
* Process an HTTP response. Handles persisting a cookie for subsequent requests if the response has a "Set-Cookie" header. | ||
*/ | ||
async processRequest(_operationResponse) { | ||
/* no_op */ | ||
async processRequest(operationResponse) { | ||
if (this.cookieJar) { | ||
const setCookieHeader = operationResponse.headers.get("Set-Cookie"); | ||
if (setCookieHeader !== undefined) { | ||
await new Promise((resolve, reject) => { | ||
this.cookieJar.setCookie(setCookieHeader, operationResponse.request.url, { ignoreError: true }, (err) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=nodeFetchHttpClient.js.map |
@@ -22,7 +22,2 @@ // Copyright (c) Microsoft Corporation. | ||
export class LogPolicy extends BaseRequestPolicy { | ||
constructor(nextPolicy, options, { logger = coreLogger.info, allowedHeaderNames = [], allowedQueryParameters = [], } = {}) { | ||
super(nextPolicy, options); | ||
this.logger = logger; | ||
this.sanitizer = new Sanitizer({ allowedHeaderNames, allowedQueryParameters }); | ||
} | ||
/** | ||
@@ -64,2 +59,7 @@ * Header names whose values will be logged when logging is enabled. Defaults to | ||
} | ||
constructor(nextPolicy, options, { logger = coreLogger.info, allowedHeaderNames = [], allowedQueryParameters = [], } = {}) { | ||
super(nextPolicy, options); | ||
this.logger = logger; | ||
this.sanitizer = new Sanitizer({ allowedHeaderNames, allowedQueryParameters }); | ||
} | ||
sendRequest(request) { | ||
@@ -66,0 +66,0 @@ if (!this.logger.enabled) |
@@ -9,3 +9,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
export class RestError extends Error { | ||
class RestError extends Error { | ||
constructor(message, code, statusCode, request, response) { | ||
@@ -35,2 +35,3 @@ super(message); | ||
RestError.PARSE_ERROR = "PARSE_ERROR"; | ||
export { RestError }; | ||
//# sourceMappingURL=restError.js.map |
@@ -612,6 +612,3 @@ // Copyright (c) Microsoft Corporation. | ||
if (options === null || options === void 0 ? void 0 : options.credentialScopes) { | ||
const scopes = options.credentialScopes; | ||
return Array.isArray(scopes) | ||
? scopes.map((scope) => new URL(scope).toString()) | ||
: new URL(scopes).toString(); | ||
return options.credentialScopes; | ||
} | ||
@@ -618,0 +615,0 @@ if (baseUri) { |
@@ -10,3 +10,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
coreHttpVersion: "3.0.1", | ||
coreHttpVersion: "3.0.2", | ||
/** | ||
@@ -13,0 +13,0 @@ * Specifies HTTP. |
@@ -5,3 +5,3 @@ { | ||
"author": "Microsoft Corporation", | ||
"version": "3.0.1", | ||
"version": "3.0.2-alpha.20230518.7", | ||
"description": "Isomorphic client Runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest", | ||
@@ -88,4 +88,4 @@ "tags": [ | ||
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", | ||
"test:node": "npm run clean && tsc -p . && npm run unit-test:node && npm run integration-test:node", | ||
"test": "npm run clean && tsc -p . && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", | ||
"test:node": "npm run clean && tsc -p tsconfig.es.json && npm run unit-test:node && npm run integration-test:node", | ||
"test": "npm run clean && tsc -p tsconfig.es.json && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", | ||
"unit-test": "npm run unit-test:node && npm run unit-test:browser", | ||
@@ -131,2 +131,3 @@ "unit-test:browser": "karma start --single-run", | ||
"process": "^0.11.10", | ||
"tough-cookie": "^4.0.0", | ||
"tslib": "^2.2.0", | ||
@@ -138,8 +139,8 @@ "tunnel": "^0.0.6", | ||
"devDependencies": { | ||
"@azure/eslint-plugin-azure-sdk": "^3.0.0", | ||
"@azure/dev-tool": "^1.0.0", | ||
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb", | ||
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb", | ||
"@azure/logger-js": "^1.0.2", | ||
"@azure/test-utils": "^1.0.0", | ||
"@azure/test-utils": ">=1.0.0-alpha <1.0.0-alphb", | ||
"@microsoft/api-extractor": "^7.31.1", | ||
"@opentelemetry/api": "^1.4.0", | ||
"@opentelemetry/api": "^1.4.1", | ||
"@types/chai": "^4.1.6", | ||
@@ -150,2 +151,3 @@ "@types/express": "^4.16.0", | ||
"@types/sinon": "^9.0.4", | ||
"@types/tough-cookie": "^4.0.0", | ||
"@types/trusted-types": "^2.0.0", | ||
@@ -163,3 +165,2 @@ "@types/uuid": "^8.0.0", | ||
"karma-chrome-launcher": "^3.0.0", | ||
"karma-edge-launcher": "^0.4.2", | ||
"karma-firefox-launcher": "^1.1.0", | ||
@@ -179,3 +180,3 @@ "karma-mocha": "^2.0.1", | ||
"ts-node": "^10.0.0", | ||
"typescript": "~4.8.0", | ||
"typescript": "~5.0.0", | ||
"uglify-js": "^3.4.9", | ||
@@ -182,0 +183,0 @@ "xhr-mock": "^2.4.1" |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
export declare type Authenticator = (challenge: unknown) => Promise<string>; | ||
export type Authenticator = (challenge: unknown) => Promise<string>; | ||
//# sourceMappingURL=credentials.d.ts.map |
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
export declare type RawHttpHeaders = { | ||
export type RawHttpHeaders = { | ||
[headerName: string]: string; | ||
@@ -20,0 +20,0 @@ }; |
@@ -10,7 +10,7 @@ /// <reference types="node" /> | ||
*/ | ||
export declare type CommonRequestInfo = string; | ||
export type CommonRequestInfo = string; | ||
/** | ||
* An object containing information about the outgoing HTTP request. | ||
*/ | ||
export declare type CommonRequestInit = Pick<RequestInit, Exclude<keyof RequestInit, "body" | "headers" | "signal">> & { | ||
export type CommonRequestInit = Pick<RequestInit, Exclude<keyof RequestInit, "body" | "headers" | "signal">> & { | ||
body?: any; | ||
@@ -23,3 +23,3 @@ headers?: any; | ||
*/ | ||
export declare type CommonResponse = Pick<Response, Exclude<keyof Response, "body" | "trailer" | "formData">> & { | ||
export type CommonResponse = Pick<Response, Exclude<keyof Response, "body" | "trailer" | "formData">> & { | ||
body: any; | ||
@@ -51,2 +51,3 @@ trailer: any; | ||
private keepAliveAgents; | ||
private readonly cookieJar; | ||
private getOrCreateAgent; | ||
@@ -62,6 +63,6 @@ /** | ||
/** | ||
* Process an HTTP response. | ||
* Process an HTTP response. Handles persisting a cookie for subsequent requests if the response has a "Set-Cookie" header. | ||
*/ | ||
processRequest(_operationResponse: HttpOperationResponse): Promise<void>; | ||
processRequest(operationResponse: HttpOperationResponse): Promise<void>; | ||
} | ||
//# sourceMappingURL=nodeFetchHttpClient.d.ts.map |
@@ -6,3 +6,3 @@ import { Mapper } from "./serializer"; | ||
*/ | ||
export declare type ParameterPath = string | string[] | { | ||
export type ParameterPath = string | string[] | { | ||
[propertyName: string]: ParameterPath; | ||
@@ -9,0 +9,0 @@ }; |
@@ -8,3 +8,3 @@ import { HttpOperationResponse } from "../httpOperationResponse"; | ||
*/ | ||
export declare type RequestPolicyFactory = { | ||
export type RequestPolicyFactory = { | ||
create(nextPolicy: RequestPolicy, options: RequestPolicyOptionsLike): RequestPolicy; | ||
@@ -11,0 +11,0 @@ }; |
import { BaseRequestPolicy, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "./requestPolicy"; | ||
import { HttpOperationResponse } from "../httpOperationResponse"; | ||
import { WebResourceLike } from "../webResource"; | ||
declare type ResponseHandler = (httpRequest: WebResourceLike, response: HttpOperationResponse) => Promise<HttpOperationResponse>; | ||
type ResponseHandler = (httpRequest: WebResourceLike, response: HttpOperationResponse) => Promise<HttpOperationResponse>; | ||
/** | ||
@@ -6,0 +6,0 @@ * Creates a policy that re-sends the request if the response indicates the request failed because of throttling reasons. |
@@ -8,3 +8,3 @@ import { BaseRequestPolicy, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "./requestPolicy"; | ||
*/ | ||
export declare type TelemetryInfo = { | ||
export type TelemetryInfo = { | ||
key?: string; | ||
@@ -11,0 +11,0 @@ value?: string; |
@@ -7,3 +7,3 @@ /// <reference types="node" /> | ||
import { ProxySettings } from "./serviceClient"; | ||
export declare type ProxyAgent = { | ||
export type ProxyAgent = { | ||
isHttps: boolean; | ||
@@ -10,0 +10,0 @@ agent: http.Agent | https.Agent; |
@@ -110,3 +110,3 @@ import { SerializerOptions } from "./util/serializer.common"; | ||
*/ | ||
export declare type MapperType = SimpleMapperType | CompositeMapperType | SequenceMapperType | DictionaryMapperType | EnumMapperType; | ||
export type MapperType = SimpleMapperType | CompositeMapperType | SequenceMapperType | DictionaryMapperType | EnumMapperType; | ||
/** | ||
@@ -262,3 +262,3 @@ * The type of a simple mapper. | ||
*/ | ||
export declare type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper; | ||
export type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper; | ||
/** | ||
@@ -265,0 +265,0 @@ * Used to disambiguate discriminated type unions. |
@@ -40,3 +40,3 @@ import { Mapper, Serializer } from "./serializer"; | ||
*/ | ||
export declare type ProxyOptions = ProxySettings; | ||
export type ProxyOptions = ProxySettings; | ||
/** | ||
@@ -153,3 +153,3 @@ * Options to be provided while creating the client. | ||
export declare function createPipelineFromOptions(pipelineOptions: InternalPipelineOptions, authPolicyFactory?: RequestPolicyFactory): ServiceClientOptions; | ||
export declare type PropertyParent = { | ||
export type PropertyParent = { | ||
[propertyName: string]: any; | ||
@@ -156,0 +156,0 @@ }; |
@@ -122,4 +122,4 @@ /** | ||
} | ||
declare type URLTokenizerState = "SCHEME" | "SCHEME_OR_HOST" | "HOST" | "PORT" | "PATH" | "QUERY" | "DONE"; | ||
declare type URLTokenType = "SCHEME" | "HOST" | "PORT" | "PATH" | "QUERY"; | ||
type URLTokenizerState = "SCHEME" | "SCHEME_OR_HOST" | "HOST" | "PORT" | "PATH" | "QUERY" | "DONE"; | ||
type URLTokenType = "SCHEME" | "HOST" | "PORT" | "PATH" | "QUERY"; | ||
export declare class URLToken { | ||
@@ -126,0 +126,0 @@ readonly text: string; |
@@ -123,3 +123,3 @@ import { HttpOperationResponse } from "../httpOperationResponse"; | ||
*/ | ||
export declare type UnknownObject = { | ||
export type UnknownObject = { | ||
[s: string]: unknown; | ||
@@ -126,0 +126,0 @@ }; |
@@ -14,11 +14,11 @@ /// <reference types="node" /> | ||
*/ | ||
export declare type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE"; | ||
export type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE"; | ||
/** | ||
* Possible HTTP request body types | ||
*/ | ||
export declare type HttpRequestBody = Blob | string | ArrayBuffer | ArrayBufferView | (() => NodeJS.ReadableStream); | ||
export type HttpRequestBody = Blob | string | ArrayBuffer | ArrayBufferView | (() => NodeJS.ReadableStream); | ||
/** | ||
* Fired in response to upload or download progress. | ||
*/ | ||
export declare type TransferProgressEvent = { | ||
export type TransferProgressEvent = { | ||
/** | ||
@@ -25,0 +25,0 @@ * The number of bytes loaded so far. |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
export declare type Authenticator = (challenge: unknown) => Promise<string>; | ||
export type Authenticator = (challenge: unknown) => Promise<string>; | ||
//# sourceMappingURL=credentials.d.ts.map |
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
export declare type RawHttpHeaders = { | ||
export type RawHttpHeaders = { | ||
[headerName: string]: string; | ||
@@ -20,0 +20,0 @@ }; |
@@ -11,7 +11,7 @@ /// <reference types="node" /> | ||
*/ | ||
export declare type CommonRequestInfo = string; | ||
export type CommonRequestInfo = string; | ||
/** | ||
* An object containing information about the outgoing HTTP request. | ||
*/ | ||
export declare type CommonRequestInit = Omit<RequestInit, "body" | "headers" | "signal"> & { | ||
export type CommonRequestInit = Omit<RequestInit, "body" | "headers" | "signal"> & { | ||
body?: any; | ||
@@ -24,3 +24,3 @@ headers?: any; | ||
*/ | ||
export declare type CommonResponse = Omit<Response, "body" | "trailer" | "formData"> & { | ||
export type CommonResponse = Omit<Response, "body" | "trailer" | "formData"> & { | ||
body: any; | ||
@@ -52,2 +52,3 @@ trailer: any; | ||
private keepAliveAgents; | ||
private readonly cookieJar; | ||
private getOrCreateAgent; | ||
@@ -63,6 +64,6 @@ /** | ||
/** | ||
* Process an HTTP response. | ||
* Process an HTTP response. Handles persisting a cookie for subsequent requests if the response has a "Set-Cookie" header. | ||
*/ | ||
processRequest(_operationResponse: HttpOperationResponse): Promise<void>; | ||
processRequest(operationResponse: HttpOperationResponse): Promise<void>; | ||
} | ||
//# sourceMappingURL=nodeFetchHttpClient.d.ts.map |
@@ -6,3 +6,3 @@ import { Mapper } from "./serializer"; | ||
*/ | ||
export declare type ParameterPath = string | string[] | { | ||
export type ParameterPath = string | string[] | { | ||
[propertyName: string]: ParameterPath; | ||
@@ -9,0 +9,0 @@ }; |
@@ -8,3 +8,3 @@ import { HttpOperationResponse } from "../httpOperationResponse"; | ||
*/ | ||
export declare type RequestPolicyFactory = { | ||
export type RequestPolicyFactory = { | ||
create(nextPolicy: RequestPolicy, options: RequestPolicyOptionsLike): RequestPolicy; | ||
@@ -11,0 +11,0 @@ }; |
import { BaseRequestPolicy, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "./requestPolicy"; | ||
import { HttpOperationResponse } from "../httpOperationResponse"; | ||
import { WebResourceLike } from "../webResource"; | ||
declare type ResponseHandler = (httpRequest: WebResourceLike, response: HttpOperationResponse) => Promise<HttpOperationResponse>; | ||
type ResponseHandler = (httpRequest: WebResourceLike, response: HttpOperationResponse) => Promise<HttpOperationResponse>; | ||
/** | ||
@@ -6,0 +6,0 @@ * Creates a policy that re-sends the request if the response indicates the request failed because of throttling reasons. |
@@ -8,3 +8,3 @@ import { BaseRequestPolicy, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "./requestPolicy"; | ||
*/ | ||
export declare type TelemetryInfo = { | ||
export type TelemetryInfo = { | ||
key?: string; | ||
@@ -11,0 +11,0 @@ value?: string; |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
import { ProxySettings } from "./serviceClient"; | ||
export declare type ProxyAgent = { | ||
export type ProxyAgent = { | ||
isHttps: boolean; | ||
@@ -11,0 +11,0 @@ agent: http.Agent | https.Agent; |
@@ -110,3 +110,3 @@ import { SerializerOptions } from "./util/serializer.common"; | ||
*/ | ||
export declare type MapperType = SimpleMapperType | CompositeMapperType | SequenceMapperType | DictionaryMapperType | EnumMapperType; | ||
export type MapperType = SimpleMapperType | CompositeMapperType | SequenceMapperType | DictionaryMapperType | EnumMapperType; | ||
/** | ||
@@ -262,3 +262,3 @@ * The type of a simple mapper. | ||
*/ | ||
export declare type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper; | ||
export type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper; | ||
/** | ||
@@ -265,0 +265,0 @@ * Used to disambiguate discriminated type unions. |
@@ -40,3 +40,3 @@ import { Mapper, Serializer } from "./serializer"; | ||
*/ | ||
export declare type ProxyOptions = ProxySettings; | ||
export type ProxyOptions = ProxySettings; | ||
/** | ||
@@ -153,3 +153,3 @@ * Options to be provided while creating the client. | ||
export declare function createPipelineFromOptions(pipelineOptions: InternalPipelineOptions, authPolicyFactory?: RequestPolicyFactory): ServiceClientOptions; | ||
export declare type PropertyParent = { | ||
export type PropertyParent = { | ||
[propertyName: string]: any; | ||
@@ -156,0 +156,0 @@ }; |
@@ -122,4 +122,4 @@ /** | ||
} | ||
declare type URLTokenizerState = "SCHEME" | "SCHEME_OR_HOST" | "HOST" | "PORT" | "PATH" | "QUERY" | "DONE"; | ||
declare type URLTokenType = "SCHEME" | "HOST" | "PORT" | "PATH" | "QUERY"; | ||
type URLTokenizerState = "SCHEME" | "SCHEME_OR_HOST" | "HOST" | "PORT" | "PATH" | "QUERY" | "DONE"; | ||
type URLTokenType = "SCHEME" | "HOST" | "PORT" | "PATH" | "QUERY"; | ||
export declare class URLToken { | ||
@@ -126,0 +126,0 @@ readonly text: string; |
@@ -123,3 +123,3 @@ import { HttpOperationResponse } from "../httpOperationResponse"; | ||
*/ | ||
export declare type UnknownObject = { | ||
export type UnknownObject = { | ||
[s: string]: unknown; | ||
@@ -126,0 +126,0 @@ }; |
@@ -14,11 +14,11 @@ /// <reference types="node" /> | ||
*/ | ||
export declare type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE"; | ||
export type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE"; | ||
/** | ||
* Possible HTTP request body types | ||
*/ | ||
export declare type HttpRequestBody = Blob | string | ArrayBuffer | ArrayBufferView | (() => NodeJS.ReadableStream); | ||
export type HttpRequestBody = Blob | string | ArrayBuffer | ArrayBufferView | (() => NodeJS.ReadableStream); | ||
/** | ||
* Fired in response to upload or download progress. | ||
*/ | ||
export declare type TransferProgressEvent = { | ||
export type TransferProgressEvent = { | ||
/** | ||
@@ -25,0 +25,0 @@ * The number of bytes loaded so far. |
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
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 not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1752305
17923
15
2
+ Addedtough-cookie@^4.0.0
+ Addedpsl@1.10.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedquerystringify@2.2.0(transitive)
+ Addedrequires-port@1.0.0(transitive)
+ Addedtough-cookie@4.1.4(transitive)
+ Addeduniversalify@0.2.0(transitive)
+ Addedurl-parse@1.5.10(transitive)