@azure/storage-file-datalake
Advanced tools
Comparing version 12.5.0 to 12.6.0-alpha.20210707.1
# Release History | ||
## 12.6.0 (Unreleased) | ||
### Features Added | ||
- With the dropping of support for Node.js versions that are no longer in LTS, the dependency on `@types/node` has been updated to version 12. Read our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. | ||
- Changed TS compilation target to ES2017 in order to produce smaller bundles and use more native platform features | ||
### Breaking Changes | ||
### Key Bugs Fixed | ||
### Fixed | ||
## 12.5.0 (2021-06-09) | ||
@@ -63,3 +75,3 @@ | ||
## 12.1.0-preview.1 (2020.07) | ||
## 12.1.0-preview.1 (2020-07-03) | ||
@@ -70,3 +82,3 @@ - Increased the maximum block size for file from 100MiB to 4000MiB(~4GB). And thereby supporting ~200TB maximum size for file. | ||
## 12.0.1 (2020.05) | ||
## 12.0.1 (2020-05-20) | ||
@@ -78,3 +90,3 @@ - Fix data corruption failure error [issue #6411](https://github.com/Azure/azure-sdk-for-js/issues/6411) when downloading compressed files. [PR #7993](https://github.com/Azure/azure-sdk-for-js/pull/7993) | ||
## 12.0.0 (2020.03) | ||
## 12.0.0 (2020-03-12) | ||
@@ -84,3 +96,3 @@ - Added exists() on `FileSystemClient` and `PathClient`. | ||
## 12.0.0-preview.8 (2020.02) | ||
## 12.0.0-preview.8 (2020-02-12) | ||
@@ -90,3 +102,3 @@ - Updated Azure Storage Service API version to 2019-07-07. | ||
## 12.0.0-preview.7 (2020.01) | ||
## 12.0.0-preview.7 (2020-01-09) | ||
@@ -93,0 +105,0 @@ - Bug fix - Name properties on clients now support more kinds of endpoints(IPv4/v6 hosts, single word domains). [PR #6753](https://github.com/Azure/azure-sdk-for-js/pull/6753) |
@@ -6,8 +6,4 @@ // Copyright (c) Microsoft Corporation. | ||
// "BufferScheduler" class is only available in Node.js runtime | ||
var BufferScheduler = /** @class */ (function () { | ||
function BufferScheduler() { | ||
} | ||
return BufferScheduler; | ||
}()); | ||
export { BufferScheduler }; | ||
export class BufferScheduler { | ||
} | ||
//# sourceMappingURL=BufferScheduler.browser.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __awaiter, __generator } from "tslib"; | ||
import { EventEmitter } from "events"; | ||
@@ -28,3 +27,3 @@ import { PooledBuffer } from "./PooledBuffer"; | ||
*/ | ||
var BufferScheduler = /** @class */ (function () { | ||
export class BufferScheduler { | ||
/** | ||
@@ -42,3 +41,3 @@ * Creates an instance of BufferScheduler. | ||
*/ | ||
function BufferScheduler(readable, bufferSize, maxBuffers, outgoingHandler, concurrency, encoding) { | ||
constructor(readable, bufferSize, maxBuffers, outgoingHandler, concurrency, encoding) { | ||
/** | ||
@@ -89,9 +88,9 @@ * An internal event emitter. | ||
if (bufferSize <= 0) { | ||
throw new RangeError("bufferSize must be larger than 0, current is " + bufferSize); | ||
throw new RangeError(`bufferSize must be larger than 0, current is ${bufferSize}`); | ||
} | ||
if (maxBuffers <= 0) { | ||
throw new RangeError("maxBuffers must be larger than 0, current is " + maxBuffers); | ||
throw new RangeError(`maxBuffers must be larger than 0, current is ${maxBuffers}`); | ||
} | ||
if (concurrency <= 0) { | ||
throw new RangeError("concurrency must be larger than 0, current is " + concurrency); | ||
throw new RangeError(`concurrency must be larger than 0, current is ${concurrency}`); | ||
} | ||
@@ -110,50 +109,45 @@ this.bufferSize = bufferSize; | ||
*/ | ||
BufferScheduler.prototype.do = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.readable.on("data", function (data) { | ||
data = typeof data === "string" ? Buffer.from(data, _this.encoding) : data; | ||
_this.appendUnresolvedData(data); | ||
if (!_this.resolveData()) { | ||
_this.readable.pause(); | ||
} | ||
}); | ||
_this.readable.on("error", function (err) { | ||
_this.emitter.emit("error", err); | ||
}); | ||
_this.readable.on("end", function () { | ||
_this.isStreamEnd = true; | ||
_this.emitter.emit("checkEnd"); | ||
}); | ||
_this.emitter.on("error", function (err) { | ||
_this.isError = true; | ||
_this.readable.pause(); | ||
reject(err); | ||
}); | ||
_this.emitter.on("checkEnd", function () { | ||
if (_this.outgoing.length > 0) { | ||
_this.triggerOutgoingHandlers(); | ||
return; | ||
} | ||
if (_this.isStreamEnd && _this.executingOutgoingHandlers === 0) { | ||
if (_this.unresolvedLength > 0 && _this.unresolvedLength < _this.bufferSize) { | ||
var buffer_1 = _this.shiftBufferFromUnresolvedDataArray(); | ||
_this.outgoingHandler(function () { return buffer_1.getReadableStream(); }, buffer_1.size, _this.offset) | ||
.then(resolve) | ||
.catch(reject); | ||
} | ||
else if (_this.unresolvedLength >= _this.bufferSize) { | ||
return; | ||
} | ||
else { | ||
resolve(); | ||
} | ||
} | ||
}); | ||
})]; | ||
async do() { | ||
return new Promise((resolve, reject) => { | ||
this.readable.on("data", (data) => { | ||
data = typeof data === "string" ? Buffer.from(data, this.encoding) : data; | ||
this.appendUnresolvedData(data); | ||
if (!this.resolveData()) { | ||
this.readable.pause(); | ||
} | ||
}); | ||
this.readable.on("error", (err) => { | ||
this.emitter.emit("error", err); | ||
}); | ||
this.readable.on("end", () => { | ||
this.isStreamEnd = true; | ||
this.emitter.emit("checkEnd"); | ||
}); | ||
this.emitter.on("error", (err) => { | ||
this.isError = true; | ||
this.readable.pause(); | ||
reject(err); | ||
}); | ||
this.emitter.on("checkEnd", () => { | ||
if (this.outgoing.length > 0) { | ||
this.triggerOutgoingHandlers(); | ||
return; | ||
} | ||
if (this.isStreamEnd && this.executingOutgoingHandlers === 0) { | ||
if (this.unresolvedLength > 0 && this.unresolvedLength < this.bufferSize) { | ||
const buffer = this.shiftBufferFromUnresolvedDataArray(); | ||
this.outgoingHandler(() => buffer.getReadableStream(), buffer.size, this.offset) | ||
.then(resolve) | ||
.catch(reject); | ||
} | ||
else if (this.unresolvedLength >= this.bufferSize) { | ||
return; | ||
} | ||
else { | ||
resolve(); | ||
} | ||
} | ||
}); | ||
}); | ||
}; | ||
} | ||
/** | ||
@@ -164,6 +158,6 @@ * Insert a new data into unresolved array. | ||
*/ | ||
BufferScheduler.prototype.appendUnresolvedData = function (data) { | ||
appendUnresolvedData(data) { | ||
this.unresolvedDataArray.push(data); | ||
this.unresolvedLength += data.length; | ||
}; | ||
} | ||
/** | ||
@@ -174,3 +168,3 @@ * Try to shift a buffer with size in blockSize. The buffer returned may be less | ||
*/ | ||
BufferScheduler.prototype.shiftBufferFromUnresolvedDataArray = function (buffer) { | ||
shiftBufferFromUnresolvedDataArray(buffer) { | ||
if (!buffer) { | ||
@@ -184,3 +178,3 @@ buffer = new PooledBuffer(this.bufferSize, this.unresolvedDataArray, this.unresolvedLength); | ||
return buffer; | ||
}; | ||
} | ||
/** | ||
@@ -195,5 +189,5 @@ * Resolve data in unresolvedDataArray. For every buffer with size in blockSize | ||
*/ | ||
BufferScheduler.prototype.resolveData = function () { | ||
resolveData() { | ||
while (this.unresolvedLength >= this.bufferSize) { | ||
var buffer = void 0; | ||
let buffer; | ||
if (this.incoming.length > 0) { | ||
@@ -217,3 +211,3 @@ buffer = this.incoming.shift(); | ||
return true; | ||
}; | ||
} | ||
/** | ||
@@ -223,19 +217,14 @@ * Try to trigger a outgoing handler for every buffer in outgoing. Stop when | ||
*/ | ||
BufferScheduler.prototype.triggerOutgoingHandlers = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var buffer; | ||
return __generator(this, function (_a) { | ||
do { | ||
if (this.executingOutgoingHandlers >= this.concurrency) { | ||
return [2 /*return*/]; | ||
} | ||
buffer = this.outgoing.shift(); | ||
if (buffer) { | ||
this.triggerOutgoingHandler(buffer); | ||
} | ||
} while (buffer); | ||
return [2 /*return*/]; | ||
}); | ||
}); | ||
}; | ||
async triggerOutgoingHandlers() { | ||
let buffer; | ||
do { | ||
if (this.executingOutgoingHandlers >= this.concurrency) { | ||
return; | ||
} | ||
buffer = this.outgoing.shift(); | ||
if (buffer) { | ||
this.triggerOutgoingHandler(buffer); | ||
} | ||
} while (buffer); | ||
} | ||
/** | ||
@@ -246,31 +235,17 @@ * Trigger a outgoing handler for a buffer shifted from outgoing. | ||
*/ | ||
BufferScheduler.prototype.triggerOutgoingHandler = function (buffer) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var bufferLength, err_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
bufferLength = buffer.size; | ||
this.executingOutgoingHandlers++; | ||
this.offset += bufferLength; | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.outgoingHandler(function () { return buffer.getReadableStream(); }, bufferLength, this.offset - bufferLength)]; | ||
case 2: | ||
_a.sent(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
err_1 = _a.sent(); | ||
this.emitter.emit("error", err_1); | ||
return [2 /*return*/]; | ||
case 4: | ||
this.executingOutgoingHandlers--; | ||
this.reuseBuffer(buffer); | ||
this.emitter.emit("checkEnd"); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
async triggerOutgoingHandler(buffer) { | ||
const bufferLength = buffer.size; | ||
this.executingOutgoingHandlers++; | ||
this.offset += bufferLength; | ||
try { | ||
await this.outgoingHandler(() => buffer.getReadableStream(), bufferLength, this.offset - bufferLength); | ||
} | ||
catch (err) { | ||
this.emitter.emit("error", err); | ||
return; | ||
} | ||
this.executingOutgoingHandlers--; | ||
this.reuseBuffer(buffer); | ||
this.emitter.emit("checkEnd"); | ||
} | ||
/** | ||
@@ -281,3 +256,3 @@ * Return buffer used by outgoing handler into incoming. | ||
*/ | ||
BufferScheduler.prototype.reuseBuffer = function (buffer) { | ||
reuseBuffer(buffer) { | ||
this.incoming.push(buffer); | ||
@@ -287,6 +262,4 @@ if (!this.isError && this.resolveData() && !this.isStreamEnd) { | ||
} | ||
}; | ||
return BufferScheduler; | ||
}()); | ||
export { BufferScheduler }; | ||
} | ||
} | ||
//# sourceMappingURL=BufferScheduler.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __extends } from "tslib"; | ||
import { Readable } from "stream"; | ||
@@ -8,4 +7,3 @@ /** | ||
*/ | ||
var BuffersStream = /** @class */ (function (_super) { | ||
__extends(BuffersStream, _super); | ||
export class BuffersStream extends Readable { | ||
/** | ||
@@ -18,19 +16,17 @@ * Creates an instance of BuffersStream that will emit the data | ||
*/ | ||
function BuffersStream(buffers, byteLength, options) { | ||
var _this = _super.call(this, options) || this; | ||
_this.buffers = buffers; | ||
_this.byteLength = byteLength; | ||
_this.byteOffsetInCurrentBuffer = 0; | ||
_this.bufferIndex = 0; | ||
_this.pushedBytesLength = 0; | ||
constructor(buffers, byteLength, options) { | ||
super(options); | ||
this.buffers = buffers; | ||
this.byteLength = byteLength; | ||
this.byteOffsetInCurrentBuffer = 0; | ||
this.bufferIndex = 0; | ||
this.pushedBytesLength = 0; | ||
// check byteLength is no larger than buffers[] total length | ||
var buffersLength = 0; | ||
for (var _i = 0, _a = _this.buffers; _i < _a.length; _i++) { | ||
var buf = _a[_i]; | ||
let buffersLength = 0; | ||
for (const buf of this.buffers) { | ||
buffersLength += buf.byteLength; | ||
} | ||
if (buffersLength < _this.byteLength) { | ||
if (buffersLength < this.byteLength) { | ||
throw new Error("Data size shouldn't be larger than the total length of buffers."); | ||
} | ||
return _this; | ||
} | ||
@@ -42,3 +38,3 @@ /** | ||
*/ | ||
BuffersStream.prototype._read = function (size) { | ||
_read(size) { | ||
if (this.pushedBytesLength >= this.byteLength) { | ||
@@ -50,12 +46,12 @@ this.push(null); | ||
} | ||
var outBuffers = []; | ||
var i = 0; | ||
const outBuffers = []; | ||
let i = 0; | ||
while (i < size && this.pushedBytesLength < this.byteLength) { | ||
// The last buffer may be longer than the data it contains. | ||
var remainingDataInAllBuffers = this.byteLength - this.pushedBytesLength; | ||
var remainingCapacityInThisBuffer = this.buffers[this.bufferIndex].byteLength - this.byteOffsetInCurrentBuffer; | ||
var remaining = Math.min(remainingCapacityInThisBuffer, remainingDataInAllBuffers); | ||
const remainingDataInAllBuffers = this.byteLength - this.pushedBytesLength; | ||
const remainingCapacityInThisBuffer = this.buffers[this.bufferIndex].byteLength - this.byteOffsetInCurrentBuffer; | ||
const remaining = Math.min(remainingCapacityInThisBuffer, remainingDataInAllBuffers); | ||
if (remaining > size - i) { | ||
// chunkSize = size - i | ||
var end = this.byteOffsetInCurrentBuffer + size - i; | ||
const end = this.byteOffsetInCurrentBuffer + size - i; | ||
outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end)); | ||
@@ -69,3 +65,3 @@ this.pushedBytesLength += size - i; | ||
// chunkSize = remaining | ||
var end = this.byteOffsetInCurrentBuffer + remaining; | ||
const end = this.byteOffsetInCurrentBuffer + remaining; | ||
outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end)); | ||
@@ -90,6 +86,4 @@ if (remaining === remainingCapacityInThisBuffer) { | ||
} | ||
}; | ||
return BuffersStream; | ||
}(Readable)); | ||
export { BuffersStream }; | ||
} | ||
} | ||
//# sourceMappingURL=BuffersStream.js.map |
@@ -8,3 +8,3 @@ // Copyright (c) Microsoft Corporation. | ||
// Can't use import as Typescript doesn't recognize "buffer". | ||
var maxBufferLength = require("buffer").constants.MAX_LENGTH; | ||
const maxBufferLength = require("buffer").constants.MAX_LENGTH; | ||
/** | ||
@@ -18,4 +18,4 @@ * This class provides a buffer container which conceptually has no hard size limit. | ||
*/ | ||
var PooledBuffer = /** @class */ (function () { | ||
function PooledBuffer(capacity, buffers, totalLength) { | ||
export class PooledBuffer { | ||
constructor(capacity, buffers, totalLength) { | ||
/** | ||
@@ -29,5 +29,5 @@ * Internal buffers used to keep the data. | ||
// allocate | ||
var bufferNum = Math.ceil(capacity / maxBufferLength); | ||
for (var i = 0; i < bufferNum; i++) { | ||
var len = i === bufferNum - 1 ? capacity % maxBufferLength : maxBufferLength; | ||
const bufferNum = Math.ceil(capacity / maxBufferLength); | ||
for (let i = 0; i < bufferNum; i++) { | ||
let len = i === bufferNum - 1 ? capacity % maxBufferLength : maxBufferLength; | ||
if (len === 0) { | ||
@@ -42,13 +42,9 @@ len = maxBufferLength; | ||
} | ||
Object.defineProperty(PooledBuffer.prototype, "size", { | ||
/** | ||
* The size of the data contained in the pooled buffers. | ||
*/ | ||
get: function () { | ||
return this._size; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
/** | ||
* The size of the data contained in the pooled buffers. | ||
*/ | ||
get size() { | ||
return this._size; | ||
} | ||
/** | ||
* Fill the internal buffers with data in the input buffers serially | ||
@@ -62,9 +58,9 @@ * with respect to the total length and the total capacity of the internal buffers. | ||
*/ | ||
PooledBuffer.prototype.fill = function (buffers, totalLength) { | ||
fill(buffers, totalLength) { | ||
this._size = Math.min(this.capacity, totalLength); | ||
var i = 0, j = 0, targetOffset = 0, sourceOffset = 0, totalCopiedNum = 0; | ||
let i = 0, j = 0, targetOffset = 0, sourceOffset = 0, totalCopiedNum = 0; | ||
while (totalCopiedNum < this._size) { | ||
var source = buffers[i]; | ||
var target = this.buffers[j]; | ||
var copiedNum = source.copy(target, targetOffset, sourceOffset); | ||
const source = buffers[i]; | ||
const target = this.buffers[j]; | ||
const copiedNum = source.copy(target, targetOffset, sourceOffset); | ||
totalCopiedNum += copiedNum; | ||
@@ -87,3 +83,3 @@ sourceOffset += copiedNum; | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -93,8 +89,6 @@ * Get the readable stream assembled from all the data in the internal buffers. | ||
*/ | ||
PooledBuffer.prototype.getReadableStream = function () { | ||
getReadableStream() { | ||
return new BuffersStream(this.buffers, this.size); | ||
}; | ||
return PooledBuffer; | ||
}()); | ||
export { PooledBuffer }; | ||
} | ||
} | ||
//# sourceMappingURL=PooledBuffer.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __extends } from "tslib"; | ||
import { AnonymousCredentialPolicy } from "../policies/AnonymousCredentialPolicy"; | ||
@@ -12,7 +11,3 @@ import { Credential } from "./Credential"; | ||
*/ | ||
var AnonymousCredential = /** @class */ (function (_super) { | ||
__extends(AnonymousCredential, _super); | ||
function AnonymousCredential() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
export class AnonymousCredential extends Credential { | ||
/** | ||
@@ -24,8 +19,6 @@ * Creates an {@link AnonymousCredentialPolicy} object. | ||
*/ | ||
AnonymousCredential.prototype.create = function (nextPolicy, options) { | ||
create(nextPolicy, options) { | ||
return new AnonymousCredentialPolicy(nextPolicy, options); | ||
}; | ||
return AnonymousCredential; | ||
}(Credential)); | ||
export { AnonymousCredential }; | ||
} | ||
} | ||
//# sourceMappingURL=AnonymousCredential.js.map |
@@ -7,5 +7,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var Credential = /** @class */ (function () { | ||
function Credential() { | ||
} | ||
export class Credential { | ||
/** | ||
@@ -17,3 +15,3 @@ * Creates a RequestPolicy object. | ||
*/ | ||
Credential.prototype.create = function ( | ||
create( | ||
// tslint:disable-next-line:variable-name | ||
@@ -24,6 +22,4 @@ _nextPolicy, | ||
throw new Error("Method should be implemented in children classes."); | ||
}; | ||
return Credential; | ||
}()); | ||
export { Credential }; | ||
} | ||
} | ||
//# sourceMappingURL=Credential.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
var StorageSharedKeyCredential = /** @class */ (function () { | ||
function StorageSharedKeyCredential() { | ||
} | ||
return StorageSharedKeyCredential; | ||
}()); | ||
export { StorageSharedKeyCredential }; | ||
export class StorageSharedKeyCredential { | ||
} | ||
//# sourceMappingURL=StorageSharedKeyCredential.browser.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __extends } from "tslib"; | ||
import { createHmac } from "crypto"; | ||
@@ -12,4 +11,3 @@ import { StorageSharedKeyCredentialPolicy } from "../policies/StorageSharedKeyCredentialPolicy"; | ||
*/ | ||
var StorageSharedKeyCredential = /** @class */ (function (_super) { | ||
__extends(StorageSharedKeyCredential, _super); | ||
export class StorageSharedKeyCredential extends Credential { | ||
/** | ||
@@ -20,7 +18,6 @@ * Creates an instance of StorageSharedKeyCredential. | ||
*/ | ||
function StorageSharedKeyCredential(accountName, accountKey) { | ||
var _this = _super.call(this) || this; | ||
_this.accountName = accountName; | ||
_this.accountKey = Buffer.from(accountKey, "base64"); | ||
return _this; | ||
constructor(accountName, accountKey) { | ||
super(); | ||
this.accountName = accountName; | ||
this.accountKey = Buffer.from(accountKey, "base64"); | ||
} | ||
@@ -33,5 +30,5 @@ /** | ||
*/ | ||
StorageSharedKeyCredential.prototype.create = function (nextPolicy, options) { | ||
create(nextPolicy, options) { | ||
return new StorageSharedKeyCredentialPolicy(nextPolicy, options, this); | ||
}; | ||
} | ||
/** | ||
@@ -42,10 +39,8 @@ * Generates a hash signature for an HTTP request or for a SAS. | ||
*/ | ||
StorageSharedKeyCredential.prototype.computeHMACSHA256 = function (stringToSign) { | ||
computeHMACSHA256(stringToSign) { | ||
return createHmac("sha256", this.accountKey) | ||
.update(stringToSign, "utf8") | ||
.digest("base64"); | ||
}; | ||
return StorageSharedKeyCredential; | ||
}(Credential)); | ||
export { StorageSharedKeyCredential }; | ||
} | ||
} | ||
//# sourceMappingURL=StorageSharedKeyCredential.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
var UserDelegationKeyCredential = /** @class */ (function () { | ||
function UserDelegationKeyCredential() { | ||
} | ||
return UserDelegationKeyCredential; | ||
}()); | ||
export { UserDelegationKeyCredential }; | ||
export class UserDelegationKeyCredential { | ||
} | ||
//# sourceMappingURL=UserDelegationKeyCredential.browser.js.map |
@@ -10,3 +10,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var UserDelegationKeyCredential = /** @class */ (function () { | ||
export class UserDelegationKeyCredential { | ||
/** | ||
@@ -17,3 +17,3 @@ * Creates an instance of UserDelegationKeyCredential. | ||
*/ | ||
function UserDelegationKeyCredential(accountName, userDelegationKey) { | ||
constructor(accountName, userDelegationKey) { | ||
this.accountName = accountName; | ||
@@ -28,3 +28,3 @@ this.userDelegationKey = userDelegationKey; | ||
*/ | ||
UserDelegationKeyCredential.prototype.computeHMACSHA256 = function (stringToSign) { | ||
computeHMACSHA256(stringToSign) { | ||
// console.log(`stringToSign: ${JSON.stringify(stringToSign)}`); | ||
@@ -34,6 +34,4 @@ return createHmac("sha256", this.key) | ||
.digest("base64"); | ||
}; | ||
return UserDelegationKeyCredential; | ||
}()); | ||
export { UserDelegationKeyCredential }; | ||
} | ||
} | ||
//# sourceMappingURL=UserDelegationKeyCredential.js.map |
@@ -1,2 +0,2 @@ | ||
import { __assign, __asyncDelegator, __asyncGenerator, __asyncValues, __await, __awaiter, __extends, __generator, __values } from "tslib"; | ||
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib"; | ||
import { ContainerClient } from "@azure/storage-blob"; | ||
@@ -21,11 +21,9 @@ import { SpanStatusCode } from "@azure/core-tracing"; | ||
*/ | ||
var DataLakeFileSystemClient = /** @class */ (function (_super) { | ||
__extends(DataLakeFileSystemClient, _super); | ||
function DataLakeFileSystemClient(url, credentialOrPipeline, options) { | ||
var _this = this; | ||
export class DataLakeFileSystemClient extends StorageClient { | ||
constructor(url, credentialOrPipeline, options) { | ||
if (credentialOrPipeline instanceof Pipeline) { | ||
_this = _super.call(this, url, credentialOrPipeline) || this; | ||
super(url, credentialOrPipeline); | ||
} | ||
else { | ||
var credential = void 0; | ||
let credential; | ||
if (credentialOrPipeline === undefined) { | ||
@@ -37,23 +35,18 @@ credential = new AnonymousCredential(); | ||
} | ||
var pipeline = newPipeline(credential, options); | ||
_this = _super.call(this, url, pipeline) || this; | ||
const pipeline = newPipeline(credential, options); | ||
super(url, pipeline); | ||
} | ||
_this.fileSystemContext = new FileSystem(_this.storageClientContext); | ||
_this.fileSystemContextToBlobEndpoint = new FileSystem(_this.storageClientContextToBlobEndpoint); | ||
_this.blobContainerClient = new ContainerClient(_this.blobEndpointUrl, _this.pipeline); | ||
return _this; | ||
this.fileSystemContext = new FileSystem(this.storageClientContext); | ||
this.fileSystemContextToBlobEndpoint = new FileSystem(this.storageClientContextToBlobEndpoint); | ||
this.blobContainerClient = new ContainerClient(this.blobEndpointUrl, this.pipeline); | ||
} | ||
Object.defineProperty(DataLakeFileSystemClient.prototype, "name", { | ||
/** | ||
* Name of current file system. | ||
* | ||
* @readonly | ||
*/ | ||
get: function () { | ||
return this.blobContainerClient.containerName; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
/** | ||
* Name of current file system. | ||
* | ||
* @readonly | ||
*/ | ||
get name() { | ||
return this.blobContainerClient.containerName; | ||
} | ||
/** | ||
* Creates a {@link DataLakeDirectoryClient} object under current file system. | ||
@@ -63,5 +56,5 @@ * | ||
*/ | ||
DataLakeFileSystemClient.prototype.getDirectoryClient = function (directoryName) { | ||
getDirectoryClient(directoryName) { | ||
return new DataLakeDirectoryClient(appendToURLPath(this.url, encodeURIComponent(directoryName)), this.pipeline); | ||
}; | ||
} | ||
/** | ||
@@ -72,5 +65,5 @@ * Creates a {@link DataLakeFileClient} object under current file system. | ||
*/ | ||
DataLakeFileSystemClient.prototype.getFileClient = function (fileName) { | ||
getFileClient(fileName) { | ||
return new DataLakeFileClient(appendToURLPath(this.url, encodeURIComponent(fileName)), this.pipeline); | ||
}; | ||
} | ||
/** | ||
@@ -81,5 +74,5 @@ * Get a {@link DataLakeLeaseClient} that manages leases on the file system. | ||
*/ | ||
DataLakeFileSystemClient.prototype.getDataLakeLeaseClient = function (proposeLeaseId) { | ||
getDataLakeLeaseClient(proposeLeaseId) { | ||
return new DataLakeLeaseClient(this.blobContainerClient.getBlobLeaseClient(proposeLeaseId)); | ||
}; | ||
} | ||
/** | ||
@@ -93,30 +86,18 @@ * Creates a new file system under the specified account. If the file system with | ||
*/ | ||
DataLakeFileSystemClient.prototype.create = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-create", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobContainerClient.create(__assign(__assign({}, options), { access: toContainerPublicAccessType(options.access), tracingOptions: updatedOptions.tracingOptions }))]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_1 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_1.message | ||
}); | ||
throw e_1; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async create(options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-create", options); | ||
try { | ||
return await this.blobContainerClient.create(Object.assign(Object.assign({}, options), { access: toContainerPublicAccessType(options.access), tracingOptions: updatedOptions.tracingOptions })); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -130,30 +111,18 @@ * Creates a new file system under the specified account. If the file system with | ||
*/ | ||
DataLakeFileSystemClient.prototype.createIfNotExists = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_2; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-createIfNotExists", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobContainerClient.createIfNotExists(__assign(__assign({}, options), { access: toContainerPublicAccessType(options.access), tracingOptions: updatedOptions.tracingOptions }))]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_2 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_2.message | ||
}); | ||
throw e_2; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async createIfNotExists(options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-createIfNotExists", options); | ||
try { | ||
return await this.blobContainerClient.createIfNotExists(Object.assign(Object.assign({}, options), { access: toContainerPublicAccessType(options.access), tracingOptions: updatedOptions.tracingOptions })); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -168,30 +137,18 @@ * Returns true if the File system represented by this client exists; false otherwise. | ||
*/ | ||
DataLakeFileSystemClient.prototype.exists = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_3; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-exists", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobContainerClient.exists(updatedOptions)]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_3 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_3.message | ||
}); | ||
throw e_3; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async exists(options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-exists", options); | ||
try { | ||
return await this.blobContainerClient.exists(updatedOptions); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -204,30 +161,18 @@ * Delete current file system. | ||
*/ | ||
DataLakeFileSystemClient.prototype.delete = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_4; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-delete", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobContainerClient.delete(__assign(__assign({}, options), { tracingOptions: updatedOptions.tracingOptions }))]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_4 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_4.message | ||
}); | ||
throw e_4; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async delete(options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-delete", options); | ||
try { | ||
return await this.blobContainerClient.delete(Object.assign(Object.assign({}, options), { tracingOptions: updatedOptions.tracingOptions })); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -240,30 +185,18 @@ * Delete current file system if it exists. | ||
*/ | ||
DataLakeFileSystemClient.prototype.deleteIfExists = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_5; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-deleteIfExists", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobContainerClient.deleteIfExists(updatedOptions)]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_5 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_5.message | ||
}); | ||
throw e_5; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async deleteIfExists(options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-deleteIfExists", options); | ||
try { | ||
return await this.blobContainerClient.deleteIfExists(updatedOptions); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -282,37 +215,25 @@ * Returns all user-defined metadata and system properties for the specified | ||
*/ | ||
DataLakeFileSystemClient.prototype.getProperties = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, rawResponse, response, e_6; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-getProperties", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobContainerClient.getProperties(__assign(__assign({}, options), { tracingOptions: updatedOptions.tracingOptions }))]; | ||
case 2: | ||
rawResponse = _b.sent(); | ||
response = rawResponse; | ||
response.publicAccess = toPublicAccessType(rawResponse.blobPublicAccess); | ||
response._response.parsedHeaders.publicAccess = response.publicAccess; | ||
delete rawResponse.blobPublicAccess; | ||
delete rawResponse._response.parsedHeaders.blobPublicAccess; | ||
return [2 /*return*/, response]; | ||
case 3: | ||
e_6 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_6.message | ||
}); | ||
throw e_6; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async getProperties(options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-getProperties", options); | ||
try { | ||
const rawResponse = await this.blobContainerClient.getProperties(Object.assign(Object.assign({}, options), { tracingOptions: updatedOptions.tracingOptions })); | ||
// Transfer and rename blobPublicAccess to publicAccess | ||
const response = rawResponse; | ||
response.publicAccess = toPublicAccessType(rawResponse.blobPublicAccess); | ||
response._response.parsedHeaders.publicAccess = response.publicAccess; | ||
delete rawResponse.blobPublicAccess; | ||
delete rawResponse._response.parsedHeaders.blobPublicAccess; | ||
return response; | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -330,30 +251,18 @@ * Sets one or more user-defined name-value pairs for the specified file system. | ||
*/ | ||
DataLakeFileSystemClient.prototype.setMetadata = function (metadata, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_7; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-setMetadata", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobContainerClient.setMetadata(metadata, __assign(__assign({}, options), { tracingOptions: updatedOptions.tracingOptions }))]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_7 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_7.message | ||
}); | ||
throw e_7; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async setMetadata(metadata, options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-setMetadata", options); | ||
try { | ||
return await this.blobContainerClient.setMetadata(metadata, Object.assign(Object.assign({}, options), { tracingOptions: updatedOptions.tracingOptions })); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -370,37 +279,25 @@ * Gets the permissions for the specified file system. The permissions indicate | ||
*/ | ||
DataLakeFileSystemClient.prototype.getAccessPolicy = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, rawResponse, response, e_8; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-getAccessPolicy", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobContainerClient.getAccessPolicy(__assign(__assign({}, options), { tracingOptions: updatedOptions.tracingOptions }))]; | ||
case 2: | ||
rawResponse = _b.sent(); | ||
response = rawResponse; | ||
response.publicAccess = toPublicAccessType(rawResponse.blobPublicAccess); | ||
response._response.parsedHeaders.publicAccess = response.publicAccess; | ||
delete rawResponse.blobPublicAccess; | ||
delete rawResponse._response.parsedHeaders.blobPublicAccess; | ||
return [2 /*return*/, response]; | ||
case 3: | ||
e_8 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_8.message | ||
}); | ||
throw e_8; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async getAccessPolicy(options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-getAccessPolicy", options); | ||
try { | ||
const rawResponse = await this.blobContainerClient.getAccessPolicy(Object.assign(Object.assign({}, options), { tracingOptions: updatedOptions.tracingOptions })); | ||
// Transfer and rename blobPublicAccess to publicAccess | ||
const response = rawResponse; | ||
response.publicAccess = toPublicAccessType(rawResponse.blobPublicAccess); | ||
response._response.parsedHeaders.publicAccess = response.publicAccess; | ||
delete rawResponse.blobPublicAccess; | ||
delete rawResponse._response.parsedHeaders.blobPublicAccess; | ||
return response; | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -420,30 +317,18 @@ * Sets the permissions for the specified file system. The permissions indicate | ||
*/ | ||
DataLakeFileSystemClient.prototype.setAccessPolicy = function (access, fileSystemAcl, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_9; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-setAccessPolicy", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobContainerClient.setAccessPolicy(toContainerPublicAccessType(access), fileSystemAcl, __assign(__assign({}, options), { tracingOptions: updatedOptions.tracingOptions }))]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_9 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_9.message | ||
}); | ||
throw e_9; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async setAccessPolicy(access, fileSystemAcl, options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-setAccessPolicy", options); | ||
try { | ||
return await this.blobContainerClient.setAccessPolicy(toContainerPublicAccessType(access), fileSystemAcl, Object.assign(Object.assign({}, options), { tracingOptions: updatedOptions.tracingOptions })); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -520,128 +405,70 @@ * Returns an async iterable iterator to list all the paths (directories and files) | ||
*/ | ||
DataLakeFileSystemClient.prototype.listPaths = function (options) { | ||
var _a; | ||
var _this = this; | ||
if (options === void 0) { options = {}; } | ||
listPaths(options = {}) { | ||
options.path = options.path === "" ? undefined : options.path; | ||
var iter = this.listItems(options); | ||
return _a = { | ||
next: function () { | ||
return iter.next(); | ||
} | ||
const iter = this.listItems(options); | ||
return { | ||
next() { | ||
return iter.next(); | ||
}, | ||
_a[Symbol.asyncIterator] = function () { | ||
[Symbol.asyncIterator]() { | ||
return this; | ||
}, | ||
_a.byPage = function (settings) { | ||
if (settings === void 0) { settings = {}; } | ||
return _this.listSegments(settings.continuationToken, __assign({ maxResults: settings.maxPageSize }, options)); | ||
}, | ||
_a; | ||
}; | ||
DataLakeFileSystemClient.prototype.listItems = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __asyncGenerator(this, arguments, function listItems_1() { | ||
var _a, _b, response, e_10_1; | ||
var e_10, _c; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
_d.trys.push([0, 7, 8, 13]); | ||
_a = __asyncValues(this.listSegments(undefined, options)); | ||
_d.label = 1; | ||
case 1: return [4 /*yield*/, __await(_a.next())]; | ||
case 2: | ||
if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 6]; | ||
response = _b.value; | ||
return [5 /*yield**/, __values(__asyncDelegator(__asyncValues(response.pathItems || [])))]; | ||
case 3: return [4 /*yield*/, __await.apply(void 0, [_d.sent()])]; | ||
case 4: | ||
_d.sent(); | ||
_d.label = 5; | ||
case 5: return [3 /*break*/, 1]; | ||
case 6: return [3 /*break*/, 13]; | ||
case 7: | ||
e_10_1 = _d.sent(); | ||
e_10 = { error: e_10_1 }; | ||
return [3 /*break*/, 13]; | ||
case 8: | ||
_d.trys.push([8, , 11, 12]); | ||
if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 10]; | ||
return [4 /*yield*/, __await(_c.call(_a))]; | ||
case 9: | ||
_d.sent(); | ||
_d.label = 10; | ||
case 10: return [3 /*break*/, 12]; | ||
case 11: | ||
if (e_10) throw e_10.error; | ||
return [7 /*endfinally*/]; | ||
case 12: return [7 /*endfinally*/]; | ||
case 13: return [2 /*return*/]; | ||
byPage: (settings = {}) => { | ||
return this.listSegments(settings.continuationToken, Object.assign({ maxResults: settings.maxPageSize }, options)); | ||
} | ||
}; | ||
} | ||
listItems(options = {}) { | ||
return __asyncGenerator(this, arguments, function* listItems_1() { | ||
var e_1, _a; | ||
try { | ||
for (var _b = __asyncValues(this.listSegments(undefined, options)), _c; _c = yield __await(_b.next()), !_c.done;) { | ||
const response = _c.value; | ||
yield __await(yield* __asyncDelegator(__asyncValues(response.pathItems || []))); | ||
} | ||
}); | ||
}); | ||
}; | ||
DataLakeFileSystemClient.prototype.listSegments = function (continuation, options) { | ||
if (options === void 0) { options = {}; } | ||
return __asyncGenerator(this, arguments, function listSegments_1() { | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!(!!continuation || continuation === undefined)) return [3 /*break*/, 6]; | ||
_a.label = 1; | ||
case 1: return [4 /*yield*/, __await(this.listPathsSegment(continuation, options))]; | ||
case 2: | ||
response = _a.sent(); | ||
continuation = response.continuation; | ||
return [4 /*yield*/, __await(response)]; | ||
case 3: return [4 /*yield*/, _a.sent()]; | ||
case 4: | ||
_a.sent(); | ||
_a.label = 5; | ||
case 5: | ||
if (continuation) return [3 /*break*/, 1]; | ||
_a.label = 6; | ||
case 6: return [2 /*return*/]; | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b)); | ||
} | ||
}); | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
}); | ||
}; | ||
DataLakeFileSystemClient.prototype.listPathsSegment = function (continuation, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, rawResponse, response, _i, _b, path, e_11; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-listPathsSegment", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_c.label = 1; | ||
case 1: | ||
_c.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.fileSystemContext.listPaths(options.recursive || false, __assign(__assign(__assign({ continuation: continuation }, options), { upn: options.userPrincipalName }), convertTracingToRequestOptionsBase(updatedOptions)))]; | ||
case 2: | ||
rawResponse = _c.sent(); | ||
response = rawResponse; | ||
response.pathItems = []; | ||
for (_i = 0, _b = rawResponse.paths || []; _i < _b.length; _i++) { | ||
path = _b[_i]; | ||
response.pathItems.push(__assign(__assign({}, path), { permissions: toPermissions(path.permissions) })); | ||
} | ||
delete rawResponse.paths; | ||
return [2 /*return*/, response]; | ||
case 3: | ||
e_11 = _c.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_11.message | ||
}); | ||
throw e_11; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
} | ||
listSegments(continuation, options = {}) { | ||
return __asyncGenerator(this, arguments, function* listSegments_1() { | ||
let response; | ||
if (!!continuation || continuation === undefined) { | ||
do { | ||
response = yield __await(this.listPathsSegment(continuation, options)); | ||
continuation = response.continuation; | ||
yield yield __await(response); | ||
} while (continuation); | ||
} | ||
}); | ||
} | ||
async listPathsSegment(continuation, options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-listPathsSegment", options); | ||
try { | ||
const rawResponse = await this.fileSystemContext.listPaths(options.recursive || false, Object.assign(Object.assign(Object.assign({ continuation }, options), { upn: options.userPrincipalName }), convertTracingToRequestOptionsBase(updatedOptions))); | ||
const response = rawResponse; | ||
response.pathItems = []; | ||
for (const path of rawResponse.paths || []) { | ||
response.pathItems.push(Object.assign(Object.assign({}, path), { permissions: toPermissions(path.permissions) })); | ||
} | ||
delete rawResponse.paths; | ||
return response; | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -718,134 +545,76 @@ * Returns an async iterable iterator to list all the paths (directories and files) | ||
*/ | ||
DataLakeFileSystemClient.prototype.listDeletedPaths = function (options) { | ||
var _a; | ||
var _this = this; | ||
if (options === void 0) { options = {}; } | ||
var iter = this.listDeletedItems(options); | ||
return _a = { | ||
next: function () { | ||
return iter.next(); | ||
} | ||
listDeletedPaths(options = {}) { | ||
const iter = this.listDeletedItems(options); | ||
return { | ||
next() { | ||
return iter.next(); | ||
}, | ||
_a[Symbol.asyncIterator] = function () { | ||
[Symbol.asyncIterator]() { | ||
return this; | ||
}, | ||
_a.byPage = function (settings) { | ||
if (settings === void 0) { settings = {}; } | ||
return _this.listDeletedSegments(settings.continuationToken, __assign({ maxResults: settings.maxPageSize }, options)); | ||
}, | ||
_a; | ||
}; | ||
DataLakeFileSystemClient.prototype.listDeletedItems = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __asyncGenerator(this, arguments, function listDeletedItems_1() { | ||
var _a, _b, response, e_12_1; | ||
var e_12, _c; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
_d.trys.push([0, 7, 8, 13]); | ||
_a = __asyncValues(this.listDeletedSegments(undefined, options)); | ||
_d.label = 1; | ||
case 1: return [4 /*yield*/, __await(_a.next())]; | ||
case 2: | ||
if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 6]; | ||
response = _b.value; | ||
return [5 /*yield**/, __values(__asyncDelegator(__asyncValues(response.pathItems || [])))]; | ||
case 3: return [4 /*yield*/, __await.apply(void 0, [_d.sent()])]; | ||
case 4: | ||
_d.sent(); | ||
_d.label = 5; | ||
case 5: return [3 /*break*/, 1]; | ||
case 6: return [3 /*break*/, 13]; | ||
case 7: | ||
e_12_1 = _d.sent(); | ||
e_12 = { error: e_12_1 }; | ||
return [3 /*break*/, 13]; | ||
case 8: | ||
_d.trys.push([8, , 11, 12]); | ||
if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 10]; | ||
return [4 /*yield*/, __await(_c.call(_a))]; | ||
case 9: | ||
_d.sent(); | ||
_d.label = 10; | ||
case 10: return [3 /*break*/, 12]; | ||
case 11: | ||
if (e_12) throw e_12.error; | ||
return [7 /*endfinally*/]; | ||
case 12: return [7 /*endfinally*/]; | ||
case 13: return [2 /*return*/]; | ||
byPage: (settings = {}) => { | ||
return this.listDeletedSegments(settings.continuationToken, Object.assign({ maxResults: settings.maxPageSize }, options)); | ||
} | ||
}; | ||
} | ||
listDeletedItems(options = {}) { | ||
return __asyncGenerator(this, arguments, function* listDeletedItems_1() { | ||
var e_2, _a; | ||
try { | ||
for (var _b = __asyncValues(this.listDeletedSegments(undefined, options)), _c; _c = yield __await(_b.next()), !_c.done;) { | ||
const response = _c.value; | ||
yield __await(yield* __asyncDelegator(__asyncValues(response.pathItems || []))); | ||
} | ||
}); | ||
}); | ||
}; | ||
DataLakeFileSystemClient.prototype.listDeletedSegments = function (continuation, options) { | ||
if (options === void 0) { options = {}; } | ||
return __asyncGenerator(this, arguments, function listDeletedSegments_1() { | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!(!!continuation || continuation === undefined)) return [3 /*break*/, 6]; | ||
_a.label = 1; | ||
case 1: return [4 /*yield*/, __await(this.listDeletedPathsSegment(continuation, options))]; | ||
case 2: | ||
response = _a.sent(); | ||
continuation = response.continuation; | ||
return [4 /*yield*/, __await(response)]; | ||
case 3: return [4 /*yield*/, _a.sent()]; | ||
case 4: | ||
_a.sent(); | ||
_a.label = 5; | ||
case 5: | ||
if (continuation) return [3 /*break*/, 1]; | ||
_a.label = 6; | ||
case 6: return [2 /*return*/]; | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b)); | ||
} | ||
}); | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
}); | ||
}; | ||
DataLakeFileSystemClient.prototype.listDeletedPathsSegment = function (continuation, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, rawResponse, response, _i, _b, path, e_13; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-listDeletedPathsSegment", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_c.label = 1; | ||
case 1: | ||
_c.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.fileSystemContextToBlobEndpoint.listBlobHierarchySegment(__assign(__assign(__assign({ marker: continuation }, options), { prefix: options.prefix === "" ? undefined : options.prefix }), convertTracingToRequestOptionsBase(updatedOptions)))]; | ||
case 2: | ||
rawResponse = _c.sent(); | ||
response = rawResponse; | ||
response.pathItems = []; | ||
for (_i = 0, _b = rawResponse.segment.blobItems || []; _i < _b.length; _i++) { | ||
path = _b[_i]; | ||
response.pathItems.push({ | ||
name: path.name, | ||
deletionId: path.deletionId, | ||
deletedOn: path.properties.deletedTime, | ||
remainingRetentionDays: path.properties.remainingRetentionDays | ||
}); | ||
} | ||
if (!(response.nextMarker == undefined || response.nextMarker === "")) { | ||
response.continuation = response.nextMarker; | ||
} | ||
return [2 /*return*/, response]; | ||
case 3: | ||
e_13 = _c.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_13.message | ||
}); | ||
throw e_13; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
} | ||
listDeletedSegments(continuation, options = {}) { | ||
return __asyncGenerator(this, arguments, function* listDeletedSegments_1() { | ||
let response; | ||
if (!!continuation || continuation === undefined) { | ||
do { | ||
response = yield __await(this.listDeletedPathsSegment(continuation, options)); | ||
continuation = response.continuation; | ||
yield yield __await(response); | ||
} while (continuation); | ||
} | ||
}); | ||
} | ||
async listDeletedPathsSegment(continuation, options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-listDeletedPathsSegment", options); | ||
try { | ||
const rawResponse = await this.fileSystemContextToBlobEndpoint.listBlobHierarchySegment(Object.assign(Object.assign(Object.assign({ marker: continuation }, options), { prefix: options.prefix === "" ? undefined : options.prefix }), convertTracingToRequestOptionsBase(updatedOptions))); | ||
const response = rawResponse; | ||
response.pathItems = []; | ||
for (const path of rawResponse.segment.blobItems || []) { | ||
response.pathItems.push({ | ||
name: path.name, | ||
deletionId: path.deletionId, | ||
deletedOn: path.properties.deletedTime, | ||
remainingRetentionDays: path.properties.remainingRetentionDays | ||
}); | ||
} | ||
if (!(response.nextMarker == undefined || response.nextMarker === "")) { | ||
response.continuation = response.nextMarker; | ||
} | ||
return response; | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -861,39 +630,25 @@ * Restores a soft deleted path. | ||
*/ | ||
DataLakeFileSystemClient.prototype.undeletePath = function (deletedPath, deletionId, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, pathClient, rawResponse, e_14; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeFileSystemClient-undeletePath", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
pathClient = new PathClientInternal(appendToURLPath(this.blobEndpointUrl, encodeURIComponent(deletedPath)), this.pipeline); | ||
return [4 /*yield*/, pathClient.blobPathContext.undelete(__assign(__assign({ undeleteSource: "?" + DeletionIdKey + "=" + deletionId }, options), { tracingOptions: updatedOptions.tracingOptions }))]; | ||
case 2: | ||
rawResponse = _b.sent(); | ||
if (rawResponse.resourceType === PathResultTypeConstants.DirectoryResourceType) { | ||
return [2 /*return*/, __assign({ pathClient: this.getDirectoryClient(deletedPath) }, rawResponse)]; | ||
} | ||
else { | ||
return [2 /*return*/, __assign({ pathClient: this.getFileClient(deletedPath) }, rawResponse)]; | ||
} | ||
return [3 /*break*/, 5]; | ||
case 3: | ||
e_14 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_14.message | ||
}); | ||
throw e_14; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async undeletePath(deletedPath, deletionId, options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeFileSystemClient-undeletePath", options); | ||
try { | ||
const pathClient = new PathClientInternal(appendToURLPath(this.blobEndpointUrl, encodeURIComponent(deletedPath)), this.pipeline); | ||
const rawResponse = await pathClient.blobPathContext.undelete(Object.assign(Object.assign({ undeleteSource: "?" + DeletionIdKey + "=" + deletionId }, options), { tracingOptions: updatedOptions.tracingOptions })); | ||
if (rawResponse.resourceType === PathResultTypeConstants.DirectoryResourceType) { | ||
return Object.assign({ pathClient: this.getDirectoryClient(deletedPath) }, rawResponse); | ||
} | ||
else { | ||
return Object.assign({ pathClient: this.getFileClient(deletedPath) }, rawResponse); | ||
} | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -910,15 +665,12 @@ * Only available for DataLakeFileSystemClient constructed with a shared key credential. | ||
*/ | ||
DataLakeFileSystemClient.prototype.generateSasUrl = function (options) { | ||
var _this = this; | ||
return new Promise(function (resolve) { | ||
if (!(_this.credential instanceof StorageSharedKeyCredential)) { | ||
generateSasUrl(options) { | ||
return new Promise((resolve) => { | ||
if (!(this.credential instanceof StorageSharedKeyCredential)) { | ||
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential"); | ||
} | ||
var sas = generateDataLakeSASQueryParameters(__assign({ fileSystemName: _this.name }, options), _this.credential).toString(); | ||
resolve(appendToURLQuery(_this.url, sas)); | ||
const sas = generateDataLakeSASQueryParameters(Object.assign({ fileSystemName: this.name }, options), this.credential).toString(); | ||
resolve(appendToURLQuery(this.url, sas)); | ||
}); | ||
}; | ||
return DataLakeFileSystemClient; | ||
}(StorageClient)); | ||
export { DataLakeFileSystemClient }; | ||
} | ||
} | ||
//# sourceMappingURL=DataLakeFileSystemClient.js.map |
@@ -1,170 +0,99 @@ | ||
import { __awaiter, __generator } from "tslib"; | ||
import { SpanStatusCode } from "@azure/core-tracing"; | ||
import { createSpan } from "./utils/tracing"; | ||
var DataLakeLeaseClient = /** @class */ (function () { | ||
function DataLakeLeaseClient(client) { | ||
export class DataLakeLeaseClient { | ||
constructor(client) { | ||
this.client = client; | ||
} | ||
Object.defineProperty(DataLakeLeaseClient.prototype, "leaseId", { | ||
get: function () { | ||
return this.client.leaseId; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DataLakeLeaseClient.prototype, "url", { | ||
get: function () { | ||
return this.client.url; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
DataLakeLeaseClient.prototype.acquireLease = function (duration, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
options.conditions = options.conditions || {}; | ||
_a = createSpan("DataLakeLeaseClient-acquireLease", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.client.acquireLease(duration, updatedOptions)]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_1 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_1.message | ||
}); | ||
throw e_1; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
get leaseId() { | ||
return this.client.leaseId; | ||
} | ||
get url() { | ||
return this.client.url; | ||
} | ||
async acquireLease(duration, options = {}) { | ||
options.conditions = options.conditions || {}; | ||
const { span, updatedOptions } = createSpan("DataLakeLeaseClient-acquireLease", options); | ||
try { | ||
return await this.client.acquireLease(duration, updatedOptions); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
DataLakeLeaseClient.prototype.changeLease = function (proposedLeaseId, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_2; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
options.conditions = options.conditions || {}; | ||
_a = createSpan("DataLakeLeaseClient-changeLease", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.client.changeLease(proposedLeaseId, updatedOptions)]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_2 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_2.message | ||
}); | ||
throw e_2; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
async changeLease(proposedLeaseId, options = {}) { | ||
options.conditions = options.conditions || {}; | ||
const { span, updatedOptions } = createSpan("DataLakeLeaseClient-changeLease", options); | ||
try { | ||
return await this.client.changeLease(proposedLeaseId, updatedOptions); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
DataLakeLeaseClient.prototype.releaseLease = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_3; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
options.conditions = options.conditions || {}; | ||
_a = createSpan("DataLakeLeaseClient-releaseLease", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.client.releaseLease(updatedOptions)]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_3 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_3.message | ||
}); | ||
throw e_3; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
async releaseLease(options = {}) { | ||
options.conditions = options.conditions || {}; | ||
const { span, updatedOptions } = createSpan("DataLakeLeaseClient-releaseLease", options); | ||
try { | ||
return await this.client.releaseLease(updatedOptions); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
DataLakeLeaseClient.prototype.renewLease = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_4; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
options.conditions = options.conditions || {}; | ||
_a = createSpan("DataLakeLeaseClient-renewLease", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.client.renewLease(updatedOptions)]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_4 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_4.message | ||
}); | ||
throw e_4; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
async renewLease(options = {}) { | ||
options.conditions = options.conditions || {}; | ||
const { span, updatedOptions } = createSpan("DataLakeLeaseClient-renewLease", options); | ||
try { | ||
return await this.client.renewLease(updatedOptions); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
DataLakeLeaseClient.prototype.breakLease = function (breakPeriod, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_5; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
options.conditions = options.conditions || {}; | ||
_a = createSpan("DataLakeLeaseClient-renewLease", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.client.breakLease(breakPeriod, updatedOptions)]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_5 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_5.message | ||
}); | ||
throw e_5; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
async breakLease(breakPeriod, options = {}) { | ||
options.conditions = options.conditions || {}; | ||
const { span, updatedOptions } = createSpan("DataLakeLeaseClient-renewLease", options); | ||
try { | ||
return await this.client.breakLease(breakPeriod, updatedOptions); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
return DataLakeLeaseClient; | ||
}()); | ||
export { DataLakeLeaseClient }; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=DataLakeLeaseClient.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __assign, __awaiter, __extends, __generator } from "tslib"; | ||
import "@azure/core-paging"; | ||
@@ -24,11 +23,9 @@ import { getDefaultProxySettings, isNode } from "@azure/core-http"; | ||
*/ | ||
var DataLakeServiceClient = /** @class */ (function (_super) { | ||
__extends(DataLakeServiceClient, _super); | ||
function DataLakeServiceClient(url, credentialOrPipeline, options) { | ||
var _this = this; | ||
export class DataLakeServiceClient extends StorageClient { | ||
constructor(url, credentialOrPipeline, options) { | ||
if (credentialOrPipeline instanceof Pipeline) { | ||
_this = _super.call(this, url, credentialOrPipeline) || this; | ||
super(url, credentialOrPipeline); | ||
} | ||
else { | ||
var credential = void 0; | ||
let credential; | ||
if (credentialOrPipeline === undefined) { | ||
@@ -40,8 +37,7 @@ credential = new AnonymousCredential(); | ||
} | ||
var pipeline = newPipeline(credential, options); | ||
_this = _super.call(this, url, pipeline) || this; | ||
const pipeline = newPipeline(credential, options); | ||
super(url, pipeline); | ||
} | ||
// this.serviceContext = new Service(this.storageClientContext); | ||
_this.blobServiceClient = new BlobServiceClient(_this.blobEndpointUrl, _this.pipeline); | ||
return _this; | ||
this.blobServiceClient = new BlobServiceClient(this.blobEndpointUrl, this.pipeline); | ||
} | ||
@@ -60,10 +56,10 @@ /** | ||
*/ | ||
DataLakeServiceClient.fromConnectionString = function (connectionString, options) { | ||
static fromConnectionString(connectionString, options) { | ||
options = options || {}; | ||
var extractedCreds = extractConnectionStringParts(connectionString); | ||
const extractedCreds = extractConnectionStringParts(connectionString); | ||
if (extractedCreds.kind === "AccountConnString") { | ||
if (isNode) { | ||
var sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey); | ||
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey); | ||
options.proxyOptions = getDefaultProxySettings(extractedCreds.proxyUri); | ||
var pipeline = newPipeline(sharedKeyCredential, options); | ||
const pipeline = newPipeline(sharedKeyCredential, options); | ||
return new DataLakeServiceClient(toDfsEndpointUrl(extractedCreds.url), pipeline); | ||
@@ -76,3 +72,3 @@ } | ||
else if (extractedCreds.kind === "SASConnString") { | ||
var pipeline = newPipeline(new AnonymousCredential(), options); | ||
const pipeline = newPipeline(new AnonymousCredential(), options); | ||
return new DataLakeServiceClient(toDfsEndpointUrl(extractedCreds.url) + "?" + extractedCreds.accountSas, pipeline); | ||
@@ -83,3 +79,3 @@ } | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -90,5 +86,5 @@ * Creates a {@link DataLakeFileSystemClient} object. | ||
*/ | ||
DataLakeServiceClient.prototype.getFileSystemClient = function (fileSystemName) { | ||
getFileSystemClient(fileSystemName) { | ||
return new DataLakeFileSystemClient(appendToURLPath(this.url, encodeURIComponent(fileSystemName)), this.pipeline); | ||
}; | ||
} | ||
/** | ||
@@ -123,30 +119,18 @@ * ONLY AVAILABLE WHEN USING BEARER TOKEN AUTHENTICATION (TokenCredential). | ||
*/ | ||
DataLakeServiceClient.prototype.getUserDelegationKey = function (startsOn, expiresOn, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeServiceClient-getUserDelegationKey", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobServiceClient.getUserDelegationKey(startsOn, expiresOn, updatedOptions)]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_1 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_1.message | ||
}); | ||
throw e_1; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async getUserDelegationKey(startsOn, expiresOn, options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeServiceClient-getUserDelegationKey", options); | ||
try { | ||
return await this.blobServiceClient.getUserDelegationKey(startsOn, expiresOn, updatedOptions); | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -227,6 +211,5 @@ * Returns an async iterable iterator to list all the file systems | ||
*/ | ||
DataLakeServiceClient.prototype.listFileSystems = function (options) { | ||
if (options === void 0) { options = {}; } | ||
listFileSystems(options = {}) { | ||
return toFileSystemPagedAsyncIterableIterator(this.blobServiceClient.listContainers(options)); | ||
}; | ||
} | ||
// public async createFileSystem(): Promise<DataLakeFileSystemClient> { | ||
@@ -252,6 +235,3 @@ // throw Error("NotImplemented"); | ||
*/ | ||
DataLakeServiceClient.prototype.generateAccountSasUrl = function (expiresOn, permissions, resourceTypes, options) { | ||
if (permissions === void 0) { permissions = AccountSASPermissions.parse("r"); } | ||
if (resourceTypes === void 0) { resourceTypes = "sco"; } | ||
if (options === void 0) { options = {}; } | ||
generateAccountSasUrl(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) { | ||
if (!(this.credential instanceof StorageSharedKeyCredential)) { | ||
@@ -261,10 +241,10 @@ throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential"); | ||
if (expiresOn === undefined) { | ||
var now = new Date(); | ||
const now = new Date(); | ||
expiresOn = new Date(now.getTime() + 3600 * 1000); | ||
} | ||
var sas = generateAccountSASQueryParameters(__assign({ permissions: permissions, | ||
expiresOn: expiresOn, | ||
resourceTypes: resourceTypes, services: AccountSASServices.parse("b").toString() }, options), this.credential).toString(); | ||
const sas = generateAccountSASQueryParameters(Object.assign({ permissions, | ||
expiresOn, | ||
resourceTypes, services: AccountSASServices.parse("b").toString() }, options), this.credential).toString(); | ||
return appendToURLQuery(this.url, sas); | ||
}; | ||
} | ||
/** | ||
@@ -278,36 +258,24 @@ * Renames an existing File System. | ||
// @ts-ignore Need to hide this interface for now. Make it public and turn on the live tests for it when the service is ready. | ||
DataLakeServiceClient.prototype.renameFileSystem = function (sourceFileSystemName, destinationFileSystemName, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, res, fileSystemClient, e_2; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeServiceClient-renameFileSystem", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobServiceClient["renameContainer"](sourceFileSystemName, destinationFileSystemName, updatedOptions)]; | ||
case 2: | ||
res = _b.sent(); | ||
fileSystemClient = this.getFileSystemClient(destinationFileSystemName); | ||
return [2 /*return*/, { | ||
fileSystemClient: fileSystemClient, | ||
fileSystemRenameResponse: res.containerRenameResponse | ||
}]; | ||
case 3: | ||
e_2 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_2.message | ||
}); | ||
throw e_2; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async renameFileSystem(sourceFileSystemName, destinationFileSystemName, options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeServiceClient-renameFileSystem", options); | ||
try { | ||
// const res = await this.blobServiceClient.renameContainer( | ||
const res = await this.blobServiceClient["renameContainer"](sourceFileSystemName, destinationFileSystemName, updatedOptions); | ||
const fileSystemClient = this.getFileSystemClient(destinationFileSystemName); | ||
return { | ||
fileSystemClient, | ||
fileSystemRenameResponse: res.containerRenameResponse | ||
}; | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -321,36 +289,23 @@ * Restore a previously deleted File System. | ||
*/ | ||
DataLakeServiceClient.prototype.undeleteFileSystem = function (deletedFileSystemName, deleteFileSystemVersion, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, res, fileSystemClient, e_3; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeServiceClient-undeleteFileSystem", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobServiceClient.undeleteContainer(deletedFileSystemName, deleteFileSystemVersion, __assign(__assign({}, options), { destinationContainerName: options.destinationFileSystemName, tracingOptions: updatedOptions.tracingOptions }))]; | ||
case 2: | ||
res = _b.sent(); | ||
fileSystemClient = this.getFileSystemClient(options.destinationFileSystemName || deletedFileSystemName); | ||
return [2 /*return*/, { | ||
fileSystemClient: fileSystemClient, | ||
fileSystemUndeleteResponse: res.containerUndeleteResponse | ||
}]; | ||
case 3: | ||
e_3 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_3.message | ||
}); | ||
throw e_3; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async undeleteFileSystem(deletedFileSystemName, deleteFileSystemVersion, options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeServiceClient-undeleteFileSystem", options); | ||
try { | ||
const res = await this.blobServiceClient.undeleteContainer(deletedFileSystemName, deleteFileSystemVersion, Object.assign(Object.assign({}, options), { destinationContainerName: options.destinationFileSystemName, tracingOptions: updatedOptions.tracingOptions })); | ||
const fileSystemClient = this.getFileSystemClient(options.destinationFileSystemName || deletedFileSystemName); | ||
return { | ||
fileSystemClient, | ||
fileSystemUndeleteResponse: res.containerUndeleteResponse | ||
}; | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
}); | ||
}; | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -364,33 +319,21 @@ * Gets the properties of a storage account’s Blob service endpoint, including properties | ||
*/ | ||
DataLakeServiceClient.prototype.getProperties = function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_4; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeServiceClient-getProperties", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobServiceClient.getProperties({ | ||
abortSignal: options.abortSignal, | ||
tracingOptions: updatedOptions.tracingOptions | ||
})]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_4 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_4.message | ||
}); | ||
throw e_4; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async getProperties(options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeServiceClient-getProperties", options); | ||
try { | ||
return await this.blobServiceClient.getProperties({ | ||
abortSignal: options.abortSignal, | ||
tracingOptions: updatedOptions.tracingOptions | ||
}); | ||
}); | ||
}; | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
/** | ||
@@ -405,36 +348,22 @@ * Sets properties for a storage account’s Blob service endpoint, including properties | ||
*/ | ||
DataLakeServiceClient.prototype.setProperties = function (properties, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, updatedOptions, e_5; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = createSpan("DataLakeServiceClient-setProperties", options), span = _a.span, updatedOptions = _a.updatedOptions; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, 4, 5]); | ||
return [4 /*yield*/, this.blobServiceClient.setProperties(properties, { | ||
abortSignal: options.abortSignal, | ||
tracingOptions: updatedOptions.tracingOptions | ||
})]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 3: | ||
e_5 = _b.sent(); | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e_5.message | ||
}); | ||
throw e_5; | ||
case 4: | ||
span.end(); | ||
return [7 /*endfinally*/]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
async setProperties(properties, options = {}) { | ||
const { span, updatedOptions } = createSpan("DataLakeServiceClient-setProperties", options); | ||
try { | ||
return await this.blobServiceClient.setProperties(properties, { | ||
abortSignal: options.abortSignal, | ||
tracingOptions: updatedOptions.tracingOptions | ||
}); | ||
}); | ||
}; | ||
return DataLakeServiceClient; | ||
}(StorageClient)); | ||
export { DataLakeServiceClient }; | ||
} | ||
catch (e) { | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message: e.message | ||
}); | ||
throw e; | ||
} | ||
finally { | ||
span.end(); | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=DataLakeServiceClient.js.map |
@@ -9,3 +9,3 @@ /* | ||
import { QueryCollectionFormat } from "@azure/core-http"; | ||
export var accept = { | ||
export const accept = { | ||
parameterPath: "accept", | ||
@@ -21,3 +21,3 @@ mapper: { | ||
}; | ||
export var url = { | ||
export const url = { | ||
parameterPath: "url", | ||
@@ -34,3 +34,3 @@ mapper: { | ||
}; | ||
export var resource = { | ||
export const resource = { | ||
parameterPath: "resource", | ||
@@ -46,3 +46,3 @@ mapper: { | ||
}; | ||
export var prefix = { | ||
export const prefix = { | ||
parameterPath: ["options", "prefix"], | ||
@@ -57,3 +57,3 @@ mapper: { | ||
}; | ||
export var continuation = { | ||
export const continuation = { | ||
parameterPath: ["options", "continuation"], | ||
@@ -68,3 +68,3 @@ mapper: { | ||
}; | ||
export var maxResults = { | ||
export const maxResults = { | ||
parameterPath: ["options", "maxResults"], | ||
@@ -82,3 +82,3 @@ mapper: { | ||
}; | ||
export var requestId = { | ||
export const requestId = { | ||
parameterPath: ["options", "requestId"], | ||
@@ -93,3 +93,3 @@ mapper: { | ||
}; | ||
export var timeout = { | ||
export const timeout = { | ||
parameterPath: ["options", "timeout"], | ||
@@ -107,3 +107,3 @@ mapper: { | ||
}; | ||
export var version = { | ||
export const version = { | ||
parameterPath: "version", | ||
@@ -119,3 +119,3 @@ mapper: { | ||
}; | ||
export var resource1 = { | ||
export const resource1 = { | ||
parameterPath: "resource", | ||
@@ -131,3 +131,3 @@ mapper: { | ||
}; | ||
export var properties = { | ||
export const properties = { | ||
parameterPath: ["options", "properties"], | ||
@@ -142,3 +142,3 @@ mapper: { | ||
}; | ||
export var ifModifiedSince = { | ||
export const ifModifiedSince = { | ||
parameterPath: ["options", "modifiedAccessConditions", "ifModifiedSince"], | ||
@@ -153,3 +153,3 @@ mapper: { | ||
}; | ||
export var ifUnmodifiedSince = { | ||
export const ifUnmodifiedSince = { | ||
parameterPath: ["options", "modifiedAccessConditions", "ifUnmodifiedSince"], | ||
@@ -164,3 +164,3 @@ mapper: { | ||
}; | ||
export var path = { | ||
export const path = { | ||
parameterPath: ["options", "path"], | ||
@@ -175,3 +175,3 @@ mapper: { | ||
}; | ||
export var recursive = { | ||
export const recursive = { | ||
parameterPath: "recursive", | ||
@@ -187,3 +187,3 @@ mapper: { | ||
}; | ||
export var upn = { | ||
export const upn = { | ||
parameterPath: ["options", "upn"], | ||
@@ -198,3 +198,3 @@ mapper: { | ||
}; | ||
export var accept1 = { | ||
export const accept1 = { | ||
parameterPath: "accept", | ||
@@ -210,3 +210,3 @@ mapper: { | ||
}; | ||
export var restype = { | ||
export const restype = { | ||
parameterPath: "restype", | ||
@@ -222,3 +222,3 @@ mapper: { | ||
}; | ||
export var comp = { | ||
export const comp = { | ||
parameterPath: "comp", | ||
@@ -234,3 +234,3 @@ mapper: { | ||
}; | ||
export var delimiter = { | ||
export const delimiter = { | ||
parameterPath: ["options", "delimiter"], | ||
@@ -245,3 +245,3 @@ mapper: { | ||
}; | ||
export var marker = { | ||
export const marker = { | ||
parameterPath: ["options", "marker"], | ||
@@ -256,3 +256,3 @@ mapper: { | ||
}; | ||
export var include = { | ||
export const include = { | ||
parameterPath: ["options", "include"], | ||
@@ -283,3 +283,3 @@ mapper: { | ||
}; | ||
export var showonly = { | ||
export const showonly = { | ||
parameterPath: ["options", "showonly"], | ||
@@ -295,3 +295,3 @@ mapper: { | ||
}; | ||
export var resource2 = { | ||
export const resource2 = { | ||
parameterPath: ["options", "resource"], | ||
@@ -307,3 +307,3 @@ mapper: { | ||
}; | ||
export var mode = { | ||
export const mode = { | ||
parameterPath: ["options", "mode"], | ||
@@ -319,3 +319,3 @@ mapper: { | ||
}; | ||
export var cacheControl = { | ||
export const cacheControl = { | ||
parameterPath: ["options", "pathHttpHeaders", "cacheControl"], | ||
@@ -330,3 +330,3 @@ mapper: { | ||
}; | ||
export var contentEncoding = { | ||
export const contentEncoding = { | ||
parameterPath: ["options", "pathHttpHeaders", "contentEncoding"], | ||
@@ -341,3 +341,3 @@ mapper: { | ||
}; | ||
export var contentLanguage = { | ||
export const contentLanguage = { | ||
parameterPath: ["options", "pathHttpHeaders", "contentLanguage"], | ||
@@ -352,3 +352,3 @@ mapper: { | ||
}; | ||
export var contentDisposition = { | ||
export const contentDisposition = { | ||
parameterPath: ["options", "pathHttpHeaders", "contentDisposition"], | ||
@@ -363,3 +363,3 @@ mapper: { | ||
}; | ||
export var contentType = { | ||
export const contentType = { | ||
parameterPath: ["options", "pathHttpHeaders", "contentType"], | ||
@@ -374,3 +374,3 @@ mapper: { | ||
}; | ||
export var renameSource = { | ||
export const renameSource = { | ||
parameterPath: ["options", "renameSource"], | ||
@@ -385,3 +385,3 @@ mapper: { | ||
}; | ||
export var leaseId = { | ||
export const leaseId = { | ||
parameterPath: ["options", "leaseAccessConditions", "leaseId"], | ||
@@ -396,3 +396,3 @@ mapper: { | ||
}; | ||
export var sourceLeaseId = { | ||
export const sourceLeaseId = { | ||
parameterPath: ["options", "sourceLeaseId"], | ||
@@ -407,3 +407,3 @@ mapper: { | ||
}; | ||
export var permissions = { | ||
export const permissions = { | ||
parameterPath: ["options", "permissions"], | ||
@@ -418,3 +418,3 @@ mapper: { | ||
}; | ||
export var umask = { | ||
export const umask = { | ||
parameterPath: ["options", "umask"], | ||
@@ -429,3 +429,3 @@ mapper: { | ||
}; | ||
export var ifMatch = { | ||
export const ifMatch = { | ||
parameterPath: ["options", "modifiedAccessConditions", "ifMatch"], | ||
@@ -440,3 +440,3 @@ mapper: { | ||
}; | ||
export var ifNoneMatch = { | ||
export const ifNoneMatch = { | ||
parameterPath: ["options", "modifiedAccessConditions", "ifNoneMatch"], | ||
@@ -451,3 +451,3 @@ mapper: { | ||
}; | ||
export var sourceIfMatch = { | ||
export const sourceIfMatch = { | ||
parameterPath: ["options", "sourceModifiedAccessConditions", "sourceIfMatch"], | ||
@@ -462,3 +462,3 @@ mapper: { | ||
}; | ||
export var sourceIfNoneMatch = { | ||
export const sourceIfNoneMatch = { | ||
parameterPath: [ | ||
@@ -477,3 +477,3 @@ "options", | ||
}; | ||
export var sourceIfModifiedSince = { | ||
export const sourceIfModifiedSince = { | ||
parameterPath: [ | ||
@@ -492,3 +492,3 @@ "options", | ||
}; | ||
export var sourceIfUnmodifiedSince = { | ||
export const sourceIfUnmodifiedSince = { | ||
parameterPath: [ | ||
@@ -507,3 +507,3 @@ "options", | ||
}; | ||
export var contentType1 = { | ||
export const contentType1 = { | ||
parameterPath: ["options", "contentType"], | ||
@@ -519,3 +519,3 @@ mapper: { | ||
}; | ||
export var body = { | ||
export const body = { | ||
parameterPath: "body", | ||
@@ -531,3 +531,3 @@ mapper: { | ||
}; | ||
export var accept2 = { | ||
export const accept2 = { | ||
parameterPath: "accept", | ||
@@ -543,3 +543,3 @@ mapper: { | ||
}; | ||
export var action = { | ||
export const action = { | ||
parameterPath: "action", | ||
@@ -562,3 +562,3 @@ mapper: { | ||
}; | ||
export var maxRecords = { | ||
export const maxRecords = { | ||
parameterPath: ["options", "maxRecords"], | ||
@@ -576,3 +576,3 @@ mapper: { | ||
}; | ||
export var mode1 = { | ||
export const mode1 = { | ||
parameterPath: "mode", | ||
@@ -589,3 +589,3 @@ mapper: { | ||
}; | ||
export var forceFlag = { | ||
export const forceFlag = { | ||
parameterPath: ["options", "forceFlag"], | ||
@@ -600,3 +600,3 @@ mapper: { | ||
}; | ||
export var position = { | ||
export const position = { | ||
parameterPath: ["options", "position"], | ||
@@ -611,3 +611,3 @@ mapper: { | ||
}; | ||
export var retainUncommittedData = { | ||
export const retainUncommittedData = { | ||
parameterPath: ["options", "retainUncommittedData"], | ||
@@ -622,3 +622,3 @@ mapper: { | ||
}; | ||
export var close = { | ||
export const close = { | ||
parameterPath: ["options", "close"], | ||
@@ -633,3 +633,3 @@ mapper: { | ||
}; | ||
export var contentLength = { | ||
export const contentLength = { | ||
parameterPath: ["options", "contentLength"], | ||
@@ -647,3 +647,3 @@ mapper: { | ||
}; | ||
export var contentMD5 = { | ||
export const contentMD5 = { | ||
parameterPath: ["options", "pathHttpHeaders", "contentMD5"], | ||
@@ -658,3 +658,3 @@ mapper: { | ||
}; | ||
export var owner = { | ||
export const owner = { | ||
parameterPath: ["options", "owner"], | ||
@@ -669,3 +669,3 @@ mapper: { | ||
}; | ||
export var group = { | ||
export const group = { | ||
parameterPath: ["options", "group"], | ||
@@ -680,3 +680,3 @@ mapper: { | ||
}; | ||
export var acl = { | ||
export const acl = { | ||
parameterPath: ["options", "acl"], | ||
@@ -691,3 +691,3 @@ mapper: { | ||
}; | ||
export var xMsLeaseAction = { | ||
export const xMsLeaseAction = { | ||
parameterPath: "xMsLeaseAction", | ||
@@ -704,3 +704,3 @@ mapper: { | ||
}; | ||
export var xMsLeaseDuration = { | ||
export const xMsLeaseDuration = { | ||
parameterPath: ["options", "xMsLeaseDuration"], | ||
@@ -715,3 +715,3 @@ mapper: { | ||
}; | ||
export var xMsLeaseBreakPeriod = { | ||
export const xMsLeaseBreakPeriod = { | ||
parameterPath: ["options", "xMsLeaseBreakPeriod"], | ||
@@ -726,3 +726,3 @@ mapper: { | ||
}; | ||
export var proposedLeaseId = { | ||
export const proposedLeaseId = { | ||
parameterPath: ["options", "proposedLeaseId"], | ||
@@ -737,3 +737,3 @@ mapper: { | ||
}; | ||
export var range = { | ||
export const range = { | ||
parameterPath: ["options", "range"], | ||
@@ -748,3 +748,3 @@ mapper: { | ||
}; | ||
export var xMsRangeGetContentMd5 = { | ||
export const xMsRangeGetContentMd5 = { | ||
parameterPath: ["options", "xMsRangeGetContentMd5"], | ||
@@ -759,3 +759,3 @@ mapper: { | ||
}; | ||
export var action1 = { | ||
export const action1 = { | ||
parameterPath: ["options", "action"], | ||
@@ -771,3 +771,3 @@ mapper: { | ||
}; | ||
export var recursive1 = { | ||
export const recursive1 = { | ||
parameterPath: ["options", "recursive"], | ||
@@ -782,3 +782,3 @@ mapper: { | ||
}; | ||
export var action2 = { | ||
export const action2 = { | ||
parameterPath: "action", | ||
@@ -794,3 +794,3 @@ mapper: { | ||
}; | ||
export var action3 = { | ||
export const action3 = { | ||
parameterPath: "action", | ||
@@ -806,3 +806,3 @@ mapper: { | ||
}; | ||
export var action4 = { | ||
export const action4 = { | ||
parameterPath: "action", | ||
@@ -818,3 +818,3 @@ mapper: { | ||
}; | ||
export var contentType2 = { | ||
export const contentType2 = { | ||
parameterPath: ["options", "contentType"], | ||
@@ -830,3 +830,3 @@ mapper: { | ||
}; | ||
export var action5 = { | ||
export const action5 = { | ||
parameterPath: "action", | ||
@@ -842,3 +842,3 @@ mapper: { | ||
}; | ||
export var transactionalContentHash = { | ||
export const transactionalContentHash = { | ||
parameterPath: ["options", "pathHttpHeaders", "transactionalContentHash"], | ||
@@ -853,3 +853,3 @@ mapper: { | ||
}; | ||
export var transactionalContentCrc64 = { | ||
export const transactionalContentCrc64 = { | ||
parameterPath: ["options", "transactionalContentCrc64"], | ||
@@ -864,3 +864,3 @@ mapper: { | ||
}; | ||
export var comp1 = { | ||
export const comp1 = { | ||
parameterPath: "comp", | ||
@@ -876,3 +876,3 @@ mapper: { | ||
}; | ||
export var expiryOptions = { | ||
export const expiryOptions = { | ||
parameterPath: "expiryOptions", | ||
@@ -894,3 +894,3 @@ mapper: { | ||
}; | ||
export var expiresOn = { | ||
export const expiresOn = { | ||
parameterPath: ["options", "expiresOn"], | ||
@@ -905,3 +905,3 @@ mapper: { | ||
}; | ||
export var comp2 = { | ||
export const comp2 = { | ||
parameterPath: "comp", | ||
@@ -917,3 +917,3 @@ mapper: { | ||
}; | ||
export var undeleteSource = { | ||
export const undeleteSource = { | ||
parameterPath: ["options", "undeleteSource"], | ||
@@ -920,0 +920,0 @@ mapper: { |
@@ -12,3 +12,3 @@ /* | ||
/** Class representing a FileSystem. */ | ||
var FileSystem = /** @class */ (function () { | ||
export class FileSystem { | ||
/** | ||
@@ -18,3 +18,3 @@ * Initialize a new instance of the class FileSystem class. | ||
*/ | ||
function FileSystem(client) { | ||
constructor(client) { | ||
this.client = client; | ||
@@ -27,8 +27,8 @@ } | ||
*/ | ||
FileSystem.prototype.create = function (options) { | ||
var operationArguments = { | ||
create(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, createOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -40,8 +40,8 @@ * Set properties for the FileSystem. This operation supports conditional HTTP requests. For more | ||
*/ | ||
FileSystem.prototype.setProperties = function (options) { | ||
var operationArguments = { | ||
setProperties(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, setPropertiesOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -51,8 +51,8 @@ * All system and user-defined filesystem properties are specified in the response headers. | ||
*/ | ||
FileSystem.prototype.getProperties = function (options) { | ||
var operationArguments = { | ||
getProperties(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -70,8 +70,8 @@ * Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same | ||
*/ | ||
FileSystem.prototype.delete = function (options) { | ||
var operationArguments = { | ||
delete(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -82,9 +82,9 @@ * List FileSystem paths and their properties. | ||
*/ | ||
FileSystem.prototype.listPaths = function (recursive, options) { | ||
var operationArguments = { | ||
recursive: recursive, | ||
listPaths(recursive, options) { | ||
const operationArguments = { | ||
recursive, | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, listPathsOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -94,15 +94,13 @@ * The List Blobs operation returns a list of the blobs under the specified container | ||
*/ | ||
FileSystem.prototype.listBlobHierarchySegment = function (options) { | ||
var operationArguments = { | ||
listBlobHierarchySegment(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, listBlobHierarchySegmentOperationSpec); | ||
}; | ||
return FileSystem; | ||
}()); | ||
export { FileSystem }; | ||
} | ||
} | ||
// Operation Specifications | ||
var xmlSerializer = new coreHttp.Serializer(Mappers, /* isXml */ true); | ||
var serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); | ||
var createOperationSpec = { | ||
const xmlSerializer = new coreHttp.Serializer(Mappers, /* isXml */ true); | ||
const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); | ||
const createOperationSpec = { | ||
path: "/{filesystem}", | ||
@@ -127,5 +125,5 @@ httpMethod: "PUT", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var setPropertiesOperationSpec = { | ||
const setPropertiesOperationSpec = { | ||
path: "/{filesystem}", | ||
@@ -152,5 +150,5 @@ httpMethod: "PATCH", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var getPropertiesOperationSpec = { | ||
const getPropertiesOperationSpec = { | ||
path: "/{filesystem}", | ||
@@ -174,5 +172,5 @@ httpMethod: "HEAD", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var deleteOperationSpec = { | ||
const deleteOperationSpec = { | ||
path: "/{filesystem}", | ||
@@ -198,5 +196,5 @@ httpMethod: "DELETE", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var listPathsOperationSpec = { | ||
const listPathsOperationSpec = { | ||
path: "/{filesystem}", | ||
@@ -229,5 +227,5 @@ httpMethod: "GET", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var listBlobHierarchySegmentOperationSpec = { | ||
const listBlobHierarchySegmentOperationSpec = { | ||
path: "/{filesystem}", | ||
@@ -234,0 +232,0 @@ httpMethod: "GET", |
@@ -12,3 +12,3 @@ /* | ||
/** Class representing a Path. */ | ||
var Path = /** @class */ (function () { | ||
export class Path { | ||
/** | ||
@@ -18,3 +18,3 @@ * Initialize a new instance of the class Path class. | ||
*/ | ||
function Path(client) { | ||
constructor(client) { | ||
this.client = client; | ||
@@ -30,8 +30,8 @@ } | ||
*/ | ||
Path.prototype.create = function (options) { | ||
var operationArguments = { | ||
create(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, createOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -57,11 +57,11 @@ * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets | ||
*/ | ||
Path.prototype.update = function (action, mode, body, options) { | ||
var operationArguments = { | ||
action: action, | ||
mode: mode, | ||
body: body, | ||
update(action, mode, body, options) { | ||
const operationArguments = { | ||
action, | ||
mode, | ||
body, | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, updateOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -83,9 +83,9 @@ * Create and manage a lease to restrict write and delete access to the path. This operation supports | ||
*/ | ||
Path.prototype.lease = function (xMsLeaseAction, options) { | ||
var operationArguments = { | ||
xMsLeaseAction: xMsLeaseAction, | ||
lease(xMsLeaseAction, options) { | ||
const operationArguments = { | ||
xMsLeaseAction, | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, leaseOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -98,8 +98,8 @@ * Read the contents of a file. For read operations, range requests are supported. This operation | ||
*/ | ||
Path.prototype.read = function (options) { | ||
var operationArguments = { | ||
read(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, readOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -113,8 +113,8 @@ * Get Properties returns all system and user defined properties for a path. Get Status returns all | ||
*/ | ||
Path.prototype.getProperties = function (options) { | ||
var operationArguments = { | ||
getProperties(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -126,8 +126,8 @@ * Delete the file or directory. This operation supports conditional HTTP requests. For more | ||
*/ | ||
Path.prototype.delete = function (options) { | ||
var operationArguments = { | ||
delete(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -137,8 +137,8 @@ * Set the owner, group, permissions, or access control list for a path. | ||
*/ | ||
Path.prototype.setAccessControl = function (options) { | ||
var operationArguments = { | ||
setAccessControl(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, setAccessControlOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -151,9 +151,9 @@ * Set the access control list for a path and subpaths. | ||
*/ | ||
Path.prototype.setAccessControlRecursive = function (mode, options) { | ||
var operationArguments = { | ||
mode: mode, | ||
setAccessControlRecursive(mode, options) { | ||
const operationArguments = { | ||
mode, | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, setAccessControlRecursiveOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -163,8 +163,8 @@ * Set the owner, group, permissions, or access control list for a path. | ||
*/ | ||
Path.prototype.flushData = function (options) { | ||
var operationArguments = { | ||
flushData(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, flushDataOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -175,9 +175,9 @@ * Append data to the file. | ||
*/ | ||
Path.prototype.appendData = function (body, options) { | ||
var operationArguments = { | ||
body: body, | ||
appendData(body, options) { | ||
const operationArguments = { | ||
body, | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, appendDataOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -188,9 +188,9 @@ * Sets the time a blob will expire and be deleted. | ||
*/ | ||
Path.prototype.setExpiry = function (expiryOptions, options) { | ||
var operationArguments = { | ||
expiryOptions: expiryOptions, | ||
setExpiry(expiryOptions, options) { | ||
const operationArguments = { | ||
expiryOptions, | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, setExpiryOperationSpec); | ||
}; | ||
} | ||
/** | ||
@@ -200,14 +200,12 @@ * Undelete a path that was previously soft deleted | ||
*/ | ||
Path.prototype.undelete = function (options) { | ||
var operationArguments = { | ||
undelete(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, undeleteOperationSpec); | ||
}; | ||
return Path; | ||
}()); | ||
export { Path }; | ||
} | ||
} | ||
// Operation Specifications | ||
var serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); | ||
var createOperationSpec = { | ||
const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); | ||
const createOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -255,5 +253,5 @@ httpMethod: "PUT", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var updateOperationSpec = { | ||
const updateOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -311,5 +309,5 @@ httpMethod: "PATCH", | ||
mediaType: "binary", | ||
serializer: serializer | ||
serializer | ||
}; | ||
var leaseOperationSpec = { | ||
const leaseOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -348,5 +346,5 @@ httpMethod: "POST", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var readOperationSpec = { | ||
const readOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -388,5 +386,5 @@ httpMethod: "GET", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var getPropertiesOperationSpec = { | ||
const getPropertiesOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -415,5 +413,5 @@ httpMethod: "HEAD", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var deleteOperationSpec = { | ||
const deleteOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -446,5 +444,5 @@ httpMethod: "DELETE", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var setAccessControlOperationSpec = { | ||
const setAccessControlOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -477,5 +475,5 @@ httpMethod: "PATCH", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var setAccessControlRecursiveOperationSpec = { | ||
const setAccessControlRecursiveOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -508,5 +506,5 @@ httpMethod: "PATCH", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var flushDataOperationSpec = { | ||
const flushDataOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -548,5 +546,5 @@ httpMethod: "PATCH", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var appendDataOperationSpec = { | ||
const appendDataOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -581,5 +579,5 @@ httpMethod: "PATCH", | ||
mediaType: "binary", | ||
serializer: serializer | ||
serializer | ||
}; | ||
var setExpiryOperationSpec = { | ||
const setExpiryOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -605,5 +603,5 @@ httpMethod: "PUT", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
var undeleteOperationSpec = { | ||
const undeleteOperationSpec = { | ||
path: "/{filesystem}/{path}", | ||
@@ -628,4 +626,4 @@ httpMethod: "PUT", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
//# sourceMappingURL=path.js.map |
@@ -12,3 +12,3 @@ /* | ||
/** Class representing a Service. */ | ||
var Service = /** @class */ (function () { | ||
export class Service { | ||
/** | ||
@@ -18,3 +18,3 @@ * Initialize a new instance of the class Service class. | ||
*/ | ||
function Service(client) { | ||
constructor(client) { | ||
this.client = client; | ||
@@ -26,14 +26,12 @@ } | ||
*/ | ||
Service.prototype.listFileSystems = function (options) { | ||
var operationArguments = { | ||
listFileSystems(options) { | ||
const operationArguments = { | ||
options: coreHttp.operationOptionsToRequestOptionsBase(options || {}) | ||
}; | ||
return this.client.sendOperationRequest(operationArguments, listFileSystemsOperationSpec); | ||
}; | ||
return Service; | ||
}()); | ||
export { Service }; | ||
} | ||
} | ||
// Operation Specifications | ||
var serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); | ||
var listFileSystemsOperationSpec = { | ||
const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); | ||
const listFileSystemsOperationSpec = { | ||
path: "/", | ||
@@ -64,4 +62,4 @@ httpMethod: "GET", | ||
], | ||
serializer: serializer | ||
serializer | ||
}; | ||
//# sourceMappingURL=service.js.map |
@@ -8,7 +8,5 @@ /* | ||
*/ | ||
import { __extends } from "tslib"; | ||
import { Service, FileSystem, Path } from "./operations"; | ||
import { StorageClientContext } from "./storageClientContext"; | ||
var StorageClient = /** @class */ (function (_super) { | ||
__extends(StorageClient, _super); | ||
export class StorageClient extends StorageClientContext { | ||
/** | ||
@@ -20,12 +18,9 @@ * Initializes a new instance of the StorageClient class. | ||
*/ | ||
function StorageClient(url, options) { | ||
var _this = _super.call(this, url, options) || this; | ||
_this.service = new Service(_this); | ||
_this.fileSystem = new FileSystem(_this); | ||
_this.path = new Path(_this); | ||
return _this; | ||
constructor(url, options) { | ||
super(url, options); | ||
this.service = new Service(this); | ||
this.fileSystem = new FileSystem(this); | ||
this.path = new Path(this); | ||
} | ||
return StorageClient; | ||
}(StorageClientContext)); | ||
export { StorageClient }; | ||
} | ||
//# sourceMappingURL=storageClient.js.map |
@@ -8,8 +8,6 @@ /* | ||
*/ | ||
import { __extends } from "tslib"; | ||
import * as coreHttp from "@azure/core-http"; | ||
var packageName = "azure-storage-datalake"; | ||
var packageVersion = "1.0.0"; | ||
var StorageClientContext = /** @class */ (function (_super) { | ||
__extends(StorageClientContext, _super); | ||
const packageName = "azure-storage-datalake"; | ||
const packageVersion = "12.6.0"; | ||
export class StorageClientContext extends coreHttp.ServiceClient { | ||
/** | ||
@@ -21,4 +19,3 @@ * Initializes a new instance of the StorageClientContext class. | ||
*/ | ||
function StorageClientContext(url, options) { | ||
var _this = this; | ||
constructor(url, options) { | ||
if (url === undefined) { | ||
@@ -32,18 +29,15 @@ throw new Error("'url' cannot be null"); | ||
if (!options.userAgent) { | ||
var defaultUserAgent = coreHttp.getDefaultUserAgentValue(); | ||
options.userAgent = packageName + "/" + packageVersion + " " + defaultUserAgent; | ||
const defaultUserAgent = coreHttp.getDefaultUserAgentValue(); | ||
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; | ||
} | ||
_this = _super.call(this, undefined, options) || this; | ||
_this.requestContentType = "application/json; charset=utf-8"; | ||
_this.baseUri = options.endpoint || "{url}"; | ||
super(undefined, options); | ||
this.requestContentType = "application/json; charset=utf-8"; | ||
this.baseUri = options.endpoint || "{url}"; | ||
// Parameter assignments | ||
_this.url = url; | ||
this.url = url; | ||
// Assigning values to Constant parameters | ||
_this.version = options.version || "2020-08-04"; | ||
_this.resource = options.resource || "filesystem"; | ||
return _this; | ||
this.version = options.version || "2020-08-04"; | ||
this.resource = options.resource || "filesystem"; | ||
} | ||
return StorageClientContext; | ||
}(coreHttp.ServiceClient)); | ||
export { StorageClientContext }; | ||
} | ||
//# sourceMappingURL=storageClientContext.js.map |
@@ -7,3 +7,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
export var logger = createClientLogger("storage-file-datalake"); | ||
export const logger = createClientLogger("storage-file-datalake"); | ||
//# sourceMappingURL=log.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __assign, __extends } from "tslib"; | ||
import { BaseRequestPolicy, bearerTokenAuthenticationPolicy, deserializationPolicy, disableResponseDecompressionPolicy, generateClientRequestIdPolicy, HttpHeaders, isNode, isTokenCredential, keepAlivePolicy, logPolicy, proxyPolicy, RequestPolicyOptions, tracingPolicy, WebResource } from "@azure/core-http"; | ||
@@ -26,4 +25,3 @@ import { AnonymousCredential } from "./credentials/AnonymousCredential"; | ||
*/ | ||
var Pipeline = /** @class */ (function (_super) { | ||
__extends(Pipeline, _super); | ||
export class Pipeline extends BlobPipeline { | ||
/** | ||
@@ -35,10 +33,8 @@ * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface. | ||
*/ | ||
function Pipeline(factories, options) { | ||
if (options === void 0) { options = {}; } | ||
var _this = _super.call(this, factories, options) || this; | ||
_this.factories = factories; | ||
constructor(factories, options = {}) { | ||
super(factories, options); | ||
this.factories = factories; | ||
// when options.httpClient is not specified, passing in a DefaultHttpClient instance to | ||
// avoid each client creating its own http client. | ||
_this.options = __assign(__assign({}, options), { httpClient: options.httpClient || getCachedDefaultHttpClient() }); | ||
return _this; | ||
this.options = Object.assign(Object.assign({}, options), { httpClient: options.httpClient || getCachedDefaultHttpClient() }); | ||
} | ||
@@ -51,3 +47,3 @@ /** | ||
*/ | ||
Pipeline.prototype.toServiceClientOptions = function () { | ||
toServiceClientOptions() { | ||
return { | ||
@@ -57,6 +53,4 @@ httpClient: this.options.httpClient, | ||
}; | ||
}; | ||
return Pipeline; | ||
}(BlobPipeline)); | ||
export { Pipeline }; | ||
} | ||
} | ||
/** | ||
@@ -69,4 +63,3 @@ * Creates a new Pipeline object with Credential provided. | ||
*/ | ||
export function newPipeline(credential, pipelineOptions) { | ||
if (pipelineOptions === void 0) { pipelineOptions = {}; } | ||
export function newPipeline(credential, pipelineOptions = {}) { | ||
if (credential === undefined) { | ||
@@ -78,4 +71,4 @@ credential = new AnonymousCredential(); | ||
// changes made by other factories (like UniqueRequestIDPolicyFactory) | ||
var telemetryPolicy = new TelemetryPolicyFactory(pipelineOptions.userAgentOptions); | ||
var factories = [ | ||
const telemetryPolicy = new TelemetryPolicyFactory(pipelineOptions.userAgentOptions); | ||
const factories = [ | ||
tracingPolicy({ userAgent: telemetryPolicy.telemetryString }), | ||
@@ -82,0 +75,0 @@ keepAlivePolicy(pipelineOptions.keepAliveOptions), |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __extends } from "tslib"; | ||
import { CredentialPolicy } from "./CredentialPolicy"; | ||
@@ -9,4 +8,3 @@ /** | ||
*/ | ||
var AnonymousCredentialPolicy = /** @class */ (function (_super) { | ||
__extends(AnonymousCredentialPolicy, _super); | ||
export class AnonymousCredentialPolicy extends CredentialPolicy { | ||
/** | ||
@@ -17,8 +15,6 @@ * Creates an instance of AnonymousCredentialPolicy. | ||
*/ | ||
function AnonymousCredentialPolicy(nextPolicy, options) { | ||
return _super.call(this, nextPolicy, options) || this; | ||
constructor(nextPolicy, options) { | ||
super(nextPolicy, options); | ||
} | ||
return AnonymousCredentialPolicy; | ||
}(CredentialPolicy)); | ||
export { AnonymousCredentialPolicy }; | ||
} | ||
//# sourceMappingURL=AnonymousCredentialPolicy.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __extends } from "tslib"; | ||
import { BaseRequestPolicy } from "@azure/core-http"; | ||
@@ -9,7 +8,3 @@ /** | ||
*/ | ||
var CredentialPolicy = /** @class */ (function (_super) { | ||
__extends(CredentialPolicy, _super); | ||
function CredentialPolicy() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
export class CredentialPolicy extends BaseRequestPolicy { | ||
/** | ||
@@ -20,5 +15,5 @@ * Sends out request. | ||
*/ | ||
CredentialPolicy.prototype.sendRequest = function (request) { | ||
sendRequest(request) { | ||
return this._nextPolicy.sendRequest(this.signRequest(request)); | ||
}; | ||
} | ||
/** | ||
@@ -30,10 +25,8 @@ * Child classes must implement this method with request signing. This method | ||
*/ | ||
CredentialPolicy.prototype.signRequest = function (request) { | ||
signRequest(request) { | ||
// Child classes must override this method with request signing. This method | ||
// will be executed in sendRequest(). | ||
return request; | ||
}; | ||
return CredentialPolicy; | ||
}(BaseRequestPolicy)); | ||
export { CredentialPolicy }; | ||
} | ||
} | ||
//# sourceMappingURL=CredentialPolicy.js.map |
@@ -1,2 +0,1 @@ | ||
import { __awaiter, __extends, __generator } from "tslib"; | ||
// Copyright (c) Microsoft Corporation. | ||
@@ -18,4 +17,3 @@ // Licensed under the MIT license. | ||
*/ | ||
var StorageBrowserPolicy = /** @class */ (function (_super) { | ||
__extends(StorageBrowserPolicy, _super); | ||
export class StorageBrowserPolicy extends BaseRequestPolicy { | ||
/** | ||
@@ -26,4 +24,4 @@ * Creates an instance of StorageBrowserPolicy. | ||
*/ | ||
function StorageBrowserPolicy(nextPolicy, options) { | ||
return _super.call(this, nextPolicy, options) || this; | ||
constructor(nextPolicy, options) { | ||
super(nextPolicy, options); | ||
} | ||
@@ -35,25 +33,19 @@ /** | ||
*/ | ||
StorageBrowserPolicy.prototype.sendRequest = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (isNode) { | ||
return [2 /*return*/, this._nextPolicy.sendRequest(request)]; | ||
} | ||
if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") { | ||
request.url = setURLParameter(request.url, UrlConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString()); | ||
} | ||
request.headers.remove(HeaderConstants.COOKIE); | ||
// According to XHR standards, content-length should be fully controlled by browsers | ||
request.headers.remove(HeaderConstants.CONTENT_LENGTH); | ||
// DFS flush file API requires content-length=0, workaround to force browsers add content-length header | ||
if (request.method === "PATCH" && request.body === undefined) { | ||
request.body = ""; | ||
} | ||
return [2 /*return*/, this._nextPolicy.sendRequest(request)]; | ||
}); | ||
}); | ||
}; | ||
return StorageBrowserPolicy; | ||
}(BaseRequestPolicy)); | ||
export { StorageBrowserPolicy }; | ||
async sendRequest(request) { | ||
if (isNode) { | ||
return this._nextPolicy.sendRequest(request); | ||
} | ||
if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") { | ||
request.url = setURLParameter(request.url, UrlConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString()); | ||
} | ||
request.headers.remove(HeaderConstants.COOKIE); | ||
// According to XHR standards, content-length should be fully controlled by browsers | ||
request.headers.remove(HeaderConstants.CONTENT_LENGTH); | ||
// DFS flush file API requires content-length=0, workaround to force browsers add content-length header | ||
if (request.method === "PATCH" && request.body === undefined) { | ||
request.body = ""; | ||
} | ||
return this._nextPolicy.sendRequest(request); | ||
} | ||
} | ||
//# sourceMappingURL=StorageBrowserPolicy.js.map |
@@ -1,2 +0,1 @@ | ||
import { __awaiter, __extends, __generator } from "tslib"; | ||
// Copyright (c) Microsoft Corporation. | ||
@@ -16,3 +15,3 @@ // Licensed under the MIT license. | ||
return { | ||
create: function (nextPolicy, options) { | ||
create: (nextPolicy, options) => { | ||
return new StorageRetryPolicy(nextPolicy, options, retryOptions); | ||
@@ -37,3 +36,3 @@ } | ||
// Default values of StorageRetryOptions | ||
var DEFAULT_RETRY_OPTIONS = { | ||
const DEFAULT_RETRY_OPTIONS = { | ||
maxRetryDelayInMs: 120 * 1000, | ||
@@ -46,8 +45,7 @@ maxTries: 4, | ||
}; | ||
var RETRY_ABORT_ERROR = new AbortError("The operation was aborted."); | ||
const RETRY_ABORT_ERROR = new AbortError("The operation was aborted."); | ||
/** | ||
* Retry policy with exponential retry and linear retry implemented. | ||
*/ | ||
var StorageRetryPolicy = /** @class */ (function (_super) { | ||
__extends(StorageRetryPolicy, _super); | ||
export class StorageRetryPolicy extends BaseRequestPolicy { | ||
/** | ||
@@ -60,7 +58,6 @@ * Creates an instance of RetryPolicy. | ||
*/ | ||
function StorageRetryPolicy(nextPolicy, options, retryOptions) { | ||
if (retryOptions === void 0) { retryOptions = DEFAULT_RETRY_OPTIONS; } | ||
var _this = _super.call(this, nextPolicy, options) || this; | ||
constructor(nextPolicy, options, retryOptions = DEFAULT_RETRY_OPTIONS) { | ||
super(nextPolicy, options); | ||
// Initialize retry options | ||
_this.retryOptions = { | ||
this.retryOptions = { | ||
retryPolicyType: retryOptions.retryPolicyType | ||
@@ -87,3 +84,2 @@ ? retryOptions.retryPolicyType | ||
}; | ||
return _this; | ||
} | ||
@@ -95,9 +91,5 @@ /** | ||
*/ | ||
StorageRetryPolicy.prototype.sendRequest = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.attemptSendRequest(request, false, 1)]; | ||
}); | ||
}); | ||
}; | ||
async sendRequest(request) { | ||
return this.attemptSendRequest(request, false, 1); | ||
} | ||
/** | ||
@@ -113,48 +105,33 @@ * Decide and perform next retry. Won't mutate request parameter. | ||
*/ | ||
StorageRetryPolicy.prototype.attemptSendRequest = function (request, secondaryHas404, attempt) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var newRequest, isPrimaryRetry, response, err_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
newRequest = request.clone(); | ||
isPrimaryRetry = secondaryHas404 || | ||
!this.retryOptions.secondaryHost || | ||
!(request.method === "GET" || request.method === "HEAD" || request.method === "OPTIONS") || | ||
attempt % 2 === 1; | ||
if (!isPrimaryRetry) { | ||
newRequest.url = setURLHost(newRequest.url, this.retryOptions.secondaryHost); | ||
} | ||
// Set the server-side timeout query parameter "timeout=[seconds]" | ||
if (this.retryOptions.tryTimeoutInMs) { | ||
newRequest.url = setURLParameter(newRequest.url, UrlConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString()); | ||
} | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
logger.info("RetryPolicy: =====> Try=" + attempt + " " + (isPrimaryRetry ? "Primary" : "Secondary")); | ||
return [4 /*yield*/, this._nextPolicy.sendRequest(newRequest)]; | ||
case 2: | ||
response = _a.sent(); | ||
if (!this.shouldRetry(isPrimaryRetry, attempt, response)) { | ||
return [2 /*return*/, response]; | ||
} | ||
secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
err_1 = _a.sent(); | ||
logger.error("RetryPolicy: Caught error, message: " + err_1.message + ", code: " + err_1.code); | ||
if (!this.shouldRetry(isPrimaryRetry, attempt, response, err_1)) { | ||
throw err_1; | ||
} | ||
return [3 /*break*/, 4]; | ||
case 4: return [4 /*yield*/, this.delay(isPrimaryRetry, attempt, request.abortSignal)]; | ||
case 5: | ||
_a.sent(); | ||
return [4 /*yield*/, this.attemptSendRequest(request, secondaryHas404, ++attempt)]; | ||
case 6: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
async attemptSendRequest(request, secondaryHas404, attempt) { | ||
const newRequest = request.clone(); | ||
const isPrimaryRetry = secondaryHas404 || | ||
!this.retryOptions.secondaryHost || | ||
!(request.method === "GET" || request.method === "HEAD" || request.method === "OPTIONS") || | ||
attempt % 2 === 1; | ||
if (!isPrimaryRetry) { | ||
newRequest.url = setURLHost(newRequest.url, this.retryOptions.secondaryHost); | ||
} | ||
// Set the server-side timeout query parameter "timeout=[seconds]" | ||
if (this.retryOptions.tryTimeoutInMs) { | ||
newRequest.url = setURLParameter(newRequest.url, UrlConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString()); | ||
} | ||
let response; | ||
try { | ||
logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); | ||
response = await this._nextPolicy.sendRequest(newRequest); | ||
if (!this.shouldRetry(isPrimaryRetry, attempt, response)) { | ||
return response; | ||
} | ||
secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404); | ||
} | ||
catch (err) { | ||
logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`); | ||
if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) { | ||
throw err; | ||
} | ||
} | ||
await this.delay(isPrimaryRetry, attempt, request.abortSignal); | ||
return await this.attemptSendRequest(request, secondaryHas404, ++attempt); | ||
} | ||
/** | ||
@@ -168,6 +145,6 @@ * Decide whether to retry according to last HTTP response and retry counters. | ||
*/ | ||
StorageRetryPolicy.prototype.shouldRetry = function (isPrimaryRetry, attempt, response, err) { | ||
shouldRetry(isPrimaryRetry, attempt, response, err) { | ||
if (attempt >= this.retryOptions.maxTries) { | ||
logger.info("RetryPolicy: Attempt(s) " + attempt + " >= maxTries " + this.retryOptions | ||
.maxTries + ", no further try."); | ||
logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions | ||
.maxTries}, no further try.`); | ||
return false; | ||
@@ -177,3 +154,3 @@ } | ||
// your own http client | ||
var retriableErrors = [ | ||
const retriableErrors = [ | ||
"ETIMEDOUT", | ||
@@ -190,8 +167,7 @@ "ESOCKETTIMEDOUT", | ||
if (err) { | ||
for (var _i = 0, retriableErrors_1 = retriableErrors; _i < retriableErrors_1.length; _i++) { | ||
var retriableError = retriableErrors_1[_i]; | ||
for (const retriableError of retriableErrors) { | ||
if (err.name.toUpperCase().includes(retriableError) || | ||
err.message.toUpperCase().includes(retriableError) || | ||
(err.code && err.code.toString().toUpperCase() === retriableError)) { | ||
logger.info("RetryPolicy: Network error " + retriableError + " found, will retry."); | ||
logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`); | ||
return true; | ||
@@ -205,5 +181,5 @@ } | ||
if (response || err) { | ||
var statusCode = response ? response.status : err ? err.statusCode : 0; | ||
const statusCode = response ? response.status : err ? err.statusCode : 0; | ||
if (!isPrimaryRetry && statusCode === 404) { | ||
logger.info("RetryPolicy: Secondary access with 404, will retry."); | ||
logger.info(`RetryPolicy: Secondary access with 404, will retry.`); | ||
return true; | ||
@@ -213,7 +189,7 @@ } | ||
if (statusCode === 503 || statusCode === 500) { | ||
logger.info("RetryPolicy: Will retry for status code " + statusCode + "."); | ||
logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`); | ||
return true; | ||
} | ||
} | ||
if ((err === null || err === void 0 ? void 0 : err.code) === "PARSE_ERROR" && (err === null || err === void 0 ? void 0 : err.message.startsWith("Error \"Error: Unclosed root tag"))) { | ||
if ((err === null || err === void 0 ? void 0 : err.code) === "PARSE_ERROR" && (err === null || err === void 0 ? void 0 : err.message.startsWith(`Error "Error: Unclosed root tag`))) { | ||
logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry."); | ||
@@ -223,3 +199,3 @@ return true; | ||
return false; | ||
}; | ||
} | ||
/** | ||
@@ -232,28 +208,21 @@ * Delay a calculated time between retries. | ||
*/ | ||
StorageRetryPolicy.prototype.delay = function (isPrimaryRetry, attempt, abortSignal) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var delayTimeInMs; | ||
return __generator(this, function (_a) { | ||
delayTimeInMs = 0; | ||
if (isPrimaryRetry) { | ||
switch (this.retryOptions.retryPolicyType) { | ||
case StorageRetryPolicyType.EXPONENTIAL: | ||
delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * this.retryOptions.retryDelayInMs, this.retryOptions.maxRetryDelayInMs); | ||
break; | ||
case StorageRetryPolicyType.FIXED: | ||
delayTimeInMs = this.retryOptions.retryDelayInMs; | ||
break; | ||
} | ||
} | ||
else { | ||
delayTimeInMs = Math.random() * 1000; | ||
} | ||
logger.info("RetryPolicy: Delay for " + delayTimeInMs + "ms"); | ||
return [2 /*return*/, delay(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR)]; | ||
}); | ||
}); | ||
}; | ||
return StorageRetryPolicy; | ||
}(BaseRequestPolicy)); | ||
export { StorageRetryPolicy }; | ||
async delay(isPrimaryRetry, attempt, abortSignal) { | ||
let delayTimeInMs = 0; | ||
if (isPrimaryRetry) { | ||
switch (this.retryOptions.retryPolicyType) { | ||
case StorageRetryPolicyType.EXPONENTIAL: | ||
delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * this.retryOptions.retryDelayInMs, this.retryOptions.maxRetryDelayInMs); | ||
break; | ||
case StorageRetryPolicyType.FIXED: | ||
delayTimeInMs = this.retryOptions.retryDelayInMs; | ||
break; | ||
} | ||
} | ||
else { | ||
delayTimeInMs = Math.random() * 1000; | ||
} | ||
logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`); | ||
return delay(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR); | ||
} | ||
} | ||
//# sourceMappingURL=StorageRetryPolicy.js.map |
@@ -1,2 +0,1 @@ | ||
import { __extends } from "tslib"; | ||
import { HeaderConstants } from "../utils/constants"; | ||
@@ -8,4 +7,3 @@ import { getURLPath, getURLQueries } from "../utils/utils.common"; | ||
*/ | ||
var StorageSharedKeyCredentialPolicy = /** @class */ (function (_super) { | ||
__extends(StorageSharedKeyCredentialPolicy, _super); | ||
export class StorageSharedKeyCredentialPolicy extends CredentialPolicy { | ||
/** | ||
@@ -17,6 +15,5 @@ * Creates an instance of StorageSharedKeyCredentialPolicy. | ||
*/ | ||
function StorageSharedKeyCredentialPolicy(nextPolicy, options, factory) { | ||
var _this = _super.call(this, nextPolicy, options) || this; | ||
_this.factory = factory; | ||
return _this; | ||
constructor(nextPolicy, options, factory) { | ||
super(nextPolicy, options); | ||
this.factory = factory; | ||
} | ||
@@ -28,3 +25,3 @@ /** | ||
*/ | ||
StorageSharedKeyCredentialPolicy.prototype.signRequest = function (request) { | ||
signRequest(request) { | ||
request.headers.set(HeaderConstants.X_MS_DATE, new Date().toUTCString()); | ||
@@ -34,3 +31,3 @@ if (request.body && typeof request.body === "string" && request.body.length > 0) { | ||
} | ||
var stringToSign = [ | ||
const stringToSign = [ | ||
request.method.toUpperCase(), | ||
@@ -52,4 +49,4 @@ this.getHeaderValueToSign(request, HeaderConstants.CONTENT_LANGUAGE), | ||
this.getCanonicalizedResourceString(request); | ||
var signature = this.factory.computeHMACSHA256(stringToSign); | ||
request.headers.set(HeaderConstants.AUTHORIZATION, "SharedKey " + this.factory.accountName + ":" + signature); | ||
const signature = this.factory.computeHMACSHA256(stringToSign); | ||
request.headers.set(HeaderConstants.AUTHORIZATION, `SharedKey ${this.factory.accountName}:${signature}`); | ||
// Workaround for node-fetch which will set content-type for dfs append data operations based on Patch | ||
@@ -64,3 +61,3 @@ if (typeof request.body !== "function" && !request.headers.get(HeaderConstants.CONTENT_TYPE)) { | ||
return request; | ||
}; | ||
} | ||
/** | ||
@@ -73,4 +70,4 @@ * Retrieve header value according to shared key sign rules. | ||
*/ | ||
StorageSharedKeyCredentialPolicy.prototype.getHeaderValueToSign = function (request, headerName) { | ||
var value = request.headers.get(headerName); | ||
getHeaderValueToSign(request, headerName) { | ||
const value = request.headers.get(headerName); | ||
if (!value) { | ||
@@ -86,3 +83,3 @@ return ""; | ||
return value; | ||
}; | ||
} | ||
/** | ||
@@ -101,11 +98,11 @@ * To construct the CanonicalizedHeaders portion of the signature string, follow these steps: | ||
*/ | ||
StorageSharedKeyCredentialPolicy.prototype.getCanonicalizedHeadersString = function (request) { | ||
var headersArray = request.headers.headersArray().filter(function (value) { | ||
getCanonicalizedHeadersString(request) { | ||
let headersArray = request.headers.headersArray().filter((value) => { | ||
return value.name.toLowerCase().startsWith(HeaderConstants.PREFIX_FOR_STORAGE); | ||
}); | ||
headersArray.sort(function (a, b) { | ||
headersArray.sort((a, b) => { | ||
return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); | ||
}); | ||
// Remove duplicate headers | ||
headersArray = headersArray.filter(function (value, index, array) { | ||
headersArray = headersArray.filter((value, index, array) => { | ||
if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) { | ||
@@ -116,10 +113,10 @@ return false; | ||
}); | ||
var canonicalizedHeadersStringToSign = ""; | ||
headersArray.forEach(function (header) { | ||
canonicalizedHeadersStringToSign += header.name | ||
let canonicalizedHeadersStringToSign = ""; | ||
headersArray.forEach((header) => { | ||
canonicalizedHeadersStringToSign += `${header.name | ||
.toLowerCase() | ||
.trimRight() + ":" + header.value.trimLeft() + "\n"; | ||
.trimRight()}:${header.value.trimLeft()}\n`; | ||
}); | ||
return canonicalizedHeadersStringToSign; | ||
}; | ||
} | ||
/** | ||
@@ -130,13 +127,13 @@ * Retrieves the webResource canonicalized resource string. | ||
*/ | ||
StorageSharedKeyCredentialPolicy.prototype.getCanonicalizedResourceString = function (request) { | ||
var path = getURLPath(request.url) || "/"; | ||
var canonicalizedResourceString = ""; | ||
canonicalizedResourceString += "/" + this.factory.accountName + path; | ||
var queries = getURLQueries(request.url); | ||
var lowercaseQueries = {}; | ||
getCanonicalizedResourceString(request) { | ||
const path = getURLPath(request.url) || "/"; | ||
let canonicalizedResourceString = ""; | ||
canonicalizedResourceString += `/${this.factory.accountName}${path}`; | ||
const queries = getURLQueries(request.url); | ||
const lowercaseQueries = {}; | ||
if (queries) { | ||
var queryKeys = []; | ||
for (var key in queries) { | ||
const queryKeys = []; | ||
for (const key in queries) { | ||
if (queries.hasOwnProperty(key)) { | ||
var lowercaseKey = key.toLowerCase(); | ||
const lowercaseKey = key.toLowerCase(); | ||
lowercaseQueries[lowercaseKey] = queries[key]; | ||
@@ -147,12 +144,9 @@ queryKeys.push(lowercaseKey); | ||
queryKeys.sort(); | ||
for (var _i = 0, queryKeys_1 = queryKeys; _i < queryKeys_1.length; _i++) { | ||
var key = queryKeys_1[_i]; | ||
canonicalizedResourceString += "\n" + key + ":" + decodeURIComponent(lowercaseQueries[key]); | ||
for (const key of queryKeys) { | ||
canonicalizedResourceString += `\n${key}:${decodeURIComponent(lowercaseQueries[key])}`; | ||
} | ||
} | ||
return canonicalizedResourceString; | ||
}; | ||
return StorageSharedKeyCredentialPolicy; | ||
}(CredentialPolicy)); | ||
export { StorageSharedKeyCredentialPolicy }; | ||
} | ||
} | ||
//# sourceMappingURL=StorageSharedKeyCredentialPolicy.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __awaiter, __extends, __generator } from "tslib"; | ||
import { BaseRequestPolicy, HttpHeaders, isNode } from "@azure/core-http"; | ||
@@ -9,4 +8,3 @@ import { HeaderConstants } from "../utils/constants"; | ||
*/ | ||
var TelemetryPolicy = /** @class */ (function (_super) { | ||
__extends(TelemetryPolicy, _super); | ||
export class TelemetryPolicy extends BaseRequestPolicy { | ||
/** | ||
@@ -18,6 +16,5 @@ * Creates an instance of TelemetryPolicy. | ||
*/ | ||
function TelemetryPolicy(nextPolicy, options, telemetry) { | ||
var _this = _super.call(this, nextPolicy, options) || this; | ||
_this.telemetry = telemetry; | ||
return _this; | ||
constructor(nextPolicy, options, telemetry) { | ||
super(nextPolicy, options); | ||
this.telemetry = telemetry; | ||
} | ||
@@ -29,20 +26,14 @@ /** | ||
*/ | ||
TelemetryPolicy.prototype.sendRequest = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (isNode) { | ||
if (!request.headers) { | ||
request.headers = new HttpHeaders(); | ||
} | ||
if (!request.headers.get(HeaderConstants.USER_AGENT)) { | ||
request.headers.set(HeaderConstants.USER_AGENT, this.telemetry); | ||
} | ||
} | ||
return [2 /*return*/, this._nextPolicy.sendRequest(request)]; | ||
}); | ||
}); | ||
}; | ||
return TelemetryPolicy; | ||
}(BaseRequestPolicy)); | ||
export { TelemetryPolicy }; | ||
async sendRequest(request) { | ||
if (isNode) { | ||
if (!request.headers) { | ||
request.headers = new HttpHeaders(); | ||
} | ||
if (!request.headers.get(HeaderConstants.USER_AGENT)) { | ||
request.headers.set(HeaderConstants.USER_AGENT, this.telemetry); | ||
} | ||
} | ||
return this._nextPolicy.sendRequest(request); | ||
} | ||
} | ||
//# sourceMappingURL=TelemetryPolicy.js.map |
@@ -12,4 +12,4 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var AccountSASPermissions = /** @class */ (function () { | ||
function AccountSASPermissions() { | ||
export class AccountSASPermissions { | ||
constructor() { | ||
/** | ||
@@ -53,6 +53,5 @@ * Permission to read resources and list queues and tables granted. | ||
*/ | ||
AccountSASPermissions.parse = function (permissions) { | ||
var accountSASPermissions = new AccountSASPermissions(); | ||
for (var _i = 0, permissions_1 = permissions; _i < permissions_1.length; _i++) { | ||
var c = permissions_1[_i]; | ||
static parse(permissions) { | ||
const accountSASPermissions = new AccountSASPermissions(); | ||
for (const c of permissions) { | ||
switch (c) { | ||
@@ -84,7 +83,7 @@ case "r": | ||
default: | ||
throw new RangeError("Invalid permission character: " + c); | ||
throw new RangeError(`Invalid permission character: ${c}`); | ||
} | ||
} | ||
return accountSASPermissions; | ||
}; | ||
} | ||
/** | ||
@@ -100,7 +99,7 @@ * Produces the SAS permissions string for an Azure Storage account. | ||
*/ | ||
AccountSASPermissions.prototype.toString = function () { | ||
toString() { | ||
// The order of the characters should be as specified here to ensure correctness: | ||
// https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas | ||
// Use a string array instead of string concatenating += operator for performance | ||
var permissions = []; | ||
const permissions = []; | ||
if (this.read) { | ||
@@ -131,6 +130,4 @@ permissions.push("r"); | ||
return permissions.join(""); | ||
}; | ||
return AccountSASPermissions; | ||
}()); | ||
export { AccountSASPermissions }; | ||
} | ||
} | ||
//# sourceMappingURL=AccountSASPermissions.js.map |
@@ -12,4 +12,4 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var AccountSASResourceTypes = /** @class */ (function () { | ||
function AccountSASResourceTypes() { | ||
export class AccountSASResourceTypes { | ||
constructor() { | ||
/** | ||
@@ -34,6 +34,5 @@ * Permission to access service level APIs granted. | ||
*/ | ||
AccountSASResourceTypes.parse = function (resourceTypes) { | ||
var accountSASResourceTypes = new AccountSASResourceTypes(); | ||
for (var _i = 0, resourceTypes_1 = resourceTypes; _i < resourceTypes_1.length; _i++) { | ||
var c = resourceTypes_1[_i]; | ||
static parse(resourceTypes) { | ||
const accountSASResourceTypes = new AccountSASResourceTypes(); | ||
for (const c of resourceTypes) { | ||
switch (c) { | ||
@@ -50,7 +49,7 @@ case "s": | ||
default: | ||
throw new RangeError("Invalid resource type: " + c); | ||
throw new RangeError(`Invalid resource type: ${c}`); | ||
} | ||
} | ||
return accountSASResourceTypes; | ||
}; | ||
} | ||
/** | ||
@@ -62,4 +61,4 @@ * Converts the given resource types to a string. | ||
*/ | ||
AccountSASResourceTypes.prototype.toString = function () { | ||
var resourceTypes = []; | ||
toString() { | ||
const resourceTypes = []; | ||
if (this.service) { | ||
@@ -75,6 +74,4 @@ resourceTypes.push("s"); | ||
return resourceTypes.join(""); | ||
}; | ||
return AccountSASResourceTypes; | ||
}()); | ||
export { AccountSASResourceTypes }; | ||
} | ||
} | ||
//# sourceMappingURL=AccountSASResourceTypes.js.map |
@@ -12,4 +12,4 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var AccountSASServices = /** @class */ (function () { | ||
function AccountSASServices() { | ||
export class AccountSASServices { | ||
constructor() { | ||
/** | ||
@@ -38,6 +38,5 @@ * Permission to access blob and data lake resources granted. | ||
*/ | ||
AccountSASServices.parse = function (services) { | ||
var accountSASServices = new AccountSASServices(); | ||
for (var _i = 0, services_1 = services; _i < services_1.length; _i++) { | ||
var c = services_1[_i]; | ||
static parse(services) { | ||
const accountSASServices = new AccountSASServices(); | ||
for (const c of services) { | ||
switch (c) { | ||
@@ -57,7 +56,7 @@ case "b": | ||
default: | ||
throw new RangeError("Invalid service character: " + c); | ||
throw new RangeError(`Invalid service character: ${c}`); | ||
} | ||
} | ||
return accountSASServices; | ||
}; | ||
} | ||
/** | ||
@@ -67,4 +66,4 @@ * Converts the given services to a string. | ||
*/ | ||
AccountSASServices.prototype.toString = function () { | ||
var services = []; | ||
toString() { | ||
const services = []; | ||
if (this.blob) { | ||
@@ -83,6 +82,4 @@ services.push("b"); | ||
return services.join(""); | ||
}; | ||
return AccountSASServices; | ||
}()); | ||
export { AccountSASServices }; | ||
} | ||
} | ||
//# sourceMappingURL=AccountSASServices.js.map |
@@ -22,9 +22,9 @@ // Copyright (c) Microsoft Corporation. | ||
export function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyCredential) { | ||
var version = accountSASSignatureValues.version | ||
const version = accountSASSignatureValues.version | ||
? accountSASSignatureValues.version | ||
: SERVICE_VERSION; | ||
var parsedPermissions = AccountSASPermissions.parse(accountSASSignatureValues.permissions.toString()); | ||
var parsedServices = AccountSASServices.parse(accountSASSignatureValues.services).toString(); | ||
var parsedResourceTypes = AccountSASResourceTypes.parse(accountSASSignatureValues.resourceTypes).toString(); | ||
var stringToSign = [ | ||
const parsedPermissions = AccountSASPermissions.parse(accountSASSignatureValues.permissions.toString()); | ||
const parsedServices = AccountSASServices.parse(accountSASSignatureValues.services).toString(); | ||
const parsedResourceTypes = AccountSASResourceTypes.parse(accountSASSignatureValues.resourceTypes).toString(); | ||
const stringToSign = [ | ||
sharedKeyCredential.accountName, | ||
@@ -43,5 +43,5 @@ parsedPermissions, | ||
].join("\n"); | ||
var signature = sharedKeyCredential.computeHMACSHA256(stringToSign); | ||
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); | ||
return new SASQueryParameters(version, signature, parsedPermissions.toString(), parsedServices, parsedResourceTypes, accountSASSignatureValues.protocol, accountSASSignatureValues.startsOn, accountSASSignatureValues.expiresOn, accountSASSignatureValues.ipRange); | ||
} | ||
//# sourceMappingURL=AccountSASSignatureValues.js.map |
@@ -12,4 +12,4 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var DataLakeSASPermissions = /** @class */ (function () { | ||
function DataLakeSASPermissions() { | ||
export class DataLakeSASPermissions { | ||
constructor() { | ||
/** | ||
@@ -61,6 +61,5 @@ * Specifies Read access granted. | ||
*/ | ||
DataLakeSASPermissions.parse = function (permissions) { | ||
var blobSASPermissions = new DataLakeSASPermissions(); | ||
for (var _i = 0, permissions_1 = permissions; _i < permissions_1.length; _i++) { | ||
var char = permissions_1[_i]; | ||
static parse(permissions) { | ||
const blobSASPermissions = new DataLakeSASPermissions(); | ||
for (const char of permissions) { | ||
switch (char) { | ||
@@ -95,7 +94,7 @@ case "r": | ||
default: | ||
throw new RangeError("Invalid permission: " + char); | ||
throw new RangeError(`Invalid permission: ${char}`); | ||
} | ||
} | ||
return blobSASPermissions; | ||
}; | ||
} | ||
/** | ||
@@ -107,4 +106,4 @@ * Converts the given permissions to a string. Using this method will guarantee the permissions are in an | ||
*/ | ||
DataLakeSASPermissions.prototype.toString = function () { | ||
var permissions = []; | ||
toString() { | ||
const permissions = []; | ||
if (this.read) { | ||
@@ -138,6 +137,4 @@ permissions.push("r"); | ||
return permissions.join(""); | ||
}; | ||
return DataLakeSASPermissions; | ||
}()); | ||
export { DataLakeSASPermissions }; | ||
} | ||
} | ||
//# sourceMappingURL=DataLakeSASPermissions.js.map |
@@ -13,9 +13,9 @@ // Copyright (c) Microsoft Corporation. | ||
export function generateDataLakeSASQueryParameters(dataLakeSASSignatureValues, sharedKeyCredentialOrUserDelegationKey, accountName) { | ||
var version = dataLakeSASSignatureValues.version | ||
const version = dataLakeSASSignatureValues.version | ||
? dataLakeSASSignatureValues.version | ||
: SERVICE_VERSION; | ||
var sharedKeyCredential = sharedKeyCredentialOrUserDelegationKey instanceof StorageSharedKeyCredential | ||
const sharedKeyCredential = sharedKeyCredentialOrUserDelegationKey instanceof StorageSharedKeyCredential | ||
? sharedKeyCredentialOrUserDelegationKey | ||
: undefined; | ||
var userDelegationKeyCredential; | ||
let userDelegationKeyCredential; | ||
if (sharedKeyCredential === undefined && accountName !== undefined) { | ||
@@ -74,7 +74,7 @@ userDelegationKeyCredential = new UserDelegationKeyCredential(accountName, sharedKeyCredentialOrUserDelegationKey); | ||
} | ||
var version = dataLakeSASSignatureValues.version | ||
const version = dataLakeSASSignatureValues.version | ||
? dataLakeSASSignatureValues.version | ||
: SERVICE_VERSION; | ||
dataLakeSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(dataLakeSASSignatureValues, version); | ||
var resource = "c"; | ||
let resource = "c"; | ||
if (dataLakeSASSignatureValues.pathName) { | ||
@@ -84,3 +84,3 @@ resource = "b"; | ||
// Calling parse and toString guarantees the proper ordering and throws on invalid characters. | ||
var verifiedPermissions; | ||
let verifiedPermissions; | ||
if (dataLakeSASSignatureValues.permissions) { | ||
@@ -95,3 +95,3 @@ if (dataLakeSASSignatureValues.pathName) { | ||
// Signature is generated on the un-url-encoded values. | ||
var stringToSign = [ | ||
const stringToSign = [ | ||
verifiedPermissions ? verifiedPermissions : "", | ||
@@ -117,3 +117,3 @@ dataLakeSASSignatureValues.startsOn | ||
].join("\n"); | ||
var signature = sharedKeyCredential.computeHMACSHA256(stringToSign); | ||
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); | ||
return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, dataLakeSASSignatureValues.protocol, dataLakeSASSignatureValues.startsOn, dataLakeSASSignatureValues.expiresOn, dataLakeSASSignatureValues.ipRange, dataLakeSASSignatureValues.identifier, resource, dataLakeSASSignatureValues.cacheControl, dataLakeSASSignatureValues.contentDisposition, dataLakeSASSignatureValues.contentEncoding, dataLakeSASSignatureValues.contentLanguage, dataLakeSASSignatureValues.contentType); | ||
@@ -142,7 +142,7 @@ } | ||
} | ||
var version = dataLakeSASSignatureValues.version | ||
const version = dataLakeSASSignatureValues.version | ||
? dataLakeSASSignatureValues.version | ||
: SERVICE_VERSION; | ||
dataLakeSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(dataLakeSASSignatureValues, version); | ||
var resource = "c"; | ||
let resource = "c"; | ||
if (dataLakeSASSignatureValues.pathName) { | ||
@@ -160,3 +160,3 @@ if (dataLakeSASSignatureValues.isDirectory) { | ||
// Calling parse and toString guarantees the proper ordering and throws on invalid characters. | ||
var verifiedPermissions; | ||
let verifiedPermissions; | ||
if (dataLakeSASSignatureValues.permissions) { | ||
@@ -176,3 +176,3 @@ if (dataLakeSASSignatureValues.pathName) { | ||
// Signature is generated on the un-url-encoded values. | ||
var stringToSign = [ | ||
const stringToSign = [ | ||
verifiedPermissions ? verifiedPermissions : "", | ||
@@ -200,3 +200,3 @@ dataLakeSASSignatureValues.startsOn | ||
].join("\n"); | ||
var signature = sharedKeyCredential.computeHMACSHA256(stringToSign); | ||
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); | ||
return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, dataLakeSASSignatureValues.protocol, dataLakeSASSignatureValues.startsOn, dataLakeSASSignatureValues.expiresOn, dataLakeSASSignatureValues.ipRange, dataLakeSASSignatureValues.identifier, resource, dataLakeSASSignatureValues.cacheControl, dataLakeSASSignatureValues.contentDisposition, dataLakeSASSignatureValues.contentEncoding, dataLakeSASSignatureValues.contentLanguage, dataLakeSASSignatureValues.contentType, undefined, dataLakeSASSignatureValues.directoryDepth); | ||
@@ -222,7 +222,7 @@ } | ||
} | ||
var version = dataLakeSASSignatureValues.version | ||
const version = dataLakeSASSignatureValues.version | ||
? dataLakeSASSignatureValues.version | ||
: SERVICE_VERSION; | ||
dataLakeSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(dataLakeSASSignatureValues, version); | ||
var resource = "c"; | ||
let resource = "c"; | ||
if (dataLakeSASSignatureValues.pathName) { | ||
@@ -240,3 +240,3 @@ if (dataLakeSASSignatureValues.isDirectory) { | ||
// Calling parse and toString guarantees the proper ordering and throws on invalid characters. | ||
var verifiedPermissions; | ||
let verifiedPermissions; | ||
if (dataLakeSASSignatureValues.permissions) { | ||
@@ -256,3 +256,3 @@ if (dataLakeSASSignatureValues.pathName) { | ||
// Signature is generated on the un-url-encoded values. | ||
var stringToSign = [ | ||
const stringToSign = [ | ||
verifiedPermissions ? verifiedPermissions : "", | ||
@@ -287,3 +287,3 @@ dataLakeSASSignatureValues.startsOn | ||
].join("\n"); | ||
var signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); | ||
const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); | ||
return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, dataLakeSASSignatureValues.protocol, dataLakeSASSignatureValues.startsOn, dataLakeSASSignatureValues.expiresOn, dataLakeSASSignatureValues.ipRange, dataLakeSASSignatureValues.identifier, resource, dataLakeSASSignatureValues.cacheControl, dataLakeSASSignatureValues.contentDisposition, dataLakeSASSignatureValues.contentEncoding, dataLakeSASSignatureValues.contentLanguage, dataLakeSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, dataLakeSASSignatureValues.directoryDepth, dataLakeSASSignatureValues.preauthorizedAgentObjectId, dataLakeSASSignatureValues.agentObjectId, dataLakeSASSignatureValues.correlationId); | ||
@@ -309,7 +309,7 @@ } | ||
} | ||
var version = dataLakeSASSignatureValues.version | ||
const version = dataLakeSASSignatureValues.version | ||
? dataLakeSASSignatureValues.version | ||
: SERVICE_VERSION; | ||
dataLakeSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(dataLakeSASSignatureValues, version); | ||
var resource = "c"; | ||
let resource = "c"; | ||
if (dataLakeSASSignatureValues.pathName) { | ||
@@ -327,3 +327,3 @@ if (dataLakeSASSignatureValues.isDirectory) { | ||
// Calling parse and toString guarantees the proper ordering and throws on invalid characters. | ||
var verifiedPermissions; | ||
let verifiedPermissions; | ||
if (dataLakeSASSignatureValues.permissions) { | ||
@@ -343,3 +343,3 @@ if (dataLakeSASSignatureValues.pathName) { | ||
// Signature is generated on the un-url-encoded values. | ||
var stringToSign = [ | ||
const stringToSign = [ | ||
verifiedPermissions ? verifiedPermissions : "", | ||
@@ -377,3 +377,3 @@ dataLakeSASSignatureValues.startsOn | ||
].join("\n"); | ||
var signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); | ||
const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); | ||
return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, dataLakeSASSignatureValues.protocol, dataLakeSASSignatureValues.startsOn, dataLakeSASSignatureValues.expiresOn, dataLakeSASSignatureValues.ipRange, dataLakeSASSignatureValues.identifier, resource, dataLakeSASSignatureValues.cacheControl, dataLakeSASSignatureValues.contentDisposition, dataLakeSASSignatureValues.contentEncoding, dataLakeSASSignatureValues.contentLanguage, dataLakeSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, dataLakeSASSignatureValues.directoryDepth, dataLakeSASSignatureValues.preauthorizedAgentObjectId, dataLakeSASSignatureValues.agentObjectId, dataLakeSASSignatureValues.correlationId); | ||
@@ -384,5 +384,5 @@ } | ||
// File: "/blob/account/fileSystemName/fileName" | ||
var elements = ["/blob/" + accountName + "/" + containerName]; | ||
const elements = [`/blob/${accountName}/${containerName}`]; | ||
if (blobName) { | ||
elements.push("/" + blobName); | ||
elements.push(`/${blobName}`); | ||
} | ||
@@ -412,3 +412,3 @@ return elements.join(""); | ||
else { | ||
dataLakeSASSignatureValues.directoryDepth = (_a = dataLakeSASSignatureValues.pathName) === null || _a === void 0 ? void 0 : _a.split("/").filter(function (x) { return x !== ""; }).length; | ||
dataLakeSASSignatureValues.directoryDepth = (_a = dataLakeSASSignatureValues.pathName) === null || _a === void 0 ? void 0 : _a.split("/").filter((x) => x !== "").length; | ||
} | ||
@@ -415,0 +415,0 @@ } |
@@ -10,4 +10,4 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var DirectorySASPermissions = /** @class */ (function () { | ||
function DirectorySASPermissions() { | ||
export class DirectorySASPermissions { | ||
constructor() { | ||
/** | ||
@@ -63,6 +63,5 @@ * Specifies Read access granted. | ||
*/ | ||
DirectorySASPermissions.parse = function (permissions) { | ||
var directorySASPermissions = new DirectorySASPermissions(); | ||
for (var _i = 0, permissions_1 = permissions; _i < permissions_1.length; _i++) { | ||
var char = permissions_1[_i]; | ||
static parse(permissions) { | ||
const directorySASPermissions = new DirectorySASPermissions(); | ||
for (const char of permissions) { | ||
switch (char) { | ||
@@ -100,7 +99,7 @@ case "r": | ||
default: | ||
throw new RangeError("Invalid permission " + char); | ||
throw new RangeError(`Invalid permission ${char}`); | ||
} | ||
} | ||
return directorySASPermissions; | ||
}; | ||
} | ||
/** | ||
@@ -114,4 +113,4 @@ * Converts the given permissions to a string. Using this method will guarantee the permissions are in an | ||
*/ | ||
DirectorySASPermissions.prototype.toString = function () { | ||
var permissions = []; | ||
toString() { | ||
const permissions = []; | ||
if (this.read) { | ||
@@ -148,6 +147,4 @@ permissions.push("r"); | ||
return permissions.join(""); | ||
}; | ||
return DirectorySASPermissions; | ||
}()); | ||
export { DirectorySASPermissions }; | ||
} | ||
} | ||
//# sourceMappingURL=DirectorySASPermissions.js.map |
@@ -10,4 +10,4 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var FileSystemSASPermissions = /** @class */ (function () { | ||
function FileSystemSASPermissions() { | ||
export class FileSystemSASPermissions { | ||
constructor() { | ||
/** | ||
@@ -63,6 +63,5 @@ * Specifies Read access granted. | ||
*/ | ||
FileSystemSASPermissions.parse = function (permissions) { | ||
var containerSASPermissions = new FileSystemSASPermissions(); | ||
for (var _i = 0, permissions_1 = permissions; _i < permissions_1.length; _i++) { | ||
var char = permissions_1[_i]; | ||
static parse(permissions) { | ||
const containerSASPermissions = new FileSystemSASPermissions(); | ||
for (const char of permissions) { | ||
switch (char) { | ||
@@ -100,7 +99,7 @@ case "r": | ||
default: | ||
throw new RangeError("Invalid permission " + char); | ||
throw new RangeError(`Invalid permission ${char}`); | ||
} | ||
} | ||
return containerSASPermissions; | ||
}; | ||
} | ||
/** | ||
@@ -114,4 +113,4 @@ * Converts the given permissions to a string. Using this method will guarantee the permissions are in an | ||
*/ | ||
FileSystemSASPermissions.prototype.toString = function () { | ||
var permissions = []; | ||
toString() { | ||
const permissions = []; | ||
if (this.read) { | ||
@@ -148,6 +147,4 @@ permissions.push("r"); | ||
return permissions.join(""); | ||
}; | ||
return FileSystemSASPermissions; | ||
}()); | ||
export { FileSystemSASPermissions }; | ||
} | ||
} | ||
//# sourceMappingURL=FileSystemSASPermissions.js.map |
@@ -11,4 +11,4 @@ // Copyright (c) Microsoft Corporation. | ||
export function ipRangeToString(ipRange) { | ||
return ipRange.end ? ipRange.start + "-" + ipRange.end : ipRange.start; | ||
return ipRange.end ? `${ipRange.start}-${ipRange.end}` : ipRange.start; | ||
} | ||
//# sourceMappingURL=SasIPRange.js.map |
@@ -26,4 +26,4 @@ import { ipRangeToString } from "./SasIPRange"; | ||
*/ | ||
var SASQueryParameters = /** @class */ (function () { | ||
function SASQueryParameters(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, directoryDepth, preauthorizedAgentObjectId, agentObjectId, correlationId) { | ||
export class SASQueryParameters { | ||
constructor(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, directoryDepth, preauthorizedAgentObjectId, agentObjectId, correlationId) { | ||
this.version = version; | ||
@@ -33,3 +33,3 @@ this.signature = signature; | ||
// SASQueryParametersOptions | ||
var options = permissionsOrOptions; | ||
const options = permissionsOrOptions; | ||
this.services = options.services; | ||
@@ -91,27 +91,23 @@ this.resourceTypes = options.resourceTypes; | ||
} | ||
Object.defineProperty(SASQueryParameters.prototype, "ipRange", { | ||
/** | ||
* Optional. IP range allowed for this SAS. | ||
* | ||
* @readonly | ||
*/ | ||
get: function () { | ||
if (this.ipRangeInner) { | ||
return { | ||
end: this.ipRangeInner.end, | ||
start: this.ipRangeInner.start | ||
}; | ||
} | ||
return undefined; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
/** | ||
* Optional. IP range allowed for this SAS. | ||
* | ||
* @readonly | ||
*/ | ||
get ipRange() { | ||
if (this.ipRangeInner) { | ||
return { | ||
end: this.ipRangeInner.end, | ||
start: this.ipRangeInner.start | ||
}; | ||
} | ||
return undefined; | ||
} | ||
/** | ||
* Encodes all SAS query parameters into a string that can be appended to a URL. | ||
* | ||
*/ | ||
SASQueryParameters.prototype.toString = function () { | ||
toString() { | ||
var _a; | ||
var params = [ | ||
const params = [ | ||
"sv", | ||
@@ -144,5 +140,4 @@ "ss", | ||
]; | ||
var queries = []; | ||
for (var _i = 0, params_1 = params; _i < params_1.length; _i++) { | ||
var param = params_1[_i]; | ||
const queries = []; | ||
for (const param of params) { | ||
switch (param) { | ||
@@ -230,3 +225,3 @@ case "sv": | ||
return queries.join("&"); | ||
}; | ||
} | ||
/** | ||
@@ -239,3 +234,3 @@ * A private helper method used to filter and append query key/value pairs into an array. | ||
*/ | ||
SASQueryParameters.prototype.tryAppendQueryParameter = function (queries, key, value) { | ||
tryAppendQueryParameter(queries, key, value) { | ||
if (!value) { | ||
@@ -247,8 +242,6 @@ return; | ||
if (key.length > 0 && value.length > 0) { | ||
queries.push(key + "=" + value); | ||
queries.push(`${key}=${value}`); | ||
} | ||
}; | ||
return SASQueryParameters; | ||
}()); | ||
export { SASQueryParameters }; | ||
} | ||
} | ||
//# sourceMappingURL=SASQueryParameters.js.map |
@@ -8,5 +8,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var StorageBrowserPolicyFactory = /** @class */ (function () { | ||
function StorageBrowserPolicyFactory() { | ||
} | ||
export class StorageBrowserPolicyFactory { | ||
/** | ||
@@ -18,8 +16,6 @@ * Creates a StorageBrowserPolicyFactory object. | ||
*/ | ||
StorageBrowserPolicyFactory.prototype.create = function (nextPolicy, options) { | ||
create(nextPolicy, options) { | ||
return new StorageBrowserPolicy(nextPolicy, options); | ||
}; | ||
return StorageBrowserPolicyFactory; | ||
}()); | ||
export { StorageBrowserPolicyFactory }; | ||
} | ||
} | ||
//# sourceMappingURL=StorageBrowserPolicyFactory.js.map |
@@ -13,3 +13,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var StorageClient = /** @class */ (function () { | ||
export class StorageClient { | ||
/** | ||
@@ -20,3 +20,3 @@ * Creates an instance of StorageClient. | ||
*/ | ||
function StorageClient(url, pipeline) { | ||
constructor(url, pipeline) { | ||
// URL should be encoded and only once, protocol layer shouldn't encode URL again | ||
@@ -32,4 +32,3 @@ this.url = escapeURLPath(url); | ||
this.credential = new AnonymousCredential(); | ||
for (var _i = 0, _a = this.pipeline.factories; _i < _a.length; _i++) { | ||
var factory = _a[_i]; | ||
for (const factory of this.pipeline.factories) { | ||
if ((isNode && factory instanceof StorageSharedKeyCredential) || | ||
@@ -46,10 +45,8 @@ factory instanceof AnonymousCredential) { | ||
// Override protocol layer's default content-type | ||
var storageClientContext = this.storageClientContext; | ||
const storageClientContext = this.storageClientContext; | ||
storageClientContext.requestContentType = undefined; | ||
var storageClientContextWithBlobEndpoint = this.storageClientContextToBlobEndpoint; | ||
const storageClientContextWithBlobEndpoint = this.storageClientContextToBlobEndpoint; | ||
storageClientContextWithBlobEndpoint.requestContentType = undefined; | ||
} | ||
return StorageClient; | ||
}()); | ||
export { StorageClient }; | ||
} | ||
//# sourceMappingURL=StorageClient.js.map |
@@ -8,3 +8,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var StorageRetryPolicyFactory = /** @class */ (function () { | ||
export class StorageRetryPolicyFactory { | ||
/** | ||
@@ -14,3 +14,3 @@ * Creates an instance of StorageRetryPolicyFactory. | ||
*/ | ||
function StorageRetryPolicyFactory(retryOptions) { | ||
constructor(retryOptions) { | ||
this.retryOptions = retryOptions; | ||
@@ -24,8 +24,6 @@ } | ||
*/ | ||
StorageRetryPolicyFactory.prototype.create = function (nextPolicy, options) { | ||
create(nextPolicy, options) { | ||
return new StorageRetryPolicy(nextPolicy, options, this.retryOptions); | ||
}; | ||
return StorageRetryPolicyFactory; | ||
}()); | ||
export { StorageRetryPolicyFactory }; | ||
} | ||
} | ||
//# sourceMappingURL=StorageRetryPolicyFactory.js.map |
@@ -10,3 +10,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
var TelemetryPolicyFactory = /** @class */ (function () { | ||
export class TelemetryPolicyFactory { | ||
/** | ||
@@ -16,7 +16,7 @@ * Creates an instance of TelemetryPolicyFactory. | ||
*/ | ||
function TelemetryPolicyFactory(telemetry) { | ||
var userAgentInfo = []; | ||
constructor(telemetry) { | ||
const userAgentInfo = []; | ||
if (isNode) { | ||
if (telemetry) { | ||
var telemetryString = telemetry.userAgentPrefix || ""; | ||
const telemetryString = telemetry.userAgentPrefix || ""; | ||
if (telemetryString.length > 0 && userAgentInfo.indexOf(telemetryString) === -1) { | ||
@@ -27,3 +27,3 @@ userAgentInfo.push(telemetryString); | ||
// e.g. azsdk-js-storagedatalake/10.0.0 | ||
var libInfo = "azsdk-js-storagedatalake/" + SDK_VERSION; | ||
const libInfo = `azsdk-js-storagedatalake/${SDK_VERSION}`; | ||
if (userAgentInfo.indexOf(libInfo) === -1) { | ||
@@ -33,3 +33,3 @@ userAgentInfo.push(libInfo); | ||
// e.g. (NODE-VERSION 4.9.1; Windows_NT 10.0.16299) | ||
var runtimeInfo = "(NODE-VERSION " + process.version + "; " + os.type() + " " + os.release() + ")"; | ||
const runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`; | ||
if (userAgentInfo.indexOf(runtimeInfo) === -1) { | ||
@@ -47,8 +47,6 @@ userAgentInfo.push(runtimeInfo); | ||
*/ | ||
TelemetryPolicyFactory.prototype.create = function (nextPolicy, options) { | ||
create(nextPolicy, options) { | ||
return new TelemetryPolicy(nextPolicy, options, this.telemetryString); | ||
}; | ||
return TelemetryPolicyFactory; | ||
}()); | ||
export { TelemetryPolicyFactory }; | ||
} | ||
} | ||
//# sourceMappingURL=TelemetryPolicyFactory.js.map |
@@ -1,2 +0,1 @@ | ||
import { __assign, __awaiter, __generator } from "tslib"; | ||
// Copyright (c) Microsoft Corporation. | ||
@@ -22,9 +21,8 @@ // Licensed under the MIT license. | ||
export function toBlobEndpointUrl(url) { | ||
var urlParsed = URLBuilder.parse(url); | ||
var host = urlParsed.getHost(); | ||
const urlParsed = URLBuilder.parse(url); | ||
let host = urlParsed.getHost(); | ||
if (host === undefined) { | ||
throw RangeError("toBlobEndpointUrl() parameter url " + url + " doesn't include valid host."); | ||
throw RangeError(`toBlobEndpointUrl() parameter url ${url} doesn't include valid host.`); | ||
} | ||
for (var _i = 0, ToBlobEndpointHostMappings_1 = ToBlobEndpointHostMappings; _i < ToBlobEndpointHostMappings_1.length; _i++) { | ||
var mapping = ToBlobEndpointHostMappings_1[_i]; | ||
for (const mapping of ToBlobEndpointHostMappings) { | ||
if (host.includes(mapping[0])) { | ||
@@ -53,9 +51,8 @@ host = host.replace(mapping[0], mapping[1]); | ||
export function toDfsEndpointUrl(url) { | ||
var urlParsed = URLBuilder.parse(url); | ||
var host = urlParsed.getHost(); | ||
const urlParsed = URLBuilder.parse(url); | ||
let host = urlParsed.getHost(); | ||
if (host === undefined) { | ||
throw RangeError("toDfsEndpointUrl() parameter url " + url + " doesn't include valid host."); | ||
throw RangeError(`toDfsEndpointUrl() parameter url ${url} doesn't include valid host.`); | ||
} | ||
for (var _i = 0, ToDfsEndpointHostMappings_1 = ToDfsEndpointHostMappings; _i < ToDfsEndpointHostMappings_1.length; _i++) { | ||
var mapping = ToDfsEndpointHostMappings_1[_i]; | ||
for (const mapping of ToDfsEndpointHostMappings) { | ||
if (host.includes(mapping[0])) { | ||
@@ -70,58 +67,35 @@ host = host.replace(mapping[0], mapping[1]); | ||
function toFileSystemAsyncIterableIterator(iter) { | ||
var _a; | ||
return _a = { | ||
next: function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var rawResult; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, iter.next()]; | ||
case 1: | ||
rawResult = _a.sent(); | ||
if (rawResult.value) { | ||
rawResult.value.fileSystemItems = rawResult.value.containerItems.map(function (val) { | ||
return __assign(__assign({}, val), { versionId: val.version, properties: __assign(__assign({}, val.properties), { publicAccess: toPublicAccessType(val.properties.publicAccess) }) }); | ||
}); | ||
} | ||
return [2 /*return*/, rawResult]; | ||
} | ||
}); | ||
return { | ||
async next() { | ||
const rawResult = await iter.next(); | ||
if (rawResult.value) { | ||
rawResult.value.fileSystemItems = rawResult.value.containerItems.map((val) => { | ||
return Object.assign(Object.assign({}, val), { versionId: val.version, properties: Object.assign(Object.assign({}, val.properties), { publicAccess: toPublicAccessType(val.properties.publicAccess) }) }); | ||
}); | ||
} | ||
return rawResult; | ||
}, | ||
_a[Symbol.asyncIterator] = function () { | ||
[Symbol.asyncIterator]() { | ||
return this; | ||
}, | ||
_a; | ||
} | ||
}; | ||
} | ||
export function toFileSystemPagedAsyncIterableIterator(iter) { | ||
var _a; | ||
return _a = { | ||
next: function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var rawResult, result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, iter.next()]; | ||
case 1: | ||
rawResult = _a.sent(); | ||
result = rawResult; | ||
if (result.value) { | ||
result.value.properties.publicAccess = toPublicAccessType(rawResult.value.properties.publicAccess); | ||
result.value.versionId = rawResult.value.version; | ||
} | ||
return [2 /*return*/, result]; | ||
} | ||
}); | ||
}); | ||
return { | ||
async next() { | ||
const rawResult = await iter.next(); | ||
const result = rawResult; | ||
if (result.value) { | ||
result.value.properties.publicAccess = toPublicAccessType(rawResult.value.properties.publicAccess); | ||
result.value.versionId = rawResult.value.version; | ||
} | ||
return result; | ||
}, | ||
_a[Symbol.asyncIterator] = function () { | ||
[Symbol.asyncIterator]() { | ||
return this; | ||
}, | ||
_a.byPage = function (settings) { | ||
if (settings === void 0) { settings = {}; } | ||
byPage(settings = {}) { | ||
return toFileSystemAsyncIterableIterator(iter.byPage(settings)); | ||
}, | ||
_a; | ||
} | ||
}; | ||
} | ||
@@ -138,3 +112,3 @@ export function toContainerPublicAccessType(publicAccessType) { | ||
default: | ||
throw TypeError("toContainerPublicAccessType() parameter " + publicAccessType + " is not recognized."); | ||
throw TypeError(`toContainerPublicAccessType() parameter ${publicAccessType} is not recognized.`); | ||
} | ||
@@ -152,3 +126,3 @@ } | ||
default: | ||
throw TypeError("toPublicAccessType() parameter " + containerPublicAccessType + " is not recognized."); | ||
throw TypeError(`toPublicAccessType() parameter ${containerPublicAccessType} is not recognized.`); | ||
} | ||
@@ -160,7 +134,7 @@ } | ||
} | ||
var properties = []; | ||
for (var key in metadata) { | ||
const properties = []; | ||
for (const key in metadata) { | ||
if (metadata.hasOwnProperty(key)) { | ||
var value = metadata[key]; | ||
properties.push(key + "=" + base64encode(value)); | ||
const value = metadata[key]; | ||
properties.push(`${key}=${base64encode(value)}`); | ||
} | ||
@@ -171,7 +145,6 @@ } | ||
export function toPathGetAccessControlResponse(response) { | ||
return __assign(__assign({}, response), { _response: response._response, permissions: toPermissions(response.permissions), acl: toAcl(response.acl) }); | ||
return Object.assign(Object.assign({}, response), { _response: response._response, permissions: toPermissions(response.permissions), acl: toAcl(response.acl) }); | ||
} | ||
export function toRolePermissions(permissionsString, allowStickyBit) { | ||
if (allowStickyBit === void 0) { allowStickyBit = false; } | ||
var error = new RangeError("toRolePermissions() Invalid role permissions string " + permissionsString); | ||
export function toRolePermissions(permissionsString, allowStickyBit = false) { | ||
const error = new RangeError(`toRolePermissions() Invalid role permissions string ${permissionsString}`); | ||
if (permissionsString.length !== 3) { | ||
@@ -181,3 +154,3 @@ throw error; | ||
permissionsString = permissionsString.toLowerCase(); | ||
var read = false; | ||
let read = false; | ||
if (permissionsString[0] === "r") { | ||
@@ -189,3 +162,3 @@ read = true; | ||
} | ||
var write = false; | ||
let write = false; | ||
if (permissionsString[1] === "w") { | ||
@@ -197,3 +170,3 @@ write = true; | ||
} | ||
var execute = false; | ||
let execute = false; | ||
if (permissionsString[2] === "x") { | ||
@@ -213,3 +186,3 @@ execute = true; | ||
} | ||
return { read: read, write: write, execute: execute }; | ||
return { read, write, execute }; | ||
} | ||
@@ -221,11 +194,11 @@ export function toPermissions(permissionsString) { | ||
if (permissionsString.length !== 9 && permissionsString.length !== 10) { | ||
throw RangeError("toPermissions() Invalid permissions string " + permissionsString); | ||
throw RangeError(`toPermissions() Invalid permissions string ${permissionsString}`); | ||
} | ||
// Case insensitive | ||
permissionsString = permissionsString.toLowerCase(); | ||
var stickyBit = false; | ||
let stickyBit = false; | ||
if (permissionsString[8] === "t") { | ||
stickyBit = true; | ||
} | ||
var extendedAcls = false; | ||
let extendedAcls = false; | ||
if (permissionsString.length === 10) { | ||
@@ -236,18 +209,18 @@ if (permissionsString[9] === "+") { | ||
else { | ||
throw RangeError("toPermissions() Invalid extendedAcls bit " + permissionsString[9] + " in permissions string " + permissionsString); | ||
throw RangeError(`toPermissions() Invalid extendedAcls bit ${permissionsString[9]} in permissions string ${permissionsString}`); | ||
} | ||
} | ||
var owner = toRolePermissions(permissionsString.substr(0, 3), false); | ||
var group = toRolePermissions(permissionsString.substr(3, 3), false); | ||
var other = toRolePermissions(permissionsString.substr(6, 3), true); | ||
const owner = toRolePermissions(permissionsString.substr(0, 3), false); | ||
const group = toRolePermissions(permissionsString.substr(3, 3), false); | ||
const other = toRolePermissions(permissionsString.substr(6, 3), true); | ||
return { | ||
owner: owner, | ||
group: group, | ||
other: other, | ||
stickyBit: stickyBit, | ||
extendedAcls: extendedAcls | ||
owner, | ||
group, | ||
other, | ||
stickyBit, | ||
extendedAcls | ||
}; | ||
} | ||
export function toAccessControlItem(aclItemString) { | ||
var error = new RangeError("toAccessControlItem() Parameter access control item string " + aclItemString + " is not valid."); | ||
const error = new RangeError(`toAccessControlItem() Parameter access control item string ${aclItemString} is not valid.`); | ||
if (aclItemString === "") { | ||
@@ -257,8 +230,8 @@ throw error; | ||
aclItemString = aclItemString.toLowerCase(); | ||
var parts = aclItemString.split(":"); | ||
const parts = aclItemString.split(":"); | ||
if (parts.length < 3 || parts.length > 4) { | ||
throw error; | ||
} | ||
var defaultScope = false; | ||
var index = 0; | ||
let defaultScope = false; | ||
let index = 0; | ||
if (parts.length === 4) { | ||
@@ -271,3 +244,3 @@ if (parts[index] !== "default") { | ||
} | ||
var accessControlType = parts[index++]; | ||
const accessControlType = parts[index++]; | ||
if (accessControlType !== "user" && | ||
@@ -279,13 +252,13 @@ accessControlType !== "group" && | ||
} | ||
var entityId = parts[index++]; | ||
var permissions = toRolePermissions(parts[index++]); | ||
const entityId = parts[index++]; | ||
const permissions = toRolePermissions(parts[index++]); | ||
return { | ||
defaultScope: defaultScope, | ||
accessControlType: accessControlType, | ||
entityId: entityId, | ||
permissions: permissions | ||
defaultScope, | ||
accessControlType, | ||
entityId, | ||
permissions | ||
}; | ||
} | ||
export function toRemoveAccessControlItem(aclItemString) { | ||
var error = new RangeError("toAccessControlItem() Parameter access control item string \"" + aclItemString + "\" is not valid."); | ||
const error = new RangeError(`toAccessControlItem() Parameter access control item string "${aclItemString}" is not valid.`); | ||
if (aclItemString === "") { | ||
@@ -295,3 +268,3 @@ throw error; | ||
aclItemString = aclItemString.toLowerCase(); | ||
var parts = aclItemString.split(":"); | ||
const parts = aclItemString.split(":"); | ||
if (parts.length < 1 || parts.length > 3) { | ||
@@ -305,4 +278,4 @@ throw error; | ||
} | ||
var defaultScope = false; | ||
var index = 0; | ||
let defaultScope = false; | ||
let index = 0; | ||
if (parts[index] === "default") { | ||
@@ -312,3 +285,3 @@ defaultScope = true; | ||
} | ||
var accessControlType = parts[index++]; | ||
const accessControlType = parts[index++]; | ||
if (accessControlType !== "user" && | ||
@@ -320,7 +293,7 @@ accessControlType !== "group" && | ||
} | ||
var entityId = parts[index++]; | ||
const entityId = parts[index++]; | ||
return { | ||
defaultScope: defaultScope, | ||
accessControlType: accessControlType, | ||
entityId: entityId | ||
defaultScope, | ||
accessControlType, | ||
entityId | ||
}; | ||
@@ -332,6 +305,5 @@ } | ||
} | ||
var acls = []; | ||
var aclParts = aclString.split(","); | ||
for (var _i = 0, aclParts_1 = aclParts; _i < aclParts_1.length; _i++) { | ||
var aclPart = aclParts_1[_i]; | ||
const acls = []; | ||
const aclParts = aclString.split(","); | ||
for (const aclPart of aclParts) { | ||
acls.push(toAccessControlItem(aclPart)); | ||
@@ -345,6 +317,5 @@ } | ||
} | ||
var acls = []; | ||
var aclParts = aclString.split(","); | ||
for (var _i = 0, aclParts_2 = aclParts; _i < aclParts_2.length; _i++) { | ||
var aclPart = aclParts_2[_i]; | ||
const acls = []; | ||
const aclParts = aclString.split(","); | ||
for (const aclPart of aclParts) { | ||
acls.push(toRemoveAccessControlItem(aclPart)); | ||
@@ -355,5 +326,5 @@ } | ||
export function toAccessControlItemString(item) { | ||
var entityIdString = item.entityId !== undefined ? ":" + item.entityId : ""; | ||
var permissionsString = item.permissions !== undefined ? ":" + toRolePermissionsString(item.permissions) : ""; | ||
return "" + (item.defaultScope ? "default:" : "") + item.accessControlType + entityIdString + permissionsString; | ||
const entityIdString = item.entityId !== undefined ? `:${item.entityId}` : ""; | ||
const permissionsString = item.permissions !== undefined ? `:${toRolePermissionsString(item.permissions)}` : ""; | ||
return `${item.defaultScope ? "default:" : ""}${item.accessControlType}${entityIdString}${permissionsString}`; | ||
} | ||
@@ -363,12 +334,10 @@ export function toAclString(acl) { | ||
} | ||
export function toRolePermissionsString(p, stickyBit) { | ||
if (stickyBit === void 0) { stickyBit = false; } | ||
return "" + (p.read ? "r" : "-") + (p.write ? "w" : "-") + (stickyBit ? "t" : p.execute ? "x" : "-"); | ||
export function toRolePermissionsString(p, stickyBit = false) { | ||
return `${p.read ? "r" : "-"}${p.write ? "w" : "-"}${stickyBit ? "t" : p.execute ? "x" : "-"}`; | ||
} | ||
export function toPermissionsString(permissions) { | ||
return "" + toRolePermissionsString(permissions.owner) + toRolePermissionsString(permissions.group) + toRolePermissionsString(permissions.other, permissions.stickyBit) + (permissions.extendedAcls ? "+" : ""); | ||
return `${toRolePermissionsString(permissions.owner)}${toRolePermissionsString(permissions.group)}${toRolePermissionsString(permissions.other, permissions.stickyBit)}${permissions.extendedAcls ? "+" : ""}`; | ||
} | ||
export function toAccessControlChangeFailureArray(aclFailedEntry) { | ||
if (aclFailedEntry === void 0) { aclFailedEntry = []; } | ||
return aclFailedEntry.map(function (aclFailedEntry) { | ||
export function toAccessControlChangeFailureArray(aclFailedEntry = []) { | ||
return aclFailedEntry.map((aclFailedEntry) => { | ||
return { | ||
@@ -375,0 +344,0 @@ name: aclFailedEntry.name || "", |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __awaiter, __generator } from "tslib"; | ||
// In browser, during webpack or browserify bundling, this module will be replaced by 'events' | ||
@@ -20,3 +19,3 @@ // https://github.com/Gozala/events | ||
*/ | ||
var Batch = /** @class */ (function () { | ||
export class Batch { | ||
/** | ||
@@ -26,4 +25,3 @@ * Creates an instance of Batch. | ||
*/ | ||
function Batch(concurrency) { | ||
if (concurrency === void 0) { concurrency = 5; } | ||
constructor(concurrency = 5) { | ||
/** | ||
@@ -61,27 +59,16 @@ * Number of active operations under execution. | ||
*/ | ||
Batch.prototype.addOperation = function (operation) { | ||
var _this = this; | ||
this.operations.push(function () { return __awaiter(_this, void 0, void 0, function () { | ||
var error_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
this.actives++; | ||
return [4 /*yield*/, operation()]; | ||
case 1: | ||
_a.sent(); | ||
this.actives--; | ||
this.completed++; | ||
this.parallelExecute(); | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
error_1 = _a.sent(); | ||
this.emitter.emit("error", error_1); | ||
return [3 /*break*/, 3]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
}; | ||
addOperation(operation) { | ||
this.operations.push(async () => { | ||
try { | ||
this.actives++; | ||
await operation(); | ||
this.actives--; | ||
this.completed++; | ||
this.parallelExecute(); | ||
} | ||
catch (error) { | ||
this.emitter.emit("error", error); | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -91,20 +78,15 @@ * Start execute operations in the queue. | ||
*/ | ||
Batch.prototype.do = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
if (this.operations.length === 0) { | ||
return [2 /*return*/, Promise.resolve()]; | ||
} | ||
this.parallelExecute(); | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.emitter.on("finish", resolve); | ||
_this.emitter.on("error", function (error) { | ||
_this.state = BatchStates.Error; | ||
reject(error); | ||
}); | ||
})]; | ||
async do() { | ||
if (this.operations.length === 0) { | ||
return Promise.resolve(); | ||
} | ||
this.parallelExecute(); | ||
return new Promise((resolve, reject) => { | ||
this.emitter.on("finish", resolve); | ||
this.emitter.on("error", (error) => { | ||
this.state = BatchStates.Error; | ||
reject(error); | ||
}); | ||
}); | ||
}; | ||
} | ||
/** | ||
@@ -114,3 +96,3 @@ * Get next operation to be executed. Return null when reaching ends. | ||
*/ | ||
Batch.prototype.nextOperation = function () { | ||
nextOperation() { | ||
if (this.offset < this.operations.length) { | ||
@@ -120,3 +102,3 @@ return this.operations[this.offset++]; | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -127,3 +109,3 @@ * Start execute operations. One one the most important difference between | ||
*/ | ||
Batch.prototype.parallelExecute = function () { | ||
parallelExecute() { | ||
if (this.state === BatchStates.Error) { | ||
@@ -137,3 +119,3 @@ return; | ||
while (this.actives < this.concurrency) { | ||
var operation = this.nextOperation(); | ||
const operation = this.nextOperation(); | ||
if (operation) { | ||
@@ -146,6 +128,4 @@ operation(); | ||
} | ||
}; | ||
return Batch; | ||
}()); | ||
export { Batch }; | ||
} | ||
} | ||
//# sourceMappingURL=Batch.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __awaiter, __generator } from "tslib"; | ||
import { EventEmitter } from "events"; | ||
@@ -27,3 +26,3 @@ /** | ||
*/ | ||
var BufferScheduler = /** @class */ (function () { | ||
export class BufferScheduler { | ||
/** | ||
@@ -41,3 +40,3 @@ * Creates an instance of BufferScheduler. | ||
*/ | ||
function BufferScheduler(readable, bufferSize, maxBuffers, outgoingHandler, concurrency, encoding) { | ||
constructor(readable, bufferSize, maxBuffers, outgoingHandler, concurrency, encoding) { | ||
/** | ||
@@ -88,9 +87,9 @@ * An internal event emitter. | ||
if (bufferSize <= 0) { | ||
throw new RangeError("bufferSize must be larger than 0, current is " + bufferSize); | ||
throw new RangeError(`bufferSize must be larger than 0, current is ${bufferSize}`); | ||
} | ||
if (maxBuffers <= 0) { | ||
throw new RangeError("maxBuffers must be larger than 0, current is " + maxBuffers); | ||
throw new RangeError(`maxBuffers must be larger than 0, current is ${maxBuffers}`); | ||
} | ||
if (concurrency <= 0) { | ||
throw new RangeError("concurrency must be larger than 0, current is " + concurrency); | ||
throw new RangeError(`concurrency must be larger than 0, current is ${concurrency}`); | ||
} | ||
@@ -109,49 +108,44 @@ this.bufferSize = bufferSize; | ||
*/ | ||
BufferScheduler.prototype.do = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.readable.on("data", function (data) { | ||
data = typeof data === "string" ? Buffer.from(data, _this.encoding) : data; | ||
_this.appendUnresolvedData(data); | ||
if (!_this.resolveData()) { | ||
_this.readable.pause(); | ||
} | ||
}); | ||
_this.readable.on("error", function (err) { | ||
_this.emitter.emit("error", err); | ||
}); | ||
_this.readable.on("end", function () { | ||
_this.isStreamEnd = true; | ||
_this.emitter.emit("checkEnd"); | ||
}); | ||
_this.emitter.on("error", function (err) { | ||
_this.isError = true; | ||
_this.readable.pause(); | ||
reject(err); | ||
}); | ||
_this.emitter.on("checkEnd", function () { | ||
if (_this.outgoing.length > 0) { | ||
_this.triggerOutgoingHandlers(); | ||
return; | ||
} | ||
if (_this.isStreamEnd && _this.executingOutgoingHandlers === 0) { | ||
if (_this.unresolvedLength > 0 && _this.unresolvedLength < _this.bufferSize) { | ||
_this.outgoingHandler(_this.shiftBufferFromUnresolvedDataArray(), _this.offset) | ||
.then(resolve) | ||
.catch(reject); | ||
} | ||
else if (_this.unresolvedLength >= _this.bufferSize) { | ||
return; | ||
} | ||
else { | ||
resolve(); | ||
} | ||
} | ||
}); | ||
})]; | ||
async do() { | ||
return new Promise((resolve, reject) => { | ||
this.readable.on("data", (data) => { | ||
data = typeof data === "string" ? Buffer.from(data, this.encoding) : data; | ||
this.appendUnresolvedData(data); | ||
if (!this.resolveData()) { | ||
this.readable.pause(); | ||
} | ||
}); | ||
this.readable.on("error", (err) => { | ||
this.emitter.emit("error", err); | ||
}); | ||
this.readable.on("end", () => { | ||
this.isStreamEnd = true; | ||
this.emitter.emit("checkEnd"); | ||
}); | ||
this.emitter.on("error", (err) => { | ||
this.isError = true; | ||
this.readable.pause(); | ||
reject(err); | ||
}); | ||
this.emitter.on("checkEnd", () => { | ||
if (this.outgoing.length > 0) { | ||
this.triggerOutgoingHandlers(); | ||
return; | ||
} | ||
if (this.isStreamEnd && this.executingOutgoingHandlers === 0) { | ||
if (this.unresolvedLength > 0 && this.unresolvedLength < this.bufferSize) { | ||
this.outgoingHandler(this.shiftBufferFromUnresolvedDataArray(), this.offset) | ||
.then(resolve) | ||
.catch(reject); | ||
} | ||
else if (this.unresolvedLength >= this.bufferSize) { | ||
return; | ||
} | ||
else { | ||
resolve(); | ||
} | ||
} | ||
}); | ||
}); | ||
}; | ||
} | ||
/** | ||
@@ -162,6 +156,6 @@ * Insert a new data into unresolved array. | ||
*/ | ||
BufferScheduler.prototype.appendUnresolvedData = function (data) { | ||
appendUnresolvedData(data) { | ||
this.unresolvedDataArray.push(data); | ||
this.unresolvedLength += data.length; | ||
}; | ||
} | ||
/** | ||
@@ -172,3 +166,3 @@ * Try to shift a buffer with size in blockSize. The buffer returned may be less | ||
*/ | ||
BufferScheduler.prototype.shiftBufferFromUnresolvedDataArray = function () { | ||
shiftBufferFromUnresolvedDataArray() { | ||
if (this.unresolvedLength >= this.bufferSize) { | ||
@@ -180,4 +174,4 @@ if (this.bufferSize === this.unresolvedDataArray[0].length) { | ||
// Lazy concat because Buffer.concat highly drops performance | ||
var merged = Buffer.concat(this.unresolvedDataArray, this.unresolvedLength); | ||
var buffer = merged.slice(0, this.bufferSize); | ||
let merged = Buffer.concat(this.unresolvedDataArray, this.unresolvedLength); | ||
const buffer = merged.slice(0, this.bufferSize); | ||
merged = merged.slice(this.bufferSize); | ||
@@ -189,3 +183,3 @@ this.unresolvedDataArray = [merged]; | ||
else if (this.unresolvedLength > 0) { | ||
var merged = Buffer.concat(this.unresolvedDataArray, this.unresolvedLength); | ||
const merged = Buffer.concat(this.unresolvedDataArray, this.unresolvedLength); | ||
this.unresolvedDataArray = []; | ||
@@ -198,3 +192,3 @@ this.unresolvedLength = 0; | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -209,5 +203,5 @@ * Resolve data in unresolvedDataArray. For every buffer with size in blockSize | ||
*/ | ||
BufferScheduler.prototype.resolveData = function () { | ||
resolveData() { | ||
while (this.unresolvedLength >= this.bufferSize) { | ||
var buffer = void 0; | ||
let buffer; | ||
if (this.incoming.length > 0) { | ||
@@ -231,3 +225,3 @@ buffer = this.incoming.shift(); | ||
return true; | ||
}; | ||
} | ||
/** | ||
@@ -237,19 +231,14 @@ * Try to trigger a outgoing handler for every buffer in outgoing. Stop when | ||
*/ | ||
BufferScheduler.prototype.triggerOutgoingHandlers = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var buffer; | ||
return __generator(this, function (_a) { | ||
do { | ||
if (this.executingOutgoingHandlers >= this.concurrency) { | ||
return [2 /*return*/]; | ||
} | ||
buffer = this.outgoing.shift(); | ||
if (buffer) { | ||
this.triggerOutgoingHandler(buffer); | ||
} | ||
} while (buffer); | ||
return [2 /*return*/]; | ||
}); | ||
}); | ||
}; | ||
async triggerOutgoingHandlers() { | ||
let buffer; | ||
do { | ||
if (this.executingOutgoingHandlers >= this.concurrency) { | ||
return; | ||
} | ||
buffer = this.outgoing.shift(); | ||
if (buffer) { | ||
this.triggerOutgoingHandler(buffer); | ||
} | ||
} while (buffer); | ||
} | ||
/** | ||
@@ -260,31 +249,17 @@ * Trigger a outgoing handler for a buffer shifted from outgoing. | ||
*/ | ||
BufferScheduler.prototype.triggerOutgoingHandler = function (buffer) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var bufferLength, err_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
bufferLength = buffer.length; | ||
this.executingOutgoingHandlers++; | ||
this.offset += bufferLength; | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.outgoingHandler(buffer, this.offset - bufferLength)]; | ||
case 2: | ||
_a.sent(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
err_1 = _a.sent(); | ||
this.emitter.emit("error", err_1); | ||
return [2 /*return*/]; | ||
case 4: | ||
this.executingOutgoingHandlers--; | ||
this.reuseBuffer(buffer); | ||
this.emitter.emit("checkEnd"); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
async triggerOutgoingHandler(buffer) { | ||
const bufferLength = buffer.length; | ||
this.executingOutgoingHandlers++; | ||
this.offset += bufferLength; | ||
try { | ||
await this.outgoingHandler(buffer, this.offset - bufferLength); | ||
} | ||
catch (err) { | ||
this.emitter.emit("error", err); | ||
return; | ||
} | ||
this.executingOutgoingHandlers--; | ||
this.reuseBuffer(buffer); | ||
this.emitter.emit("checkEnd"); | ||
} | ||
/** | ||
@@ -295,3 +270,3 @@ * Return buffer used by outgoing handler into incoming. | ||
*/ | ||
BufferScheduler.prototype.reuseBuffer = function (buffer) { | ||
reuseBuffer(buffer) { | ||
this.incoming.push(buffer); | ||
@@ -301,6 +276,4 @@ if (!this.isError && this.resolveData() && !this.isStreamEnd) { | ||
} | ||
}; | ||
return BufferScheduler; | ||
}()); | ||
export { BufferScheduler }; | ||
} | ||
} | ||
//# sourceMappingURL=BufferScheduler.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { DefaultHttpClient } from "@azure/core-http"; | ||
var _defaultHttpClient = new DefaultHttpClient(); | ||
const _defaultHttpClient = new DefaultHttpClient(); | ||
export function getCachedDefaultHttpClient() { | ||
@@ -6,0 +6,0 @@ return _defaultHttpClient; |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
export var SDK_VERSION = "12.5.0"; | ||
export var SERVICE_VERSION = "2020-06-12"; | ||
export var KB = 1024; | ||
export var MB = KB * 1024; | ||
export var GB = MB * 1024; | ||
export var TB = GB * 1024; | ||
export var DEFAULT_HIGH_LEVEL_CONCURRENCY = 5; | ||
export var FILE_MAX_SINGLE_UPLOAD_THRESHOLD = 100 * MB; | ||
export var FILE_UPLOAD_MAX_CHUNK_SIZE = 4000 * MB; | ||
export var FILE_UPLOAD_DEFAULT_CHUNK_SIZE = 8 * MB; | ||
export var BLOCK_BLOB_MAX_BLOCKS = 50000; | ||
export var FILE_MAX_SIZE_BYTES = BLOCK_BLOB_MAX_BLOCKS * FILE_UPLOAD_MAX_CHUNK_SIZE; | ||
export var StorageOAuthScopes = "https://storage.azure.com/.default"; | ||
export var StorageDataLakeLoggingAllowedHeaderNames = [ | ||
export const SDK_VERSION = "12.6.0"; | ||
export const SERVICE_VERSION = "2020-06-12"; | ||
export const KB = 1024; | ||
export const MB = KB * 1024; | ||
export const GB = MB * 1024; | ||
export const TB = GB * 1024; | ||
export const DEFAULT_HIGH_LEVEL_CONCURRENCY = 5; | ||
export const FILE_MAX_SINGLE_UPLOAD_THRESHOLD = 100 * MB; | ||
export const FILE_UPLOAD_MAX_CHUNK_SIZE = 4000 * MB; | ||
export const FILE_UPLOAD_DEFAULT_CHUNK_SIZE = 8 * MB; | ||
export const BLOCK_BLOB_MAX_BLOCKS = 50000; | ||
export const FILE_MAX_SIZE_BYTES = BLOCK_BLOB_MAX_BLOCKS * FILE_UPLOAD_MAX_CHUNK_SIZE; | ||
export const StorageOAuthScopes = "https://storage.azure.com/.default"; | ||
export const StorageDataLakeLoggingAllowedHeaderNames = [ | ||
"Access-Control-Allow-Origin", | ||
@@ -110,3 +110,3 @@ "Cache-Control", | ||
]; | ||
export var StorageDataLakeLoggingAllowedQueryParameters = [ | ||
export const StorageDataLakeLoggingAllowedQueryParameters = [ | ||
"comp", | ||
@@ -146,3 +146,3 @@ "maxresults", | ||
]; | ||
export var UrlConstants = { | ||
export const UrlConstants = { | ||
Parameters: { | ||
@@ -155,3 +155,3 @@ FORCE_BROWSER_NO_CACHE: "_", | ||
}; | ||
export var HttpUrlConnection = { | ||
export const HttpUrlConnection = { | ||
HTTP_ACCEPTED: 202, | ||
@@ -163,3 +163,3 @@ HTTP_CONFLICT: 409, | ||
}; | ||
export var HeaderConstants = { | ||
export const HeaderConstants = { | ||
AUTHORIZATION: "Authorization", | ||
@@ -189,6 +189,6 @@ AUTHORIZATION_SCHEME: "Bearer", | ||
}; | ||
export var DevelopmentConnectionString = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;"; | ||
export const DevelopmentConnectionString = `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;`; | ||
// Mapping pairs to transform url from dfs endpoint to blob endpoint | ||
// Customize this value to add more mapping patterns | ||
export var ToBlobEndpointHostMappings = [ | ||
export const ToBlobEndpointHostMappings = [ | ||
["dfs.preprod.core.windows.net", "blob.preprod.core.windows.net"], | ||
@@ -204,3 +204,3 @@ ["dfs.core.windows.net", "blob.core.windows.net"], | ||
// Customize this value to add more mapping patterns | ||
export var ToDfsEndpointHostMappings = [ | ||
export const ToDfsEndpointHostMappings = [ | ||
["blob.preprod.core.windows.net", "dfs.preprod.core.windows.net"], | ||
@@ -214,5 +214,5 @@ ["blob.core.windows.net", "dfs.core.windows.net"], | ||
]; | ||
export var ETagAny = "*"; | ||
export var DeletionIdKey = "deletionid"; | ||
export var PathResultTypeConstants = { | ||
export const ETagAny = "*"; | ||
export const DeletionIdKey = "deletionid"; | ||
export const PathResultTypeConstants = { | ||
FileResourceType: "file", | ||
@@ -219,0 +219,0 @@ DirectoryResourceType: "directory" |
@@ -1,18 +0,13 @@ | ||
import { __extends } from "tslib"; | ||
/** | ||
* An error thrown when an operation is interrupted and can be continued later on. | ||
*/ | ||
var DataLakeAclChangeFailedError = /** @class */ (function (_super) { | ||
__extends(DataLakeAclChangeFailedError, _super); | ||
function DataLakeAclChangeFailedError(error, continuationToken) { | ||
var _this = _super.call(this, error.message) || this; | ||
_this.name = "DataLakeAclChangeFailedError"; | ||
_this.innerError = error; | ||
_this.continuationToken = continuationToken; | ||
Object.setPrototypeOf(_this, DataLakeAclChangeFailedError.prototype); | ||
return _this; | ||
export class DataLakeAclChangeFailedError extends Error { | ||
constructor(error, continuationToken) { | ||
super(error.message); | ||
this.name = "DataLakeAclChangeFailedError"; | ||
this.innerError = error; | ||
this.continuationToken = continuationToken; | ||
Object.setPrototypeOf(this, DataLakeAclChangeFailedError.prototype); | ||
} | ||
return DataLakeAclChangeFailedError; | ||
}(Error)); | ||
export { DataLakeAclChangeFailedError }; | ||
} | ||
//# sourceMappingURL=DataLakeAclChangeFailedError.js.map |
@@ -1,2 +0,1 @@ | ||
import { __extends } from "tslib"; | ||
// Copyright (c) Microsoft Corporation. | ||
@@ -10,4 +9,3 @@ // Licensed under the MIT license. | ||
*/ | ||
var PathClientInternal = /** @class */ (function (_super) { | ||
__extends(PathClientInternal, _super); | ||
export class PathClientInternal extends DataLakePathClient { | ||
/** | ||
@@ -22,10 +20,7 @@ * Creates an instance of DataLakePathClient from url and pipeline. | ||
*/ | ||
function PathClientInternal(url, pipeline) { | ||
var _this = _super.call(this, url, pipeline) || this; | ||
_this.blobPathContext = new Path(_this.storageClientContextToBlobEndpoint); | ||
return _this; | ||
constructor(url, pipeline) { | ||
super(url, pipeline); | ||
this.blobPathContext = new Path(this.storageClientContextToBlobEndpoint); | ||
} | ||
return PathClientInternal; | ||
}(DataLakePathClient)); | ||
export { PathClientInternal }; | ||
} | ||
//# sourceMappingURL=PathClientInternal.js.map |
@@ -8,3 +8,3 @@ // Copyright (c) Microsoft Corporation. | ||
*/ | ||
export var createSpan = createSpanFunction({ | ||
export const createSpan = createSpanFunction({ | ||
packagePrefix: "Azure.Storage.DataLake", | ||
@@ -11,0 +11,0 @@ namespace: "Microsoft.Storage" |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __awaiter, __generator } from "tslib"; | ||
/** | ||
@@ -9,15 +8,10 @@ * Convert a Browser Blob object into ArrayBuffer. | ||
*/ | ||
export function blobToArrayBuffer(blob) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var fileReader; | ||
return __generator(this, function (_a) { | ||
fileReader = new FileReader(); | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
fileReader.onloadend = function (ev) { | ||
resolve(ev.target.result); | ||
}; | ||
fileReader.onerror = reject; | ||
fileReader.readAsArrayBuffer(blob); | ||
})]; | ||
}); | ||
export async function blobToArrayBuffer(blob) { | ||
const fileReader = new FileReader(); | ||
return new Promise((resolve, reject) => { | ||
fileReader.onloadend = (ev) => { | ||
resolve(ev.target.result); | ||
}; | ||
fileReader.onerror = reject; | ||
fileReader.readAsArrayBuffer(blob); | ||
}); | ||
@@ -30,19 +24,14 @@ } | ||
*/ | ||
export function blobToString(blob) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var fileReader; | ||
return __generator(this, function (_a) { | ||
fileReader = new FileReader(); | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
fileReader.onloadend = function (ev) { | ||
resolve(ev.target.result); | ||
}; | ||
fileReader.onerror = reject; | ||
fileReader.readAsText(blob); | ||
})]; | ||
}); | ||
export async function blobToString(blob) { | ||
const fileReader = new FileReader(); | ||
return new Promise((resolve, reject) => { | ||
fileReader.onloadend = (ev) => { | ||
resolve(ev.target.result); | ||
}; | ||
fileReader.onerror = reject; | ||
fileReader.readAsText(blob); | ||
}); | ||
} | ||
export var fsStat = function stat() { }; | ||
export var fsCreateReadStream = function createReadStream() { }; | ||
export const fsStat = function stat() { }; | ||
export const fsCreateReadStream = function createReadStream() { }; | ||
//# sourceMappingURL=utils.browser.js.map |
@@ -1,2 +0,1 @@ | ||
import { __awaiter, __generator } from "tslib"; | ||
import { HttpHeaders, isNode, URLBuilder } from "@azure/core-http"; | ||
@@ -57,4 +56,4 @@ import { DevelopmentConnectionString, HeaderConstants, UrlConstants } from "./constants"; | ||
export function escapeURLPath(url) { | ||
var urlParsed = URLBuilder.parse(url); | ||
var path = urlParsed.getPath(); | ||
const urlParsed = URLBuilder.parse(url); | ||
let path = urlParsed.getPath(); | ||
path = path || "/"; | ||
@@ -68,8 +67,7 @@ path = escape(path); | ||
// https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key | ||
var proxyUri = ""; | ||
let proxyUri = ""; | ||
if (connectionString.search("DevelopmentStorageProxyUri=") !== -1) { | ||
// CONNECTION_STRING=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://myProxyUri | ||
var matchCredentials = connectionString.split(";"); | ||
for (var _i = 0, matchCredentials_1 = matchCredentials; _i < matchCredentials_1.length; _i++) { | ||
var element = matchCredentials_1[_i]; | ||
const matchCredentials = connectionString.split(";"); | ||
for (const element of matchCredentials) { | ||
if (element.trim().startsWith("DevelopmentStorageProxyUri=")) { | ||
@@ -83,5 +81,4 @@ proxyUri = element.trim().match("DevelopmentStorageProxyUri=(.*)")[1]; | ||
export function getValueInConnString(connectionString, argument) { | ||
var elements = connectionString.split(";"); | ||
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { | ||
var element = elements_1[_i]; | ||
const elements = connectionString.split(";"); | ||
for (const element of elements) { | ||
if (element.trim().startsWith(argument)) { | ||
@@ -100,3 +97,3 @@ return element.trim().match(argument + "=(.*)")[1]; | ||
export function extractConnectionStringParts(connectionString) { | ||
var proxyUri = ""; | ||
let proxyUri = ""; | ||
if (connectionString.startsWith("UseDevelopmentStorage=true")) { | ||
@@ -108,3 +105,3 @@ // Development connection string | ||
// Matching BlobEndpoint in the Account connection string | ||
var blobEndpoint = getValueInConnString(connectionString, "BlobEndpoint"); | ||
let blobEndpoint = getValueInConnString(connectionString, "BlobEndpoint"); | ||
// Slicing off '/' at the end if exists | ||
@@ -116,6 +113,6 @@ // (The methods that use `extractConnectionStringParts` expect the url to not have `/` at the end) | ||
// Account connection string | ||
var defaultEndpointsProtocol = ""; | ||
var accountName = ""; | ||
var accountKey = Buffer.from("accountKey", "base64"); | ||
var endpointSuffix = ""; | ||
let defaultEndpointsProtocol = ""; | ||
let accountName = ""; | ||
let accountKey = Buffer.from("accountKey", "base64"); | ||
let endpointSuffix = ""; | ||
// Get account name and key | ||
@@ -128,3 +125,3 @@ accountName = getValueInConnString(connectionString, "AccountName"); | ||
defaultEndpointsProtocol = getValueInConnString(connectionString, "DefaultEndpointsProtocol"); | ||
var protocol = defaultEndpointsProtocol.toLowerCase(); | ||
const protocol = defaultEndpointsProtocol.toLowerCase(); | ||
if (protocol !== "https" && protocol !== "http") { | ||
@@ -137,3 +134,3 @@ throw new Error("Invalid DefaultEndpointsProtocol in the provided Connection String. Expecting 'https' or 'http'"); | ||
} | ||
blobEndpoint = defaultEndpointsProtocol + "://" + accountName + ".blob." + endpointSuffix; | ||
blobEndpoint = `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`; | ||
} | ||
@@ -149,5 +146,5 @@ if (!accountName) { | ||
url: blobEndpoint, | ||
accountName: accountName, | ||
accountKey: accountKey, | ||
proxyUri: proxyUri | ||
accountName, | ||
accountKey, | ||
proxyUri | ||
}; | ||
@@ -157,4 +154,4 @@ } | ||
// SAS connection string | ||
var accountSas = getValueInConnString(connectionString, "SharedAccessSignature"); | ||
var accountName = getAccountNameFromUrl(blobEndpoint); | ||
const accountSas = getValueInConnString(connectionString, "SharedAccessSignature"); | ||
const accountName = getAccountNameFromUrl(blobEndpoint); | ||
if (!blobEndpoint) { | ||
@@ -166,3 +163,3 @@ throw new Error("Invalid BlobEndpoint in the provided SAS Connection String"); | ||
} | ||
return { kind: "SASConnString", url: blobEndpoint, accountName: accountName, accountSas: accountSas }; | ||
return { kind: "SASConnString", url: blobEndpoint, accountName, accountSas }; | ||
} | ||
@@ -191,5 +188,5 @@ } | ||
export function appendToURLPath(url, name) { | ||
var urlParsed = URLBuilder.parse(url); | ||
var path = urlParsed.getPath(); | ||
path = path ? (path.endsWith("/") ? "" + path + name : path + "/" + name) : name; | ||
const urlParsed = URLBuilder.parse(url); | ||
let path = urlParsed.getPath(); | ||
path = path ? (path.endsWith("/") ? `${path}${name}` : `${path}/${name}`) : name; | ||
urlParsed.setPath(path); | ||
@@ -206,4 +203,4 @@ return urlParsed.toString(); | ||
export function appendToURLQuery(url, queryParts) { | ||
var urlParsed = URLBuilder.parse(url); | ||
var query = urlParsed.getQuery(); | ||
const urlParsed = URLBuilder.parse(url); | ||
let query = urlParsed.getQuery(); | ||
if (query) { | ||
@@ -228,3 +225,3 @@ query += "&" + queryParts; | ||
export function setURLParameter(url, name, value) { | ||
var urlParsed = URLBuilder.parse(url); | ||
const urlParsed = URLBuilder.parse(url); | ||
urlParsed.setQueryParameter(name, value); | ||
@@ -240,3 +237,3 @@ return urlParsed.toString(); | ||
export function getURLParameter(url, name) { | ||
var urlParsed = URLBuilder.parse(url); | ||
const urlParsed = URLBuilder.parse(url); | ||
return urlParsed.getQueryParameterValue(name); | ||
@@ -252,3 +249,3 @@ } | ||
export function setURLHost(url, host) { | ||
var urlParsed = URLBuilder.parse(url); | ||
const urlParsed = URLBuilder.parse(url); | ||
urlParsed.setHost(host); | ||
@@ -263,3 +260,3 @@ return urlParsed.toString(); | ||
export function getURLPath(url) { | ||
var urlParsed = URLBuilder.parse(url); | ||
const urlParsed = URLBuilder.parse(url); | ||
return urlParsed.getPath(); | ||
@@ -274,3 +271,3 @@ } | ||
export function setURLPath(url, path) { | ||
var urlParsed = URLBuilder.parse(url); | ||
const urlParsed = URLBuilder.parse(url); | ||
urlParsed.setPath(path); | ||
@@ -285,3 +282,3 @@ return urlParsed.toString(); | ||
export function getURLScheme(url) { | ||
var urlParsed = URLBuilder.parse(url); | ||
const urlParsed = URLBuilder.parse(url); | ||
return urlParsed.getScheme(); | ||
@@ -295,13 +292,13 @@ } | ||
export function getURLPathAndQuery(url) { | ||
var urlParsed = URLBuilder.parse(url); | ||
var pathString = urlParsed.getPath(); | ||
const urlParsed = URLBuilder.parse(url); | ||
const pathString = urlParsed.getPath(); | ||
if (!pathString) { | ||
throw new RangeError("Invalid url without valid path."); | ||
} | ||
var queryString = urlParsed.getQuery() || ""; | ||
let queryString = urlParsed.getQuery() || ""; | ||
queryString = queryString.trim(); | ||
if (queryString != "") { | ||
queryString = queryString.startsWith("?") ? queryString : "?" + queryString; // Ensure query string start with '?' | ||
queryString = queryString.startsWith("?") ? queryString : `?${queryString}`; // Ensure query string start with '?' | ||
} | ||
return "" + pathString + queryString; | ||
return `${pathString}${queryString}`; | ||
} | ||
@@ -314,3 +311,3 @@ /** | ||
export function getURLQueries(url) { | ||
var queryString = URLBuilder.parse(url).getQuery(); | ||
let queryString = URLBuilder.parse(url).getQuery(); | ||
if (!queryString) { | ||
@@ -321,14 +318,13 @@ return {}; | ||
queryString = queryString.startsWith("?") ? queryString.substr(1) : queryString; | ||
var querySubStrings = queryString.split("&"); | ||
querySubStrings = querySubStrings.filter(function (value) { | ||
var indexOfEqual = value.indexOf("="); | ||
var lastIndexOfEqual = value.lastIndexOf("="); | ||
let querySubStrings = queryString.split("&"); | ||
querySubStrings = querySubStrings.filter((value) => { | ||
const indexOfEqual = value.indexOf("="); | ||
const lastIndexOfEqual = value.lastIndexOf("="); | ||
return (indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual && lastIndexOfEqual < value.length - 1); | ||
}); | ||
var queries = {}; | ||
for (var _i = 0, querySubStrings_1 = querySubStrings; _i < querySubStrings_1.length; _i++) { | ||
var querySubString = querySubStrings_1[_i]; | ||
var splitResults = querySubString.split("="); | ||
var key = splitResults[0]; | ||
var value = splitResults[1]; | ||
const queries = {}; | ||
for (const querySubString of querySubStrings) { | ||
const splitResults = querySubString.split("="); | ||
const key = splitResults[0]; | ||
const value = splitResults[1]; | ||
queries[key] = value; | ||
@@ -344,3 +340,3 @@ } | ||
export function getURLQueryString(url) { | ||
var urlParsed = URLBuilder.parse(url); | ||
const urlParsed = URLBuilder.parse(url); | ||
return urlParsed.getQuery(); | ||
@@ -355,3 +351,3 @@ } | ||
export function setURLQueries(url, queryString) { | ||
var urlParsed = URLBuilder.parse(url); | ||
const urlParsed = URLBuilder.parse(url); | ||
urlParsed.setQuery(queryString); | ||
@@ -368,6 +364,5 @@ return urlParsed.toString(); | ||
*/ | ||
export function truncatedISO8061Date(date, withMilliseconds) { | ||
if (withMilliseconds === void 0) { withMilliseconds = true; } | ||
export function truncatedISO8061Date(date, withMilliseconds = true) { | ||
// Date.toISOString() will return like "2018-10-29T06:34:36.139Z" | ||
var dateString = date.toISOString(); | ||
const dateString = date.toISOString(); | ||
return withMilliseconds | ||
@@ -400,10 +395,10 @@ ? dateString.substring(0, dateString.length - 1) + "0000" + "Z" | ||
// To generate a 64 bytes base64 string, source string should be 48 | ||
var maxSourceStringLength = 48; | ||
const maxSourceStringLength = 48; | ||
// A blob can have a maximum of 100,000 uncommitted blocks at any given time | ||
var maxBlockIndexLength = 6; | ||
var maxAllowedBlockIDPrefixLength = maxSourceStringLength - maxBlockIndexLength; | ||
const maxBlockIndexLength = 6; | ||
const maxAllowedBlockIDPrefixLength = maxSourceStringLength - maxBlockIndexLength; | ||
if (blockIDPrefix.length > maxAllowedBlockIDPrefixLength) { | ||
blockIDPrefix = blockIDPrefix.slice(0, maxAllowedBlockIDPrefixLength); | ||
} | ||
var res = blockIDPrefix + | ||
const res = blockIDPrefix + | ||
padStart(blockIndex.toString(), maxSourceStringLength - blockIDPrefix.length, "0"); | ||
@@ -419,25 +414,21 @@ return base64encode(res); | ||
*/ | ||
export function delay(timeInMs, aborter, abortError) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
var timeout; | ||
var abortHandler = function () { | ||
if (timeout !== undefined) { | ||
clearTimeout(timeout); | ||
} | ||
reject(abortError); | ||
}; | ||
var resolveHandler = function () { | ||
if (aborter !== undefined) { | ||
aborter.removeEventListener("abort", abortHandler); | ||
} | ||
resolve(); | ||
}; | ||
timeout = setTimeout(resolveHandler, timeInMs); | ||
if (aborter !== undefined) { | ||
aborter.addEventListener("abort", abortHandler); | ||
} | ||
})]; | ||
}); | ||
export async function delay(timeInMs, aborter, abortError) { | ||
return new Promise((resolve, reject) => { | ||
let timeout; | ||
const abortHandler = () => { | ||
if (timeout !== undefined) { | ||
clearTimeout(timeout); | ||
} | ||
reject(abortError); | ||
}; | ||
const resolveHandler = () => { | ||
if (aborter !== undefined) { | ||
aborter.removeEventListener("abort", abortHandler); | ||
} | ||
resolve(); | ||
}; | ||
timeout = setTimeout(resolveHandler, timeInMs); | ||
if (aborter !== undefined) { | ||
aborter.addEventListener("abort", abortHandler); | ||
} | ||
}); | ||
@@ -452,4 +443,3 @@ } | ||
*/ | ||
export function padStart(currentString, targetLength, padString) { | ||
if (padString === void 0) { padString = " "; } | ||
export function padStart(currentString, targetLength, padString = " ") { | ||
// TS doesn't know this code needs to run downlevel sometimes. | ||
@@ -473,3 +463,3 @@ // @ts-expect-error | ||
export function sanitizeURL(url) { | ||
var safeURL = url; | ||
let safeURL = url; | ||
if (getURLParameter(safeURL, UrlConstants.Parameters.SIGNATURE)) { | ||
@@ -481,5 +471,4 @@ safeURL = setURLParameter(safeURL, UrlConstants.Parameters.SIGNATURE, "*****"); | ||
export function sanitizeHeaders(originalHeader) { | ||
var headers = new HttpHeaders(); | ||
for (var _i = 0, _a = originalHeader.headersArray(); _i < _a.length; _i++) { | ||
var header = _a[_i]; | ||
const headers = new HttpHeaders(); | ||
for (const header of originalHeader.headersArray()) { | ||
if (header.name.toLowerCase() === HeaderConstants.AUTHORIZATION.toLowerCase()) { | ||
@@ -512,4 +501,4 @@ headers.set(header.name, "*****"); | ||
export function getAccountNameFromUrl(blobEndpointUrl) { | ||
var parsedUrl = URLBuilder.parse(blobEndpointUrl); | ||
var accountName; | ||
const parsedUrl = URLBuilder.parse(blobEndpointUrl); | ||
let accountName; | ||
try { | ||
@@ -540,3 +529,3 @@ if (parsedUrl.getHost().split(".")[1] === "blob") { | ||
} | ||
var host = parsedUrl.getHost() + (parsedUrl.getPort() == undefined ? "" : ":" + parsedUrl.getPort()); | ||
const host = parsedUrl.getHost() + (parsedUrl.getPort() == undefined ? "" : ":" + parsedUrl.getPort()); | ||
// Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'. | ||
@@ -543,0 +532,0 @@ // Case 2: localhost(:port), use broad regex to match port part. |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { __awaiter, __generator } from "tslib"; | ||
import * as fs from "fs"; | ||
import * as util from "util"; | ||
import { isNode } from "@azure/core-http"; | ||
/** | ||
@@ -16,35 +14,30 @@ * Reads a readable stream into buffer. Fill the buffer from offset to end. | ||
*/ | ||
export function streamToBuffer(stream, buffer, offset, end, encoding) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var pos, count; | ||
return __generator(this, function (_a) { | ||
pos = 0; | ||
count = end - offset; | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
stream.on("readable", function () { | ||
if (pos >= count) { | ||
resolve(); | ||
return; | ||
} | ||
var chunk = stream.read(); | ||
if (!chunk) { | ||
return; | ||
} | ||
if (typeof chunk === "string") { | ||
chunk = Buffer.from(chunk, encoding); | ||
} | ||
// How much data needed in this chunk | ||
var chunkLength = pos + chunk.length > count ? count - pos : chunk.length; | ||
buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength); | ||
pos += chunkLength; | ||
}); | ||
stream.on("end", function () { | ||
if (pos < count) { | ||
reject(new Error("Stream drains before getting enough data needed. Data read: " + pos + ", data need: " + count)); | ||
} | ||
resolve(); | ||
}); | ||
stream.on("error", reject); | ||
})]; | ||
export async function streamToBuffer(stream, buffer, offset, end, encoding) { | ||
let pos = 0; // Position in stream | ||
const count = end - offset; // Total amount of data needed in stream | ||
return new Promise((resolve, reject) => { | ||
stream.on("readable", () => { | ||
if (pos >= count) { | ||
resolve(); | ||
return; | ||
} | ||
let chunk = stream.read(); | ||
if (!chunk) { | ||
return; | ||
} | ||
if (typeof chunk === "string") { | ||
chunk = Buffer.from(chunk, encoding); | ||
} | ||
// How much data needed in this chunk | ||
const chunkLength = pos + chunk.length > count ? count - pos : chunk.length; | ||
buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength); | ||
pos += chunkLength; | ||
}); | ||
stream.on("end", () => { | ||
if (pos < count) { | ||
reject(new Error(`Stream drains before getting enough data needed. Data read: ${pos}, data need: ${count}`)); | ||
} | ||
resolve(); | ||
}); | ||
stream.on("error", reject); | ||
}); | ||
@@ -61,30 +54,25 @@ } | ||
*/ | ||
export function streamToBuffer2(stream, buffer, encoding) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var pos, bufferSize; | ||
return __generator(this, function (_a) { | ||
pos = 0; | ||
bufferSize = buffer.length; | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
stream.on("readable", function () { | ||
var chunk = stream.read(); | ||
if (!chunk) { | ||
return; | ||
} | ||
if (typeof chunk === "string") { | ||
chunk = Buffer.from(chunk, encoding); | ||
} | ||
if (pos + chunk.length > bufferSize) { | ||
reject(new Error("Stream exceeds buffer size. Buffer size: " + bufferSize)); | ||
return; | ||
} | ||
buffer.fill(chunk, pos, pos + chunk.length); | ||
pos += chunk.length; | ||
}); | ||
stream.on("end", function () { | ||
resolve(pos); | ||
}); | ||
stream.on("error", reject); | ||
})]; | ||
export async function streamToBuffer2(stream, buffer, encoding) { | ||
let pos = 0; // Position in stream | ||
const bufferSize = buffer.length; | ||
return new Promise((resolve, reject) => { | ||
stream.on("readable", () => { | ||
let chunk = stream.read(); | ||
if (!chunk) { | ||
return; | ||
} | ||
if (typeof chunk === "string") { | ||
chunk = Buffer.from(chunk, encoding); | ||
} | ||
if (pos + chunk.length > bufferSize) { | ||
reject(new Error(`Stream exceeds buffer size. Buffer size: ${bufferSize}`)); | ||
return; | ||
} | ||
buffer.fill(chunk, pos, pos + chunk.length); | ||
pos += chunk.length; | ||
}); | ||
stream.on("end", () => { | ||
resolve(pos); | ||
}); | ||
stream.on("error", reject); | ||
}); | ||
@@ -97,4 +85,4 @@ } | ||
*/ | ||
export var fsStat = util.promisify(isNode ? fs.stat : function stat() { }); | ||
export var fsCreateReadStream = fs.createReadStream; | ||
export const fsStat = util.promisify(fs.stat); | ||
export const fsCreateReadStream = fs.createReadStream; | ||
//# sourceMappingURL=utils.node.js.map |
{ | ||
"name": "@azure/storage-file-datalake", | ||
"version": "12.5.0", | ||
"version": "12.6.0-alpha.20210707.1", | ||
"description": "Microsoft Azure Storage SDK for JavaScript - DataLake", | ||
@@ -28,3 +28,3 @@ "sdk-type": "client", | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=12.0.0" | ||
}, | ||
@@ -92,8 +92,16 @@ "scripts": { | ||
}, | ||
"homepage": "https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/storage/storage-file-datalake/", | ||
"homepage": "https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-file-datalake/", | ||
"//metadata": { | ||
"constantPaths": [ | ||
{ | ||
"path": "src/generated/src/storageClientContext.ts", | ||
"prefix": "packageVersion" | ||
}, | ||
{ | ||
"path": "src/utils/constants.ts", | ||
"prefix": "SDK_VERSION" | ||
}, | ||
{ | ||
"path": "swagger/README.md", | ||
"prefix": "package-version" | ||
} | ||
@@ -104,16 +112,16 @@ ] | ||
"@azure/abort-controller": "^1.0.0", | ||
"@azure/core-http": "^1.2.0", | ||
"@azure/core-http": "^2.0.0", | ||
"@azure/core-paging": "^1.1.1", | ||
"@azure/core-tracing": "1.0.0-preview.11", | ||
"@azure/core-tracing": "1.0.0-preview.12", | ||
"@azure/logger": "^1.0.0", | ||
"@azure/storage-blob": "^12.6.0-beta.1", | ||
"@azure/storage-blob": "^12.7.0-alpha", | ||
"events": "^3.0.0", | ||
"tslib": "^2.0.0" | ||
"tslib": "^2.2.0" | ||
}, | ||
"devDependencies": { | ||
"@azure/dev-tool": "^1.0.0", | ||
"@azure/eslint-plugin-azure-sdk": "^3.0.0", | ||
"@azure/identity": "2.0.0-beta.3", | ||
"@azure/test-utils-recorder": "^1.0.0", | ||
"@azure/test-utils-perfstress": "^1.0.0", | ||
"@azure/dev-tool": "^1.0.0-alpha", | ||
"@azure/eslint-plugin-azure-sdk": "^3.0.0-alpha", | ||
"@azure/identity": "^2.0.0-alpha", | ||
"@azure/test-utils-recorder": "^1.0.0-alpha", | ||
"@azure/test-utils-perfstress": "^1.0.0-alpha", | ||
"@microsoft/api-extractor": "7.7.11", | ||
@@ -126,3 +134,3 @@ "@rollup/plugin-commonjs": "11.0.2", | ||
"@types/mocha": "^7.0.2", | ||
"@types/node": "^8.0.0", | ||
"@types/node": "^12.0.0", | ||
"@types/query-string": "6.2.0", | ||
@@ -129,0 +137,0 @@ "assert": "^1.4.1", |
@@ -12,13 +12,24 @@ # Azure Storage File Data Lake client library for JavaScript | ||
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-file-datalake) | | ||
[Package (npm)](https://www.npmjs.com/package/@azure/storage-file-datalake) | | ||
[API Reference Documentation](https://docs.microsoft.com/javascript/api/@azure/storage-file-datalake) | | ||
[Product documentation](https://docs.microsoft.com/azure/storage/blobs/data-lake-storage-introduction?toc=%2fazure%2fstorage%2fblobs%2ftoc.json) | | ||
[Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-file-datalake/samples) | | ||
[Azure Storage Data Lake REST APIs](https://docs.microsoft.com/rest/api/storageservices/data-lake-storage-gen2) | ||
key links: | ||
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-file-datalake) | ||
- [Package (npm)](https://www.npmjs.com/package/@azure/storage-file-datalake) | ||
- [API Reference Documentation](https://docs.microsoft.com/javascript/api/@azure/storage-file-datalake) | ||
- [Product documentation](https://docs.microsoft.com/azure/storage/blobs/data-lake-storage-introduction?toc=%2fazure%2fstorage%2fblobs%2ftoc.json) | ||
- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-file-datalake/samples) | ||
- [Azure Storage Data Lake REST APIs](https://docs.microsoft.com/rest/api/storageservices/data-lake-storage-gen2) | ||
## Getting started | ||
**Prerequisites**: You must have an [Azure subscription](https://azure.microsoft.com/free/) and a [Storage Account](https://docs.microsoft.com/azure/storage/blobs/data-lake-storage-quickstart-create-account?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json#create-an-account-using-the-azure-portal) to use this package. If you are using this package in a Node.js application, then Node.js version 8.0.0 or higher is required. | ||
### Currently supported environments | ||
- [LTS versions of Node.js](https://nodejs.org/about/releases/) | ||
- Latest versions of Safari, Chrome, Edge, and Firefox. | ||
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. | ||
### Prerequisites | ||
- An [Azure subscription](https://azure.microsoft.com/free/) | ||
- A [Storage Account](https://docs.microsoft.com/azure/storage/common/storage-account-create) | ||
### Install the package | ||
@@ -42,3 +53,3 @@ | ||
The Azure Data Lake Storage service supports the use of Azure Active Directory to authenticate requests to its APIs. The [`@azure/identity`](https://www.npmjs.com/package/@azure/identity) package provides a variety of credential types that your application can use to do this. Please see the [README for `@azure/identity`](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/README.md) for more details and samples to get you started. | ||
The Azure Data Lake Storage service supports the use of Azure Active Directory to authenticate requests to its APIs. The [`@azure/identity`](https://www.npmjs.com/package/@azure/identity) package provides a variety of credential types that your application can use to do this. Please see the [README for `@azure/identity`](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/README.md) for more details and samples to get you started. | ||
@@ -49,20 +60,15 @@ ### Compatibility | ||
#### Compatible with IE11 | ||
#### Web Workers | ||
You need polyfills to make this library work with IE11. The easiest way is to use [@babel/polyfill](https://babeljs.io/docs/en/babel-polyfill), or [polyfill service](https://polyfill.io/v2/docs/). | ||
This library requires certain DOM objects to be globally available when used in the browser, which web workers do not make available by default. You will need to polyfill these to make this library work in web workers. | ||
You can also load separate polyfills for missed ES feature(s). | ||
This library depends on following ES features which need external polyfills loaded. | ||
For more information please refer to our [documentation for using Azure SDK for JS in Web Workers](https://aka.ms/azsdk/js/web-workers) | ||
- `Promise` | ||
- `String.prototype.startsWith` | ||
- `String.prototype.endsWith` | ||
- `String.prototype.repeat` | ||
- `String.prototype.includes` | ||
- `Array.prototype.includes` | ||
- `Object.assign` | ||
- `Object.keys` (Overrides the IE11's `Object.keys` with a polyfill to enable the [ES6 behavior](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/keys#Notes)) | ||
- `Symbol` | ||
- `Symbol.iterator` | ||
This library depends on following DOM APIs which need external polyfills loaded when used in web workers: | ||
- [`document`](https://developer.mozilla.org/docs/Web/API/Document) | ||
- [`DOMParser`](https://developer.mozilla.org/docs/Web/API/DOMParser) | ||
- [`Node`](https://developer.mozilla.org/docs/Web/API/Node) | ||
- [`XMLSerializer`](https://developer.mozilla.org/docs/Web/API/XMLSerializer) | ||
#### Differences between Node.js and browsers | ||
@@ -215,3 +221,3 @@ | ||
See the [Azure AD Auth sample](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/storage/storage-blob/samples/javascript/azureAdAuth.js) for a complete example using this method. | ||
See the [Azure AD Auth sample](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/samples/javascript/azureAdAuth.js) for a complete example using this method. | ||
@@ -574,10 +580,10 @@ [Note - Above steps are only for Node.js] | ||
- [DataLake Storage Samples (JavaScript)](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-file-datalake/samples/javascript) | ||
- [DataLake Storage Samples (TypeScript)](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-file-datalake/samples/typescript) | ||
- [DataLake Storage Test Cases](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-file-datalake/test/) | ||
- [DataLake Storage Samples (JavaScript)](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-file-datalake/samples/javascript) | ||
- [DataLake Storage Samples (TypeScript)](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-file-datalake/samples/typescript) | ||
- [DataLake Storage Test Cases](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-file-datalake/test/) | ||
## Contributing | ||
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) to learn more about how to build and test the code. | ||
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. | ||
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fstorage%2Fstorage-blob%2FREADME.png) |
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 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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
585
2638745
29461
1
+ Added@azure/core-http@2.3.2(transitive)
+ Added@azure/core-tracing@1.0.0-preview.12(transitive)
+ Added@opentelemetry/api@1.9.0(transitive)
+ Added@types/node@22.13.0(transitive)
+ Added@types/tunnel@0.0.3(transitive)
+ Addedxml2js@0.5.0(transitive)
- Removed@azure/core-asynciterator-polyfill@1.0.2(transitive)
- Removed@azure/core-http@1.2.6(transitive)
- Removed@azure/core-tracing@1.0.0-preview.11(transitive)
- Removed@opencensus/web-types@0.0.7(transitive)
- Removed@opentelemetry/api@1.0.0-rc.0(transitive)
- Removed@types/node@22.12.0(transitive)
- Removed@types/tunnel@0.0.1(transitive)
- Removedform-data@3.0.2(transitive)
- Removedxml2js@0.4.23(transitive)
Updated@azure/core-http@^2.0.0
Updatedtslib@^2.2.0