New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@azure/storage-file

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/storage-file - npm Package Compare versions

Comparing version 10.0.0-preview to 10.1.0

browser/azure-storage.file.min.js.map

10

BreakingChanges.md

@@ -1,1 +0,9 @@

# Breaking Changes
# Breaking Changes
2018.01 Version 10.1.0
* Updated convenience layer methods enum type parameters into typescript union types, this will help reducing bundle footprint.
* Updated URL encoding strategy for `url` parameters of `new XXXURL(url, pipeline)` methods, such as `new FileURL(url, pipeline)`.
* URL will accept both encoded or non-encoded URL string. It will escape non-escaped special characters, like Chinese characters. However, if directory/file name includes `%`, `url` must be encoded manually.
* `SASQueryParameters` is not going to be exported in browser bundle, and will be exported in Node.js runtime.
* IE11 needs `Array.prototype.includes` and `Object.keys` polyfills loaded.
# Changelog
2018.01 Version 10.1.0
* [Breaking] Updated convenience layer methods enum type parameters into typescript union types, this will help reducing bundle footprint.
* [Breaking] Updated URL encoding strategy for `url` parameters of `new XXXURL(url, pipeline)` methods, such as `new FileURL(url, pipeline)`.
* URL will accept both encoded or non-encoded URL string. It will escape non-escaped special characters, like Chinese characters. However, if directory/file name includes `%`, `url` must be encoded manually.
* [Breaking] `SASQueryParameters` is not going to be exported in browser bundle, and will be exported in Node.js runtime.
* [Breaking] IE11 needs `Array.prototype.includes` and `Object.keys` polyfills loaded.
* Updated dependency `ms-rest-js` to `@azure/ms-rest-js`.
* Fixed `Aborter.timeout()` misleading scale description.
* Removed default 60s server timeout value for retry options `tryTimeoutInMs` to avoid large blob download stream unexpected ending.
* Fixed an issue that when body is string with special characters, `FileURL.uploadRange` will fail to upload.
* Exported `HttpRequestBody` type for who wants to implement a customized HTTP client.
2018.12 Version 10.0.0-preview
* Initial Release. API version 2018-03-28 supported. Please see the README for information on the new design.

6

dist-esm/lib/Aborter.js

@@ -1,2 +0,2 @@

import { isNode } from "ms-rest-js";
import { isNode } from "@azure/ms-rest-js";
/**

@@ -105,7 +105,7 @@ * An aborter instance implements AbortSignal interface, can abort HTTP requests.

/**
* Creates a new Aborter instance with timeout in million-seconds.
* Creates a new Aborter instance with timeout in milliseconds.
* Set parameter timeout to 0 will not create a timer.
*
* @static
* @param {number} {timeout} in million-seconds
* @param {number} {timeout} in milliseconds
* @returns {Aborter}

@@ -112,0 +112,0 @@ * @memberof Aborter

import * as tslib_1 from "tslib";
import { Directory } from "./generated/operations";
import { Directory } from "./generated/lib/operations";
import { StorageURL } from "./StorageURL";

@@ -21,2 +21,6 @@ import { appendToURLPath } from "./utils/utils.common";

* "https://myaccount.file.core.windows.net/myshare/mydirectory?sasString".
* This method accepts an encoded URL or non-encoded URL pointing to a directory.
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
* However, if a directory name includes %, directory name must be encoded in the URL.
* Such as a directory named "mydir%", the URL should be "https://myaccount.file.core.windows.net/myshare/mydir%25".
* @param {Pipeline} pipeline Call StorageURL.newPipeline() to create a default

@@ -32,18 +36,18 @@ * pipeline, or provide a customized pipeline.

/**
* Creates a DirectoryURL object from ShareURL
* Creates a DirectoryURL object from ShareURL.
*
* @param shareURL
* @param directoryName
* @param shareURL A ShareURL object
* @param directoryName A directory name
*/
DirectoryURL.fromShareURL = function (shareURL, directoryName) {
return new DirectoryURL(appendToURLPath(shareURL.url, directoryName), shareURL.pipeline);
return new DirectoryURL(appendToURLPath(shareURL.url, encodeURIComponent(directoryName)), shareURL.pipeline);
};
/**
* Creates a DirectoryURL object from an existing DirectoryURL
* Creates a DirectoryURL object from an existing DirectoryURL.
*
* @param directoryURL
* @param directoryName
* @param directoryURL A DirectoryURL object
* @param directoryName A subdirectory name
*/
DirectoryURL.fromDirectoryURL = function (directoryURL, directoryName) {
return new DirectoryURL(appendToURLPath(directoryURL.url, directoryName), directoryURL.pipeline);
return new DirectoryURL(appendToURLPath(directoryURL.url, encodeURIComponent(directoryName)), directoryURL.pipeline);
};

@@ -50,0 +54,0 @@ /**

@@ -1,2 +0,2 @@

import { isNode } from "ms-rest-js";
import { isNode } from "@azure/ms-rest-js";
import { RetriableReadableStream } from "./utils/RetriableReadableStream";

@@ -3,0 +3,0 @@ /**

import * as tslib_1 from "tslib";
import { isNode } from "ms-rest-js";
import { isNode } from "@azure/ms-rest-js";
import { FileDownloadResponse } from "./FileDownloadResponse";
import * as Models from "./generated/models";
import { File } from "./generated/operations";
import { File } from "./generated/lib/operations";
import { rangeToString } from "./IRange";

@@ -26,2 +25,6 @@ import { StorageURL } from "./StorageURL";

* "https://myaccount.file.core.windows.net/myshare/mydirectory/file?sasString".
* This method accepts an encoded URL or non-encoded URL pointing to a file.
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
* However, if a file or directory name includes %, file or directory name must be encoded in the URL.
* Such as a file named "myfile%", the URL should be "https://myaccount.file.core.windows.net/myshare/mydirectory/myfile%25".
* @param {Pipeline} pipeline Call StorageURL.newPipeline() to create a default

@@ -40,4 +43,4 @@ * pipeline, or provide a customized pipeline.

* @static
* @param {DirectoryURL} directoryURL
* @param {string} fileName
* @param {DirectoryURL} directoryURL A DirectoryURL object
* @param {string} fileName A file name
* @returns

@@ -47,3 +50,3 @@ * @memberof FileURL

FileURL.fromDirectoryURL = function (directoryURL, fileName) {
return new FileURL(appendToURLPath(directoryURL.url, fileName), directoryURL.pipeline);
return new FileURL(appendToURLPath(directoryURL.url, encodeURIComponent(fileName)), directoryURL.pipeline);
};

@@ -292,5 +295,7 @@ /**

* goto documents of Aborter for more examples about request cancellation
* @param {HttpRequestBody} body
* @param {number} offset
* @param {number} contentLength
* @param {HttpRequestBody} body Blob, string, ArrayBuffer, ArrayBufferView or a function
* which returns a new Readable stream whose offset is from data source beginning.
* @param {number} offset Offset position of the destination Azure File to upload.
* @param {number} contentLength Length of body in bytes. Use Buffer.byteLength() to calculate body length for a
* string including non non-Base64/Hex-encoded characters.
* @param {IFileUploadRangeOptions} [options]

@@ -310,3 +315,3 @@ * @returns {Promise<Models.FileUploadRangeResponse>}

}
return [2 /*return*/, this.context.uploadRange(rangeToString({ count: contentLength, offset: offset }), Models.FileRangeWriteType.Update, contentLength, {
return [2 /*return*/, this.context.uploadRange(rangeToString({ count: contentLength, offset: offset }), "update", contentLength, {
abortSignal: aborter,

@@ -337,3 +342,3 @@ contentMD5: options.contentMD5,

}
return [2 /*return*/, this.context.uploadRange(rangeToString({ count: contentLength, offset: offset }), Models.FileRangeWriteType.Clear, 0, {
return [2 /*return*/, this.context.uploadRange(rangeToString({ count: contentLength, offset: offset }), "clear", 0, {
abortSignal: aborter

@@ -340,0 +345,0 @@ })];

@@ -1,3 +0,3 @@

import { RestError } from "ms-rest-js";
import * as Models from "../lib/generated/models";
import { RestError } from "@azure/ms-rest-js";
import * as Models from "../lib/generated/lib/models";
export * from "./Aborter";

@@ -18,3 +18,2 @@ export * from "./ShareURL";

export * from "./BrowserPolicyFactory";
export * from "./SASQueryParameters";
export * from "./ServiceURL";

@@ -21,0 +20,0 @@ export * from "./StorageURL";

@@ -1,3 +0,3 @@

import { RestError } from "ms-rest-js";
import * as Models from "../lib/generated/models";
import { RestError } from "@azure/ms-rest-js";
import * as Models from "../lib/generated/lib/models";
export * from "./Aborter";

@@ -30,3 +30,4 @@ export * from "./AccountSASPermissions";

export * from "./StorageURL";
export * from "./SASQueryParameters";
export { Models, RestError };
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import { BaseRequestPolicy, HttpHeaders, HttpPipelineLogLevel, RequestPolicyOptions, WebResource } from "ms-rest-js";
import { BaseRequestPolicy, HttpHeaders, HttpPipelineLogLevel, RequestPolicyOptions, WebResource } from "@azure/ms-rest-js";
// Export following interfaces and types for customers who want to implement their

@@ -3,0 +3,0 @@ // own RequestPolicy or HTTPClient

import * as tslib_1 from "tslib";
import { BaseRequestPolicy, isNode } from "ms-rest-js";
import { BaseRequestPolicy, isNode } from "@azure/ms-rest-js";
import { HeaderConstants, URLConstants } from "../utils/constants";

@@ -4,0 +4,0 @@ import { setURLParameter } from "../utils/utils.common";

import * as tslib_1 from "tslib";
import { BaseRequestPolicy } from "ms-rest-js";
import { BaseRequestPolicy } from "@azure/ms-rest-js";
/**

@@ -4,0 +4,0 @@ * Credential policy used to sign HTTP(S) requests before sending. This is an

import * as tslib_1 from "tslib";
import { BaseRequestPolicy, HttpPipelineLogLevel } from "ms-rest-js";
import { BaseRequestPolicy, HttpPipelineLogLevel } from "@azure/ms-rest-js";
import { HTTPURLConnection, URLConstants } from "../utils/constants";

@@ -4,0 +4,0 @@ import { getURLParameter, setURLParameter } from "../utils/utils.common";

import * as tslib_1 from "tslib";
import { BaseRequestPolicy, delay, HttpPipelineLogLevel } from "ms-rest-js";
import { BaseRequestPolicy, delay, HttpPipelineLogLevel } from "@azure/ms-rest-js";
import { URLConstants } from "../utils/constants";

@@ -42,3 +42,3 @@ import { setURLParameter } from "../utils/utils.common";

retryPolicyType: RetryPolicyType.EXPONENTIAL,
tryTimeoutInMs: 60 * 1000
tryTimeoutInMs: undefined // Use server side default timeout strategy
};

@@ -123,3 +123,5 @@ /**

// Set the server-side timeout query parameter "timeout=[seconds]"
newRequest.url = setURLParameter(newRequest.url, URLConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString());
if (this.retryOptions.tryTimeoutInMs) {
newRequest.url = setURLParameter(newRequest.url, URLConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString());
}
_a.label = 1;

@@ -126,0 +128,0 @@ case 1:

@@ -39,3 +39,3 @@ import * as tslib_1 from "tslib";

request.body.length > 0) {
request.headers.set(HeaderConstants.CONTENT_LENGTH, request.body.length);
request.headers.set(HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));
}

@@ -140,3 +140,3 @@ var stringToSign = [

SharedKeyCredentialPolicy.prototype.getCanonicalizedResourceString = function (request) {
var path = encodeURI(getURLPath(request.url) || "/");
var path = getURLPath(request.url) || "/";
var canonicalizedResourceString = "";

@@ -143,0 +143,0 @@ canonicalizedResourceString += "/" + this.factory.accountName + path;

import * as tslib_1 from "tslib";
import { BaseRequestPolicy, HttpHeaders, isNode } from "ms-rest-js";
import { BaseRequestPolicy, HttpHeaders, isNode } from "@azure/ms-rest-js";
import { HeaderConstants } from "../utils/constants";

@@ -4,0 +4,0 @@ /**

import * as tslib_1 from "tslib";
import { BaseRequestPolicy, generateUuid } from "ms-rest-js";
import { BaseRequestPolicy, generateUuid } from "@azure/ms-rest-js";
import { HeaderConstants } from "../utils/constants";

@@ -4,0 +4,0 @@ /**

import * as tslib_1 from "tslib";
import { Service } from "./generated/operations";
import { Service } from "./generated/lib/operations";
import { StorageURL } from "./StorageURL";

@@ -4,0 +4,0 @@ /**

import * as tslib_1 from "tslib";
import { Share } from "./generated/operations";
import { Share } from "./generated/lib/operations";
import { StorageURL } from "./StorageURL";

@@ -4,0 +4,0 @@ import { URLConstants } from "./utils/constants";

@@ -1,4 +0,4 @@

import { deserializationPolicy } from "ms-rest-js";
import { deserializationPolicy } from "@azure/ms-rest-js";
import { BrowserPolicyFactory } from "./BrowserPolicyFactory";
import { StorageClientContext } from "./generated/storageClientContext";
import { StorageClientContext } from "./generated/lib/storageClientContext";
import { LoggingPolicyFactory } from "./LoggingPolicyFactory";

@@ -9,2 +9,3 @@ import { Pipeline } from "./Pipeline";

import { UniqueRequestIDPolicyFactory } from "./UniqueRequestIDPolicyFactory";
import { escapeURLPath } from "./utils/utils.common";
export { deserializationPolicy };

@@ -25,5 +26,6 @@ /**

function StorageURL(url, pipeline) {
this.url = url;
// URL should be encoded and only once, protocol layer shouldn't encode URL again
this.url = escapeURLPath(url);
this.pipeline = pipeline;
this.storageClientContext = new StorageClientContext(url, pipeline.toServiceClientOptions());
this.storageClientContext = new StorageClientContext(this.url, pipeline.toServiceClientOptions());
// Remove the default content-type in generated code of StorageClientContext

@@ -30,0 +32,0 @@ var storageClientContext = this.storageClientContext;

@@ -1,2 +0,2 @@

import { isNode } from "ms-rest-js";
import { isNode } from "@azure/ms-rest-js";
import * as os from "os";

@@ -3,0 +3,0 @@ import { TelemetryPolicy } from "./policies/TelemetryPolicy";

@@ -1,2 +0,2 @@

export var SDK_VERSION = "10.0.0-preview";
export var SDK_VERSION = "10.1.0";
export var SERVICE_VERSION = "2018-03-28";

@@ -3,0 +3,0 @@ export var FILE_MAX_SIZE_BYTES = 1024 * 1024 * 1024 * 1024; // 1TB

import * as tslib_1 from "tslib";
import { RestError } from "ms-rest-js";
import { RestError } from "@azure/ms-rest-js";
import { Readable } from "stream";

@@ -4,0 +4,0 @@ /**

@@ -1,3 +0,78 @@

import { isNode, URLBuilder } from "ms-rest-js";
import { isNode, URLBuilder } from "@azure/ms-rest-js";
/**
* Reserved URL characters must be properly escaped for Storage services like Blob or File.
*
* ## URL encode and escape strategy for JSv10 SDKs
*
* When customers pass a URL string into XXXURL classes constructor, the URL string may already be URL encoded or not.
* But before sending to Azure Storage server, the URL must be encoded. However, it's hard for a SDK to guess whether the URL
* string has been encoded or not. We have 2 potential strategies, and chose strategy two for the XXXURL constructors.
*
* ### Strategy One: Assume the customer URL string is not encoded, and always encode URL string in SDK.
*
* This is what legacy V2 SDK does, simple and works for most of the cases.
* - When customer URL string is "http://account.blob.core.windows.net/con/b:",
* SDK will encode it to "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created.
* - When customer URL string is "http://account.blob.core.windows.net/con/b%3A",
* SDK will encode it to "http://account.blob.core.windows.net/con/b%253A" and send to server. A blob named "b%3A" will be created.
*
* But this strategy will make it not possible to create a blob with "?" in it's name. Because when customer URL string is
* "http://account.blob.core.windows.net/con/blob?name", the "?name" will be treated as URL paramter instead of blob name.
* If customer URL string is "http://account.blob.core.windows.net/con/blob%3Fname", a blob named "blob%3Fname" will be created.
* V2 SDK doesn't have this issue because it doesn't allow customer pass in a full URL, it accepts a separate blob name and encodeURIComponent for it.
* We cannot accept a SDK cannot create a blob name with "?". So we implement strategy two:
*
* ### Strategy Two: SDK doesn't assume the URL has been encoded or not. It will just escape the special characters.
*
* This is what V10 Blob Go SDK does. It accepts a URL type in Go, and call url.EscapedPath() to escape the special chars unescaped.
* - When customer URL string is "http://account.blob.core.windows.net/con/b:",
* SDK will escape ":" like "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created.
* - When customer URL string is "http://account.blob.core.windows.net/con/b%3A",
* There is no special characters, so send "http://account.blob.core.windows.net/con/b%3A" to server. A blob named "b:" will be created.
* - When customer URL string is "http://account.blob.core.windows.net/con/b%253A",
* There is no special characters, so send "http://account.blob.core.windows.net/con/b%253A" to server. A blob named "b%3A" will be created.
*
* This strategy gives us flexibility to create with any special characters. But "%" will be treated as a special characters, if the URL string
* is not encoded, there shouldn't a "%" in the URL string, otherwise the URL is not a valid URL.
* If customer needs to create a blob with "%" in it's blob name, use "%25" insead of "%". Just like above 3rd sample.
* And following URL strings are invalid:
* - "http://account.blob.core.windows.net/con/b%"
* - "http://account.blob.core.windows.net/con/b%2"
* - "http://account.blob.core.windows.net/con/b%G"
*
* Another special character is "?", use "%2F" to represent a blob name with "?" in a URL string.
*
* ### Strategy for containerName, blobName or other specific XXXName parameters in methods such as `BlobURL.fromContainerURL(containerURL, blobName)`
*
* We will apply strategy one, and call encodeURIComponent for these parameters like blobName. Because what customers passes in is a plain name instead of a URL.
*
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata
*
* @export
* @param {string} url
* @returns {string}
*/
export function escapeURLPath(url) {
var urlParsed = URLBuilder.parse(url);
var path = urlParsed.getPath();
path = path || "/";
path = escape(path);
urlParsed.setPath(path);
return urlParsed.toString();
}
/**
* Internal escape method implemented Strategy Two mentioned in escapeURL() description.
*
* @param {string} text
* @returns {string}
*/
function escape(text) {
return encodeURIComponent(text)
.replace(/%2F/g, "/") // Don't escape for "/"
.replace(/'/g, "%27") // Escape for "'"
.replace(/\+/g, "%20")
.replace(/%25/g, "%"); // Revert encoded "%"
}
/**
* Append a string to URL path. Will remove duplicated "/" in front of the string

@@ -4,0 +79,0 @@ * when URL path ends with a "/".

@@ -1,2 +0,2 @@

import { AbortSignalLike, isNode } from "ms-rest-js";
import { AbortSignalLike, isNode } from "@azure/ms-rest-js";

@@ -69,7 +69,7 @@ /**

/**
* Creates a new Aborter instance with timeout in million-seconds.
* Creates a new Aborter instance with timeout in milliseconds.
* Set parameter timeout to 0 will not create a timer.
*
* @static
* @param {number} {timeout} in million-seconds
* @param {number} {timeout} in milliseconds
* @returns {Aborter}

@@ -87,3 +87,3 @@ * @memberof Aborter

*/
public onabort?: ((ev: Event) => any);
public onabort?: ((ev?: Event) => any);

@@ -96,3 +96,3 @@ // tslint:disable-next-line:variable-name

private readonly abortEventListeners: Array<
(this: AbortSignalLike, ev: any) => any
(this: AbortSignalLike, ev?: any) => any
> = [];

@@ -99,0 +99,0 @@ // Pipeline proxies need to use "abortSignal as Aborter" in order to access non AbortSignalLike methods

@@ -5,3 +5,3 @@ import {

RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -8,0 +8,0 @@ import { BrowserPolicy } from "./policies/BrowserPolicy";

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions } from "@azure/ms-rest-js";

@@ -3,0 +3,0 @@ import { AnonymousCredentialPolicy } from "../policies/AnonymousCredentialPolicy";

@@ -5,3 +5,3 @@ import {

RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -8,0 +8,0 @@ import { CredentialPolicy } from "../policies/CredentialPolicy";

import * as Crypto from "crypto";
import { RequestPolicy, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions } from "@azure/ms-rest-js";

@@ -4,0 +4,0 @@ import { SharedKeyCredentialPolicy } from "../policies/SharedKeyCredentialPolicy";

import { Aborter } from "./Aborter";
import * as Models from "./generated/models";
import { Directory } from "./generated/operations";
import * as Models from "./generated/lib/models";
import { Directory } from "./generated/lib/operations";
import { IMetadata } from "./models";

@@ -51,6 +51,6 @@ import { Pipeline } from "./Pipeline";

/**
* Creates a DirectoryURL object from ShareURL
* Creates a DirectoryURL object from ShareURL.
*
* @param shareURL
* @param directoryName
* @param shareURL A ShareURL object
* @param directoryName A directory name
*/

@@ -62,3 +62,3 @@ public static fromShareURL(

return new DirectoryURL(
appendToURLPath(shareURL.url, directoryName),
appendToURLPath(shareURL.url, encodeURIComponent(directoryName)),
shareURL.pipeline

@@ -69,6 +69,6 @@ );

/**
* Creates a DirectoryURL object from an existing DirectoryURL
* Creates a DirectoryURL object from an existing DirectoryURL.
*
* @param directoryURL
* @param directoryName
* @param directoryURL A DirectoryURL object
* @param directoryName A subdirectory name
*/

@@ -80,3 +80,3 @@ public static fromDirectoryURL(

return new DirectoryURL(
appendToURLPath(directoryURL.url, directoryName),
appendToURLPath(directoryURL.url, encodeURIComponent(directoryName)),
directoryURL.pipeline

@@ -102,2 +102,6 @@ );

* "https://myaccount.file.core.windows.net/myshare/mydirectory?sasString".
* This method accepts an encoded URL or non-encoded URL pointing to a directory.
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
* However, if a directory name includes %, directory name must be encoded in the URL.
* Such as a directory named "mydir%", the URL should be "https://myaccount.file.core.windows.net/myshare/mydir%25".
* @param {Pipeline} pipeline Call StorageURL.newPipeline() to create a default

@@ -104,0 +108,0 @@ * pipeline, or provide a customized pipeline.

@@ -1,5 +0,5 @@

import { HttpResponse, isNode } from "ms-rest-js";
import { HttpResponse, isNode } from "@azure/ms-rest-js";
import { Aborter } from "./Aborter";
import * as Models from "./generated/models";
import * as Models from "./generated/lib/models";
import { IMetadata } from "./models";

@@ -6,0 +6,0 @@ import {

@@ -6,8 +6,8 @@ import {

TransferProgressEvent
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { Aborter } from "./Aborter";
import { DirectoryURL } from "./DirectoryURL";
import { FileDownloadResponse } from "./FileDownloadResponse";
import * as Models from "./generated/models";
import { File } from "./generated/operations";
import * as Models from "./generated/lib/models";
import { File } from "./generated/lib/operations";
import { IRange, rangeToString } from "./IRange";

@@ -164,4 +164,4 @@ import { IFileHTTPHeaders, IMetadata } from "./models";

* @static
* @param {DirectoryURL} directoryURL
* @param {string} fileName
* @param {DirectoryURL} directoryURL A DirectoryURL object
* @param {string} fileName A file name
* @returns

@@ -172,3 +172,3 @@ * @memberof FileURL

return new FileURL(
appendToURLPath(directoryURL.url, fileName),
appendToURLPath(directoryURL.url, encodeURIComponent(fileName)),
directoryURL.pipeline

@@ -194,2 +194,6 @@ );

* "https://myaccount.file.core.windows.net/myshare/mydirectory/file?sasString".
* This method accepts an encoded URL or non-encoded URL pointing to a file.
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
* However, if a file or directory name includes %, file or directory name must be encoded in the URL.
* Such as a file named "myfile%", the URL should be "https://myaccount.file.core.windows.net/myshare/mydirectory/myfile%25".
* @param {Pipeline} pipeline Call StorageURL.newPipeline() to create a default

@@ -458,5 +462,7 @@ * pipeline, or provide a customized pipeline.

* goto documents of Aborter for more examples about request cancellation
* @param {HttpRequestBody} body
* @param {number} offset
* @param {number} contentLength
* @param {HttpRequestBody} body Blob, string, ArrayBuffer, ArrayBufferView or a function
* which returns a new Readable stream whose offset is from data source beginning.
* @param {number} offset Offset position of the destination Azure File to upload.
* @param {number} contentLength Length of body in bytes. Use Buffer.byteLength() to calculate body length for a
* string including non non-Base64/Hex-encoded characters.
* @param {IFileUploadRangeOptions} [options]

@@ -485,3 +491,3 @@ * @returns {Promise<Models.FileUploadRangeResponse>}

rangeToString({ count: contentLength, offset }),
Models.FileRangeWriteType.Update,
"update",
contentLength,

@@ -519,3 +525,3 @@ {

rangeToString({ count: contentLength, offset }),
Models.FileRangeWriteType.Clear,
"clear",
0,

@@ -522,0 +528,0 @@ {

@@ -1,2 +0,2 @@

import { TransferProgressEvent } from "ms-rest-js";
import { TransferProgressEvent } from "@azure/ms-rest-js";

@@ -3,0 +3,0 @@ import { IFileHTTPHeaders, IMetadata } from "./models";

import * as fs from "fs";
import { TransferProgressEvent } from "ms-rest-js";
import { TransferProgressEvent } from "@azure/ms-rest-js";
import { Readable } from "stream";

@@ -4,0 +4,0 @@ import { Aborter } from "./Aborter";

@@ -1,4 +0,4 @@

import { RestError } from "ms-rest-js";
import { RestError } from "@azure/ms-rest-js";
import * as Models from "../lib/generated/models";
import * as Models from "../lib/generated/lib/models";

@@ -23,5 +23,4 @@ export * from "./Aborter";

export * from "./BrowserPolicyFactory";
export * from "./SASQueryParameters";
export * from "./ServiceURL";
export * from "./StorageURL";
export { Models, RestError };

@@ -1,4 +0,4 @@

import { RestError } from "ms-rest-js";
import { RestError } from "@azure/ms-rest-js";
import * as Models from "../lib/generated/models";
import * as Models from "../lib/generated/lib/models";

@@ -35,2 +35,3 @@ export * from "./Aborter";

export * from "./StorageURL";
export * from "./SASQueryParameters";
export { Models, RestError };

@@ -5,3 +5,3 @@ import {

RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -8,0 +8,0 @@ import { LoggingPolicy } from "./policies/LoggingPolicy";

@@ -8,2 +8,3 @@ import {

HttpPipelineLogLevel,
HttpRequestBody,
RequestPolicy,

@@ -14,3 +15,3 @@ RequestPolicyFactory,

WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -25,2 +26,3 @@ // Export following interfaces and types for customers who want to implement their

HttpOperationResponse,
HttpRequestBody,
WebResource,

@@ -27,0 +29,0 @@ BaseRequestPolicy,

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions } from "@azure/ms-rest-js";

@@ -3,0 +3,0 @@ import { CredentialPolicy } from "./CredentialPolicy";

@@ -8,3 +8,3 @@ import {

WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -11,0 +11,0 @@ import { HeaderConstants, URLConstants } from "../utils/constants";

@@ -5,3 +5,3 @@ import {

WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -8,0 +8,0 @@ /**

@@ -8,3 +8,3 @@ import {

WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -11,0 +11,0 @@ import { IRequestLogOptions } from "../LoggingPolicyFactory";

@@ -11,3 +11,3 @@ import {

WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -61,3 +61,3 @@ import { IRetryOptions } from "../RetryPolicyFactory";

retryPolicyType: RetryPolicyType.EXPONENTIAL,
tryTimeoutInMs: 60 * 1000
tryTimeoutInMs: undefined // Use server side default timeout strategy
};

@@ -166,7 +166,9 @@

// Set the server-side timeout query parameter "timeout=[seconds]"
newRequest.url = setURLParameter(
newRequest.url,
URLConstants.Parameters.TIMEOUT,
Math.floor(this.retryOptions.tryTimeoutInMs! / 1000).toString()
);
if (this.retryOptions.tryTimeoutInMs) {
newRequest.url = setURLParameter(
newRequest.url,
URLConstants.Parameters.TIMEOUT,
Math.floor(this.retryOptions.tryTimeoutInMs! / 1000).toString()
);
}

@@ -173,0 +175,0 @@ let response: HttpOperationResponse | undefined;

@@ -1,2 +0,6 @@

import { RequestPolicy, RequestPolicyOptions, WebResource } from "ms-rest-js";
import {
RequestPolicy,
RequestPolicyOptions,
WebResource
} from "@azure/ms-rest-js";
import { SharedKeyCredential } from "../credentials/SharedKeyCredential";

@@ -55,3 +59,6 @@ import { HeaderConstants } from "../utils/constants";

) {
request.headers.set(HeaderConstants.CONTENT_LENGTH, request.body.length);
request.headers.set(
HeaderConstants.CONTENT_LENGTH,
Buffer.byteLength(request.body)
);
}

@@ -180,3 +187,3 @@

private getCanonicalizedResourceString(request: WebResource): string {
const path = encodeURI(getURLPath(request.url) || "/");
const path = getURLPath(request.url) || "/";

@@ -183,0 +190,0 @@ let canonicalizedResourceString: string = "";

@@ -9,3 +9,3 @@ import {

WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -12,0 +12,0 @@ import { HeaderConstants } from "../utils/constants";

@@ -8,3 +8,3 @@ import {

WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -11,0 +11,0 @@ import { HeaderConstants } from "../utils/constants";

@@ -5,3 +5,3 @@ import {

RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";

@@ -8,0 +8,0 @@ import { RetryPolicy, RetryPolicyType } from "./policies/RetryPolicy";

@@ -1,4 +0,4 @@

import * as Models from "../lib/generated/models";
import * as Models from "../lib/generated/lib/models";
import { Aborter } from "./Aborter";
import { Service } from "./generated/operations";
import { Service } from "./generated/lib/operations";
import { Pipeline } from "./Pipeline";

@@ -5,0 +5,0 @@ import { StorageURL } from "./StorageURL";

@@ -1,6 +0,6 @@

import { HttpResponse } from "ms-rest-js";
import { HttpResponse } from "@azure/ms-rest-js";
import { Aborter } from "./Aborter";
import * as Models from "./generated/models";
import { Share } from "./generated/operations";
import * as Models from "./generated/lib/models";
import { Share } from "./generated/lib/operations";
import { IMetadata } from "./models";

@@ -7,0 +7,0 @@ import { Pipeline } from "./Pipeline";

@@ -1,6 +0,6 @@

import { deserializationPolicy, RequestPolicyFactory } from "ms-rest-js";
import { deserializationPolicy, RequestPolicyFactory } from "@azure/ms-rest-js";
import { BrowserPolicyFactory } from "./BrowserPolicyFactory";
import { Credential } from "./credentials/Credential";
import { StorageClientContext } from "./generated/storageClientContext";
import { StorageClientContext } from "./generated/lib/storageClientContext";
import { LoggingPolicyFactory } from "./LoggingPolicyFactory";

@@ -14,2 +14,3 @@ import { IHttpClient, IHttpPipelineLogger, Pipeline } from "./Pipeline";

import { UniqueRequestIDPolicyFactory } from "./UniqueRequestIDPolicyFactory";
import { escapeURLPath } from "./utils/utils.common";

@@ -111,6 +112,8 @@ export { deserializationPolicy };

protected constructor(url: string, pipeline: Pipeline) {
this.url = url;
// URL should be encoded and only once, protocol layer shouldn't encode URL again
this.url = escapeURLPath(url);
this.pipeline = pipeline;
this.storageClientContext = new StorageClientContext(
url,
this.url,
pipeline.toServiceClientOptions()

@@ -117,0 +120,0 @@ );

@@ -6,3 +6,3 @@ import {

RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import * as os from "os";

@@ -9,0 +9,0 @@

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "@azure/ms-rest-js";

@@ -3,0 +3,0 @@ import { UniqueRequestIDPolicy } from "./policies/UniqueRequestIDPolicy";

@@ -1,2 +0,2 @@

export const SDK_VERSION: string = "10.0.0-preview";
export const SDK_VERSION: string = "10.1.0";
export const SERVICE_VERSION: string = "2018-03-28";

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

import { RestError, TransferProgressEvent } from "ms-rest-js";
import { RestError, TransferProgressEvent } from "@azure/ms-rest-js";
import { Readable } from "stream";

@@ -3,0 +3,0 @@ import { Aborter } from "../Aborter";

@@ -1,4 +0,84 @@

import { isNode, URLBuilder } from "ms-rest-js";
import { isNode, URLBuilder } from "@azure/ms-rest-js";
/**
* Reserved URL characters must be properly escaped for Storage services like Blob or File.
*
* ## URL encode and escape strategy for JSv10 SDKs
*
* When customers pass a URL string into XXXURL classes constructor, the URL string may already be URL encoded or not.
* But before sending to Azure Storage server, the URL must be encoded. However, it's hard for a SDK to guess whether the URL
* string has been encoded or not. We have 2 potential strategies, and chose strategy two for the XXXURL constructors.
*
* ### Strategy One: Assume the customer URL string is not encoded, and always encode URL string in SDK.
*
* This is what legacy V2 SDK does, simple and works for most of the cases.
* - When customer URL string is "http://account.blob.core.windows.net/con/b:",
* SDK will encode it to "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created.
* - When customer URL string is "http://account.blob.core.windows.net/con/b%3A",
* SDK will encode it to "http://account.blob.core.windows.net/con/b%253A" and send to server. A blob named "b%3A" will be created.
*
* But this strategy will make it not possible to create a blob with "?" in it's name. Because when customer URL string is
* "http://account.blob.core.windows.net/con/blob?name", the "?name" will be treated as URL paramter instead of blob name.
* If customer URL string is "http://account.blob.core.windows.net/con/blob%3Fname", a blob named "blob%3Fname" will be created.
* V2 SDK doesn't have this issue because it doesn't allow customer pass in a full URL, it accepts a separate blob name and encodeURIComponent for it.
* We cannot accept a SDK cannot create a blob name with "?". So we implement strategy two:
*
* ### Strategy Two: SDK doesn't assume the URL has been encoded or not. It will just escape the special characters.
*
* This is what V10 Blob Go SDK does. It accepts a URL type in Go, and call url.EscapedPath() to escape the special chars unescaped.
* - When customer URL string is "http://account.blob.core.windows.net/con/b:",
* SDK will escape ":" like "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created.
* - When customer URL string is "http://account.blob.core.windows.net/con/b%3A",
* There is no special characters, so send "http://account.blob.core.windows.net/con/b%3A" to server. A blob named "b:" will be created.
* - When customer URL string is "http://account.blob.core.windows.net/con/b%253A",
* There is no special characters, so send "http://account.blob.core.windows.net/con/b%253A" to server. A blob named "b%3A" will be created.
*
* This strategy gives us flexibility to create with any special characters. But "%" will be treated as a special characters, if the URL string
* is not encoded, there shouldn't a "%" in the URL string, otherwise the URL is not a valid URL.
* If customer needs to create a blob with "%" in it's blob name, use "%25" insead of "%". Just like above 3rd sample.
* And following URL strings are invalid:
* - "http://account.blob.core.windows.net/con/b%"
* - "http://account.blob.core.windows.net/con/b%2"
* - "http://account.blob.core.windows.net/con/b%G"
*
* Another special character is "?", use "%2F" to represent a blob name with "?" in a URL string.
*
* ### Strategy for containerName, blobName or other specific XXXName parameters in methods such as `BlobURL.fromContainerURL(containerURL, blobName)`
*
* We will apply strategy one, and call encodeURIComponent for these parameters like blobName. Because what customers passes in is a plain name instead of a URL.
*
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata
*
* @export
* @param {string} url
* @returns {string}
*/
export function escapeURLPath(url: string): string {
const urlParsed = URLBuilder.parse(url);
let path = urlParsed.getPath();
path = path || "/";
path = escape(path);
urlParsed.setPath(path);
return urlParsed.toString();
}
/**
* Internal escape method implemented Strategy Two mentioned in escapeURL() description.
*
* @param {string} text
* @returns {string}
*/
function escape(text: string): string {
return encodeURIComponent(text)
.replace(/%2F/g, "/") // Don't escape for "/"
.replace(/'/g, "%27") // Escape for "'"
.replace(/\+/g, "%20")
.replace(/%25/g, "%"); // Revert encoded "%"
}
/**
* Append a string to URL path. Will remove duplicated "/" in front of the string

@@ -5,0 +85,0 @@ * when URL path ends with a "/".

{
"name": "@azure/storage-file",
"version": "10.0.0-preview",
"version": "10.1.0",
"description": "Microsoft Azure Storage SDK for JavaScript - File",

@@ -10,3 +10,3 @@ "main": "./dist/index.js",

"./dist-esm/lib/index.js": "./dist-esm/lib/index.browser.js",
"./dist-esm/test/utils/index.js": "./dist-esm/test/utils/index.browser.js",
"./dist-esm/tests/utils/index.js": "./dist-esm/tests/utils/index.browser.js",
"./dist-esm/lib/FileDownloadResponse.js": "./dist-esm/lib/FileDownloadResponse.browser.js",

@@ -22,3 +22,3 @@ "os": false,

"events": "3.0.0",
"ms-rest-js": "0.22.425",
"@azure/ms-rest-js": "1.2.6",
"tslib": "^1.9.3"

@@ -28,4 +28,5 @@ },

"@types/mocha": "^5.2.5",
"@types/node": "^10.12.9",
"@types/node": "^10.12.18",
"assert": "^1.4.1",
"cross-env": "^5.2.0",
"es6-promise": "^4.2.5",

@@ -36,2 +37,3 @@ "gulp": "^4.0.0",

"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.2",
"karma-edge-launcher": "^0.4.2",

@@ -41,20 +43,28 @@ "karma-env-preprocessor": "^0.1.1",

"karma-ie-launcher": "^1.0.0",
"karma-junit-reporter": "^1.2.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-remap-coverage": "^0.1.5",
"mocha": "^5.2.0",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi-reporters": "^1.1.7",
"nyc": "^13.1.0",
"puppeteer": "^1.11.0",
"rimraf": "^2.6.2",
"rollup": "^0.65.2",
"rollup-plugin-commonjs": "^9.1.8",
"rollup-plugin-multi-entry": "^2.0.2",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-replace": "^2.0.0",
"rollup": "^1.0.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-multi-entry": "^2.1.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-shim": "^1.0.0",
"rollup-plugin-uglify": "^5.0.2",
"rollup-plugin-visualizer": "^0.9.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-uglify": "^6.0.0",
"rollup-plugin-visualizer": "^0.9.2",
"source-map-support": "^0.5.9",
"ts-node": "^7.0.1",
"typescript": "^3.1.6"
"typescript": "^3.2.2"
},
"scripts": {
"test": "npm run test:node && npm run test:browser",
"test:node": "mocha --no-timeouts dist-test/index.js",
"test:node": "cross-env TS_NODE_COMPILER_OPTIONS=\"{\\\"module\\\": \\\"commonjs\\\"}\" nyc mocha --compilers ts-node/register --require source-map-support/register --reporter mocha-multi-reporters --reporter-options configFile=mocha.reporter.config.json --full-trace --no-timeouts tests/*.test.ts tests/node/*.test.ts",
"test:browser": "karma start --single-run",

@@ -65,5 +75,5 @@ "build": "npm run build:es6 && npm run build:nodebrowser && npm run build:browserzip && npm run build:test",

"build:es6": "tsc -p tsconfig.json",
"build:autorest": "autorest ./swagger/README.md --typescript --use=@microsoft.azure/autorest.typescript@2.0.476",
"build:autorest": "autorest ./swagger/README.md --typescript --use=@microsoft.azure/autorest.typescript@2.2.1",
"build:browserzip": "gulp zip",
"clean": "rimraf dist dist-esm dist-test typings temp browser/*.js* browser/*.zip statistics.html"
"clean": "rimraf dist dist-esm dist-test typings temp browser/*.js* browser/*.zip statistics.html coverage coverage-browser .nyc_output *.tgz *.log test*.xml TEST*.xml"
},

@@ -70,0 +80,0 @@ "repository": {

@@ -32,3 +32,3 @@ # Azure Storage SDK V10 for JavaScript - File

Or you can load separate polyfills for missed ES feature(s).
This library depends on following ES6 features which need external polyfills loaded.
This library depends on following ES features which need external polyfills loaded.

@@ -40,2 +40,4 @@ * `Promise`

* `String.prototype.includes`
* `Array.prototype.includes`
* `Object.keys` (Override IE11's `Object.keys` with ES6 polyfill forcely to enable [ES6 behavior](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys#Notes))

@@ -42,0 +44,0 @@ #### Differences between Node.js and browsers

@@ -1,2 +0,2 @@

import { AbortSignalLike } from "ms-rest-js";
import { AbortSignalLike } from "@azure/ms-rest-js";
/**

@@ -61,7 +61,7 @@ * An aborter instance implements AbortSignal interface, can abort HTTP requests.

/**
* Creates a new Aborter instance with timeout in million-seconds.
* Creates a new Aborter instance with timeout in milliseconds.
* Set parameter timeout to 0 will not create a timer.
*
* @static
* @param {number} {timeout} in million-seconds
* @param {number} {timeout} in milliseconds
* @returns {Aborter}

@@ -76,3 +76,3 @@ * @memberof Aborter

*/
onabort?: ((ev: Event) => any);
onabort?: ((ev?: Event) => any);
private _aborted;

@@ -79,0 +79,0 @@ private timer?;

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "@azure/ms-rest-js";
import { BrowserPolicy } from "./policies/BrowserPolicy";

@@ -3,0 +3,0 @@ /**

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions } from "@azure/ms-rest-js";
import { AnonymousCredentialPolicy } from "../policies/AnonymousCredentialPolicy";

@@ -3,0 +3,0 @@ import { Credential } from "./Credential";

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "@azure/ms-rest-js";
import { CredentialPolicy } from "../policies/CredentialPolicy";

@@ -3,0 +3,0 @@ /**

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions } from "@azure/ms-rest-js";
import { SharedKeyCredentialPolicy } from "../policies/SharedKeyCredentialPolicy";

@@ -3,0 +3,0 @@ import { Credential } from "./Credential";

import { Aborter } from "./Aborter";
import * as Models from "./generated/models";
import * as Models from "./generated/lib/models";
import { IMetadata } from "./models";

@@ -45,13 +45,13 @@ import { Pipeline } from "./Pipeline";

/**
* Creates a DirectoryURL object from ShareURL
* Creates a DirectoryURL object from ShareURL.
*
* @param shareURL
* @param directoryName
* @param shareURL A ShareURL object
* @param directoryName A directory name
*/
static fromShareURL(shareURL: ShareURL, directoryName: string): DirectoryURL;
/**
* Creates a DirectoryURL object from an existing DirectoryURL
* Creates a DirectoryURL object from an existing DirectoryURL.
*
* @param directoryURL
* @param directoryName
* @param directoryURL A DirectoryURL object
* @param directoryName A subdirectory name
*/

@@ -74,2 +74,6 @@ static fromDirectoryURL(directoryURL: DirectoryURL, directoryName: string): DirectoryURL;

* "https://myaccount.file.core.windows.net/myshare/mydirectory?sasString".
* This method accepts an encoded URL or non-encoded URL pointing to a directory.
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
* However, if a directory name includes %, directory name must be encoded in the URL.
* Such as a directory named "mydir%", the URL should be "https://myaccount.file.core.windows.net/myshare/mydir%25".
* @param {Pipeline} pipeline Call StorageURL.newPipeline() to create a default

@@ -76,0 +80,0 @@ * pipeline, or provide a customized pipeline.

/// <reference types="node" />
import { HttpResponse } from "ms-rest-js";
import { HttpResponse } from "@azure/ms-rest-js";
import { Aborter } from "./Aborter";
import * as Models from "./generated/models";
import * as Models from "./generated/lib/models";
import { IMetadata } from "./models";

@@ -6,0 +6,0 @@ import { ReadableStreamGetter, IRetriableReadableStreamOptions } from "./utils/RetriableReadableStream";

@@ -1,5 +0,5 @@

import { HttpRequestBody, HttpResponse, TransferProgressEvent } from "ms-rest-js";
import { HttpRequestBody, HttpResponse, TransferProgressEvent } from "@azure/ms-rest-js";
import { Aborter } from "./Aborter";
import { DirectoryURL } from "./DirectoryURL";
import * as Models from "./generated/models";
import * as Models from "./generated/lib/models";
import { IRange } from "./IRange";

@@ -138,4 +138,4 @@ import { IFileHTTPHeaders, IMetadata } from "./models";

* @static
* @param {DirectoryURL} directoryURL
* @param {string} fileName
* @param {DirectoryURL} directoryURL A DirectoryURL object
* @param {string} fileName A file name
* @returns

@@ -160,2 +160,6 @@ * @memberof FileURL

* "https://myaccount.file.core.windows.net/myshare/mydirectory/file?sasString".
* This method accepts an encoded URL or non-encoded URL pointing to a file.
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
* However, if a file or directory name includes %, file or directory name must be encoded in the URL.
* Such as a file named "myfile%", the URL should be "https://myaccount.file.core.windows.net/myshare/mydirectory/myfile%25".
* @param {Pipeline} pipeline Call StorageURL.newPipeline() to create a default

@@ -284,5 +288,7 @@ * pipeline, or provide a customized pipeline.

* goto documents of Aborter for more examples about request cancellation
* @param {HttpRequestBody} body
* @param {number} offset
* @param {number} contentLength
* @param {HttpRequestBody} body Blob, string, ArrayBuffer, ArrayBufferView or a function
* which returns a new Readable stream whose offset is from data source beginning.
* @param {number} offset Offset position of the destination Azure File to upload.
* @param {number} contentLength Length of body in bytes. Use Buffer.byteLength() to calculate body length for a
* string including non non-Base64/Hex-encoded characters.
* @param {IFileUploadRangeOptions} [options]

@@ -289,0 +295,0 @@ * @returns {Promise<Models.FileUploadRangeResponse>}

@@ -1,2 +0,2 @@

import { TransferProgressEvent } from "ms-rest-js";
import { TransferProgressEvent } from "@azure/ms-rest-js";
import { IFileHTTPHeaders, IMetadata } from "./models";

@@ -3,0 +3,0 @@ /**

/// <reference types="node" />
import { TransferProgressEvent } from "ms-rest-js";
import { TransferProgressEvent } from "@azure/ms-rest-js";
import { Readable } from "stream";

@@ -4,0 +4,0 @@ import { Aborter } from "./Aborter";

@@ -1,3 +0,3 @@

import { RestError } from "ms-rest-js";
import * as Models from "../lib/generated/models";
import { RestError } from "@azure/ms-rest-js";
import * as Models from "../lib/generated/lib/models";
export * from "./Aborter";

@@ -21,3 +21,2 @@ export * from "./ShareURL";

export * from "./BrowserPolicyFactory";
export * from "./SASQueryParameters";
export * from "./ServiceURL";

@@ -24,0 +23,0 @@ export * from "./StorageURL";

@@ -1,3 +0,3 @@

import { RestError } from "ms-rest-js";
import * as Models from "../lib/generated/models";
import { RestError } from "@azure/ms-rest-js";
import * as Models from "../lib/generated/lib/models";
export * from "./Aborter";

@@ -33,3 +33,4 @@ export * from "./AccountSASPermissions";

export * from "./StorageURL";
export * from "./SASQueryParameters";
export { Models, RestError };
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "@azure/ms-rest-js";
import { LoggingPolicy } from "./policies/LoggingPolicy";

@@ -3,0 +3,0 @@ /**

@@ -1,3 +0,3 @@

import { BaseRequestPolicy, HttpClient as IHttpClient, HttpHeaders, HttpOperationResponse, HttpPipelineLogger as IHttpPipelineLogger, HttpPipelineLogLevel, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions, ServiceClientOptions, WebResource } from "ms-rest-js";
export { IHttpClient, IHttpPipelineLogger, HttpHeaders, HttpPipelineLogLevel, HttpOperationResponse, WebResource, BaseRequestPolicy, RequestPolicyFactory, RequestPolicy, RequestPolicyOptions };
import { BaseRequestPolicy, HttpClient as IHttpClient, HttpHeaders, HttpOperationResponse, HttpPipelineLogger as IHttpPipelineLogger, HttpPipelineLogLevel, HttpRequestBody, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions, ServiceClientOptions, WebResource } from "@azure/ms-rest-js";
export { IHttpClient, IHttpPipelineLogger, HttpHeaders, HttpPipelineLogLevel, HttpOperationResponse, HttpRequestBody, WebResource, BaseRequestPolicy, RequestPolicyFactory, RequestPolicy, RequestPolicyOptions };
/**

@@ -4,0 +4,0 @@ * Option interface for Pipeline constructor.

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions } from "@azure/ms-rest-js";
import { CredentialPolicy } from "./CredentialPolicy";

@@ -3,0 +3,0 @@ /**

@@ -1,2 +0,2 @@

import { BaseRequestPolicy, HttpOperationResponse, RequestPolicy, RequestPolicyOptions, WebResource } from "ms-rest-js";
import { BaseRequestPolicy, HttpOperationResponse, RequestPolicy, RequestPolicyOptions, WebResource } from "@azure/ms-rest-js";
/**

@@ -3,0 +3,0 @@ * BrowserPolicy will handle differences between Node.js and browser runtime, including:

@@ -1,2 +0,2 @@

import { BaseRequestPolicy, HttpOperationResponse, WebResource } from "ms-rest-js";
import { BaseRequestPolicy, HttpOperationResponse, WebResource } from "@azure/ms-rest-js";
/**

@@ -3,0 +3,0 @@ * Credential policy used to sign HTTP(S) requests before sending. This is an

@@ -1,2 +0,2 @@

import { BaseRequestPolicy, HttpOperationResponse, RequestPolicy, RequestPolicyOptions, WebResource } from "ms-rest-js";
import { BaseRequestPolicy, HttpOperationResponse, RequestPolicy, RequestPolicyOptions, WebResource } from "@azure/ms-rest-js";
import { IRequestLogOptions } from "../LoggingPolicyFactory";

@@ -3,0 +3,0 @@ /**

@@ -1,2 +0,2 @@

import { BaseRequestPolicy, HttpOperationResponse, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions, RestError, WebResource } from "ms-rest-js";
import { BaseRequestPolicy, HttpOperationResponse, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions, RestError, WebResource } from "@azure/ms-rest-js";
import { IRetryOptions } from "../RetryPolicyFactory";

@@ -3,0 +3,0 @@ /**

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyOptions, WebResource } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions, WebResource } from "@azure/ms-rest-js";
import { SharedKeyCredential } from "../credentials/SharedKeyCredential";

@@ -3,0 +3,0 @@ import { CredentialPolicy } from "./CredentialPolicy";

@@ -1,2 +0,2 @@

import { BaseRequestPolicy, HttpOperationResponse, RequestPolicy, RequestPolicyOptions, WebResource } from "ms-rest-js";
import { BaseRequestPolicy, HttpOperationResponse, RequestPolicy, RequestPolicyOptions, WebResource } from "@azure/ms-rest-js";
/**

@@ -3,0 +3,0 @@ * TelemetryPolicy is a policy used to tag user-agent header for every requests.

@@ -1,2 +0,2 @@

import { BaseRequestPolicy, HttpOperationResponse, RequestPolicy, RequestPolicyOptions, WebResource } from "ms-rest-js";
import { BaseRequestPolicy, HttpOperationResponse, RequestPolicy, RequestPolicyOptions, WebResource } from "@azure/ms-rest-js";
/**

@@ -3,0 +3,0 @@ * UniqueRequestIDPolicy generates an UUID as x-ms-request-id header value.

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "@azure/ms-rest-js";
import { RetryPolicy, RetryPolicyType } from "./policies/RetryPolicy";

@@ -3,0 +3,0 @@ /**

@@ -1,2 +0,2 @@

import * as Models from "../lib/generated/models";
import * as Models from "../lib/generated/lib/models";
import { Aborter } from "./Aborter";

@@ -3,0 +3,0 @@ import { Pipeline } from "./Pipeline";

@@ -1,4 +0,4 @@

import { HttpResponse } from "ms-rest-js";
import { HttpResponse } from "@azure/ms-rest-js";
import { Aborter } from "./Aborter";
import * as Models from "./generated/models";
import * as Models from "./generated/lib/models";
import { IMetadata } from "./models";

@@ -5,0 +5,0 @@ import { Pipeline } from "./Pipeline";

@@ -1,4 +0,4 @@

import { deserializationPolicy } from "ms-rest-js";
import { deserializationPolicy } from "@azure/ms-rest-js";
import { Credential } from "./credentials/Credential";
import { StorageClientContext } from "./generated/storageClientContext";
import { StorageClientContext } from "./generated/lib/storageClientContext";
import { IHttpClient, IHttpPipelineLogger, Pipeline } from "./Pipeline";

@@ -5,0 +5,0 @@ import { IRetryOptions } from "./RetryPolicyFactory";

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "@azure/ms-rest-js";
import { TelemetryPolicy } from "./policies/TelemetryPolicy";

@@ -3,0 +3,0 @@ /**

@@ -1,2 +0,2 @@

import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "@azure/ms-rest-js";
import { UniqueRequestIDPolicy } from "./policies/UniqueRequestIDPolicy";

@@ -3,0 +3,0 @@ /**

/// <reference types="node" />
import { TransferProgressEvent } from "ms-rest-js";
import { TransferProgressEvent } from "@azure/ms-rest-js";
import { Readable } from "stream";

@@ -4,0 +4,0 @@ import { Aborter } from "../Aborter";

/**
* Reserved URL characters must be properly escaped for Storage services like Blob or File.
*
* ## URL encode and escape strategy for JSv10 SDKs
*
* When customers pass a URL string into XXXURL classes constructor, the URL string may already be URL encoded or not.
* But before sending to Azure Storage server, the URL must be encoded. However, it's hard for a SDK to guess whether the URL
* string has been encoded or not. We have 2 potential strategies, and chose strategy two for the XXXURL constructors.
*
* ### Strategy One: Assume the customer URL string is not encoded, and always encode URL string in SDK.
*
* This is what legacy V2 SDK does, simple and works for most of the cases.
* - When customer URL string is "http://account.blob.core.windows.net/con/b:",
* SDK will encode it to "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created.
* - When customer URL string is "http://account.blob.core.windows.net/con/b%3A",
* SDK will encode it to "http://account.blob.core.windows.net/con/b%253A" and send to server. A blob named "b%3A" will be created.
*
* But this strategy will make it not possible to create a blob with "?" in it's name. Because when customer URL string is
* "http://account.blob.core.windows.net/con/blob?name", the "?name" will be treated as URL paramter instead of blob name.
* If customer URL string is "http://account.blob.core.windows.net/con/blob%3Fname", a blob named "blob%3Fname" will be created.
* V2 SDK doesn't have this issue because it doesn't allow customer pass in a full URL, it accepts a separate blob name and encodeURIComponent for it.
* We cannot accept a SDK cannot create a blob name with "?". So we implement strategy two:
*
* ### Strategy Two: SDK doesn't assume the URL has been encoded or not. It will just escape the special characters.
*
* This is what V10 Blob Go SDK does. It accepts a URL type in Go, and call url.EscapedPath() to escape the special chars unescaped.
* - When customer URL string is "http://account.blob.core.windows.net/con/b:",
* SDK will escape ":" like "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created.
* - When customer URL string is "http://account.blob.core.windows.net/con/b%3A",
* There is no special characters, so send "http://account.blob.core.windows.net/con/b%3A" to server. A blob named "b:" will be created.
* - When customer URL string is "http://account.blob.core.windows.net/con/b%253A",
* There is no special characters, so send "http://account.blob.core.windows.net/con/b%253A" to server. A blob named "b%3A" will be created.
*
* This strategy gives us flexibility to create with any special characters. But "%" will be treated as a special characters, if the URL string
* is not encoded, there shouldn't a "%" in the URL string, otherwise the URL is not a valid URL.
* If customer needs to create a blob with "%" in it's blob name, use "%25" insead of "%". Just like above 3rd sample.
* And following URL strings are invalid:
* - "http://account.blob.core.windows.net/con/b%"
* - "http://account.blob.core.windows.net/con/b%2"
* - "http://account.blob.core.windows.net/con/b%G"
*
* Another special character is "?", use "%2F" to represent a blob name with "?" in a URL string.
*
* ### Strategy for containerName, blobName or other specific XXXName parameters in methods such as `BlobURL.fromContainerURL(containerURL, blobName)`
*
* We will apply strategy one, and call encodeURIComponent for these parameters like blobName. Because what customers passes in is a plain name instead of a URL.
*
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata
*
* @export
* @param {string} url
* @returns {string}
*/
export declare function escapeURLPath(url: string): string;
/**
* Append a string to URL path. Will remove duplicated "/" in front of the string

@@ -3,0 +58,0 @@ * when URL path ends with a "/".

Sorry, the diff of this file is too big to display

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc