Use @actions/cache 1.0.5

This commit is contained in:
Aiqiao Yan 2020-12-10 16:31:51 -05:00
parent a3047dcdce
commit 752e778edb
4 changed files with 2241 additions and 1331 deletions

1767
dist/restore/index.js vendored
View File

@ -1074,7 +1074,9 @@ function resolvePaths(patterns) {
try {
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
const file = _d.value;
const relativeFile = path.relative(workspace, file);
const relativeFile = path
.relative(workspace, file)
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
core.debug(`Matched: ${relativeFile}`);
// Paths are made relative so the tar entries are all relative to the root of the workspace.
paths.push(`${relativeFile}`);
@ -8540,12 +8542,19 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __webpack_require__(470);
const fs = __webpack_require__(747);
const globOptionsHelper = __webpack_require__(601);
const path = __webpack_require__(622);
const patternHelper = __webpack_require__(597);
const core = __importStar(__webpack_require__(470));
const fs = __importStar(__webpack_require__(747));
const globOptionsHelper = __importStar(__webpack_require__(601));
const path = __importStar(__webpack_require__(622));
const patternHelper = __importStar(__webpack_require__(597));
const internal_match_kind_1 = __webpack_require__(327);
const internal_pattern_1 = __webpack_require__(923);
const internal_search_state_1 = __webpack_require__(728);
@ -9796,6 +9805,13 @@ var StorageError = {
type: {
name: "String"
}
},
code: {
xmlName: "Code",
serializedName: "Code",
type: {
name: "String"
}
}
}
}
@ -10156,6 +10172,13 @@ var BlobPropertiesInternal = {
type: {
name: "String"
}
},
lastAccessedOn: {
xmlName: "LastAccessTime",
serializedName: "LastAccessTime",
type: {
name: "DateTimeRfc1123"
}
}
}
}
@ -10861,6 +10884,70 @@ var JsonTextConfiguration = {
}
}
};
var ArrowField = {
xmlName: "Field",
serializedName: "ArrowField",
type: {
name: "Composite",
className: "ArrowField",
modelProperties: {
type: {
xmlName: "Type",
required: true,
serializedName: "Type",
type: {
name: "String"
}
},
name: {
xmlName: "Name",
serializedName: "Name",
type: {
name: "String"
}
},
precision: {
xmlName: "Precision",
serializedName: "Precision",
type: {
name: "Number"
}
},
scale: {
xmlName: "Scale",
serializedName: "Scale",
type: {
name: "Number"
}
}
}
}
};
var ArrowConfiguration = {
serializedName: "ArrowConfiguration",
type: {
name: "Composite",
className: "ArrowConfiguration",
modelProperties: {
schema: {
xmlIsWrapped: true,
xmlName: "Schema",
xmlElementName: "Field",
required: true,
serializedName: "Schema",
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "ArrowField"
}
}
}
}
}
}
};
var ListContainersSegmentResponse = {
xmlName: "EnumerationResults",
serializedName: "ListContainersSegmentResponse",
@ -11301,7 +11388,8 @@ var QueryFormat = {
name: "Enum",
allowedValues: [
"delimited",
"json"
"json",
"arrow"
]
}
},
@ -11320,6 +11408,14 @@ var QueryFormat = {
name: "Composite",
className: "JsonTextConfiguration"
}
},
arrowConfiguration: {
xmlName: "ArrowConfiguration",
serializedName: "ArrowConfiguration",
type: {
name: "Composite",
className: "ArrowConfiguration"
}
}
}
}
@ -12973,6 +13069,12 @@ var BlobDownloadHeaders = {
name: "Boolean"
}
},
lastAccessed: {
serializedName: "x-ms-last-access-time",
type: {
name: "DateTimeRfc1123"
}
},
contentCrc64: {
serializedName: "x-ms-content-crc64",
type: {
@ -13302,6 +13404,12 @@ var BlobGetPropertiesHeaders = {
name: "String"
}
},
lastAccessed: {
serializedName: "x-ms-last-access-time",
type: {
name: "DateTimeRfc1123"
}
},
errorCode: {
serializedName: "x-ms-error-code",
type: {
@ -17688,7 +17796,7 @@ var version = {
required: true,
isConstant: true,
serializedName: "x-ms-version",
defaultValue: '2019-12-12',
defaultValue: '2020-02-10',
type: {
name: "String"
}
@ -18680,6 +18788,8 @@ var getAccountInfoOperationSpec$1 = {
var Mappers$2 = /*#__PURE__*/Object.freeze({
__proto__: null,
ArrowConfiguration: ArrowConfiguration,
ArrowField: ArrowField,
BlobAbortCopyFromURLHeaders: BlobAbortCopyFromURLHeaders,
BlobAcquireLeaseHeaders: BlobAcquireLeaseHeaders,
BlobBreakLeaseHeaders: BlobBreakLeaseHeaders,
@ -20769,8 +20879,8 @@ var logger = logger$1.createClientLogger("storage-blob");
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
var SDK_VERSION = "12.2.1";
var SERVICE_VERSION = "2019-12-12";
var SDK_VERSION = "12.3.0";
var SERVICE_VERSION = "2020-02-10";
var BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB
var BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB
var BLOCK_BLOB_MAX_BLOCKS = 50000;
@ -21477,7 +21587,7 @@ function toTags(tags) {
* Convert BlobQueryTextConfiguration to QuerySerialization type.
*
* @export
* @param {(BlobQueryJsonTextConfiguration | BlobQueryCsvTextConfiguration)} [textConfiguration]
* @param {(BlobQueryJsonTextConfiguration | BlobQueryCsvTextConfiguration | BlobQueryArrowConfiguration)} [textConfiguration]
* @returns {(QuerySerialization | undefined)}
*/
function toQuerySerialization(textConfiguration) {
@ -21507,6 +21617,15 @@ function toQuerySerialization(textConfiguration) {
}
}
};
case "arrow":
return {
format: {
type: "arrow",
arrowConfiguration: {
schema: textConfiguration.schema
}
}
};
default:
throw Error("Invalid BlobQueryTextConfiguration.");
}
@ -22794,6 +22913,21 @@ var BlobDownloadResponse = /** @class */ (function () {
enumerable: false,
configurable: true
});
Object.defineProperty(BlobDownloadResponse.prototype, "lastAccessed", {
/**
* Returns the UTC date and time generated by the service that indicates the time at which the blob was
* last read or written to.
*
* @readonly
* @type {(Date | undefined)}
* @memberof BlobDownloadResponse
*/
get: function () {
return this.originalResponse.lastAccessed;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BlobDownloadResponse.prototype, "metadata", {
/**
* A name-value pair
@ -24798,7 +24932,7 @@ var StorageSharedKeyCredential = /** @class */ (function (_super) {
* regenerated.
*/
var packageName = "azure-storage-blob";
var packageVersion = "12.2.1";
var packageVersion = "12.3.0";
var StorageClientContext = /** @class */ (function (_super) {
tslib.__extends(StorageClientContext, _super);
/**
@ -24820,7 +24954,7 @@ var StorageClientContext = /** @class */ (function (_super) {
options.userAgent = packageName + "/" + packageVersion + " " + defaultUserAgent;
}
_this = _super.call(this, undefined, options) || this;
_this.version = "2019-12-12";
_this.version = "2020-02-10";
_this.baseUri = "{url}";
_this.requestContentType = "application/json; charset=utf-8";
_this.url = url;
@ -28164,6 +28298,56 @@ var BlockBlobClient = /** @class */ (function (_super) {
});
};
// High level functions
/**
* Uploads a Buffer(Node.js)/Blob(browsers)/ArrayBuffer/ArrayBufferView object to a BlockBlob.
*
* When data length is no more than the specifiled {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is
* {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload.
* Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList}
* to commit the block list.
*
* @export
* @param {Buffer | Blob | ArrayBuffer | ArrayBufferView} data Buffer(Node.js), Blob, ArrayBuffer or ArrayBufferView
* @param {BlockBlobParallelUploadOptions} [options]
* @returns {Promise<BlobUploadCommonResponse>}
* @memberof BlockBlobClient
*/
BlockBlobClient.prototype.uploadData = function (data, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, buffer_1, browserBlob_1;
return tslib.__generator(this, function (_b) {
_a = createSpan("BlockBlobClient-uploadData", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions;
try {
if (true) {
if (data instanceof Buffer) {
buffer_1 = data;
}
else if (data instanceof ArrayBuffer) {
buffer_1 = Buffer.from(data);
}
else {
data = data;
buffer_1 = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
}
return [2 /*return*/, this.uploadSeekableInternal(function (offset, size) { return buffer_1.slice(offset, offset + size); }, buffer_1.byteLength, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
}
else {}
}
catch (e) {
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e.message
});
throw e;
}
finally {
span.end();
}
return [2 /*return*/];
});
});
};
/**
* ONLY AVAILABLE IN BROWSERS.
*
@ -28173,6 +28357,8 @@ var BlockBlobClient = /** @class */ (function (_super) {
* Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call
* {@link commitBlockList} to commit the block list.
*
* @deprecated Use {@link uploadData} instead.
*
* @export
* @param {Blob | ArrayBuffer | ArrayBufferView} browserData Blob, File, ArrayBuffer or ArrayBufferView
* @param {BlockBlobParallelUploadOptions} [options] Options to upload browser data.
@ -28182,7 +28368,7 @@ var BlockBlobClient = /** @class */ (function (_super) {
BlockBlobClient.prototype.uploadBrowserData = function (browserData, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, browserBlob_1, e_29;
var _a, span, spanOptions, browserBlob_2, e_29;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -28190,10 +28376,8 @@ var BlockBlobClient = /** @class */ (function (_super) {
_b.label = 1;
case 1:
_b.trys.push([1, 3, 4, 5]);
browserBlob_1 = new Blob([browserData]);
return [4 /*yield*/, this.uploadSeekableBlob(function (offset, size) {
return browserBlob_1.slice(offset, offset + size);
}, browserBlob_1.size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
browserBlob_2 = new Blob([browserData]);
return [4 /*yield*/, this.uploadSeekableInternal(function (offset, size) { return browserBlob_2.slice(offset, offset + size); }, browserBlob_2.size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_29 = _b.sent();
@ -28211,22 +28395,22 @@ var BlockBlobClient = /** @class */ (function (_super) {
});
};
/**
* ONLY AVAILABLE IN BROWSERS.
*
* Uploads a browser {@link Blob} object to block blob. Requires a blobFactory as the data source,
* which need to return a {@link Blob} object with the offset and size provided.
* Uploads data to block blob. Requires a bodyFactory as the data source,
* which need to return a {@link HttpRequestBody} object with the offset and size provided.
*
* When buffer length <= 256MB, this method will use 1 upload call to finish the upload.
* Otherwise, this method will call stageBlock to upload blocks, and finally call commitBlockList
* When data length is no more than the specifiled {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is
* {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload.
* Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList}
* to commit the block list.
*
* @param {(offset: number, size: number) => Blob} blobFactory
* @param {(offset: number, size: number) => HttpRequestBody} bodyFactory
* @param {number} size size of the data to upload.
* @param {BlockBlobParallelUploadOptions} [options] Options to Upload to Block Blob operation.
* @returns {Promise<BlobUploadCommonResponse>} Response data for the Blob Upload operation.
* @memberof BlockBlobClient
*/
BlockBlobClient.prototype.uploadSeekableBlob = function (blobFactory, size, options) {
BlockBlobClient.prototype.uploadSeekableInternal = function (bodyFactory, size, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, numBlocks_1, blockList_1, blockIDPrefix_1, transferProgress_2, batch, _loop_2, i, e_30;
@ -28264,12 +28448,12 @@ var BlockBlobClient = /** @class */ (function (_super) {
if (!options.conditions) {
options.conditions = {};
}
_a = createSpan("BlockBlobClient-UploadSeekableBlob", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions;
_a = createSpan("BlockBlobClient-uploadSeekableInternal", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions;
_b.label = 1;
case 1:
_b.trys.push([1, 5, 6, 7]);
if (!(size <= options.maxSingleShotSize)) return [3 /*break*/, 3];
return [4 /*yield*/, this.upload(blobFactory(0, size), size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
return [4 /*yield*/, this.upload(bodyFactory(0, size), size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
numBlocks_1 = Math.floor((size - 1) / options.blockSize) + 1;
@ -28292,7 +28476,7 @@ var BlockBlobClient = /** @class */ (function (_super) {
end = i === numBlocks_1 - 1 ? size : start + options.blockSize;
contentLength = end - start;
blockList_1.push(blockID);
return [4 /*yield*/, this.stageBlock(blockID, blobFactory(start, contentLength), contentLength, {
return [4 /*yield*/, this.stageBlock(blockID, bodyFactory(start, contentLength), contentLength, {
abortSignal: options.abortSignal,
conditions: options.conditions,
encryptionScope: options.encryptionScope,
@ -28363,12 +28547,14 @@ var BlockBlobClient = /** @class */ (function (_super) {
return [4 /*yield*/, fsStat(filePath)];
case 2:
size = (_b.sent()).size;
return [4 /*yield*/, this.uploadResetableStream(function (offset, count) {
return fsCreateReadStream(filePath, {
autoClose: true,
end: count ? offset + count - 1 : Infinity,
start: offset
});
return [4 /*yield*/, this.uploadSeekableInternal(function (offset, count) {
return function () {
return fsCreateReadStream(filePath, {
autoClose: true,
end: count ? offset + count - 1 : Infinity,
start: offset
});
};
}, size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 3: return [2 /*return*/, _b.sent()];
case 4:
@ -28476,132 +28662,6 @@ var BlockBlobClient = /** @class */ (function (_super) {
});
});
};
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
*
* Accepts a Node.js Readable stream factory, and uploads in blocks to a block blob.
* The Readable stream factory must returns a Node.js Readable stream starting from the offset defined. The offset
* is the offset in the block blob to be uploaded.
*
* When buffer length <= 256MB, this method will use 1 upload call to finish the upload.
* Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList}
* to commit the block list.
*
* @export
* @param {(offset: number) => NodeJS.ReadableStream} streamFactory Returns a Node.js Readable stream starting
* from the offset defined
* @param {number} size Size of the block blob
* @param {BlockBlobParallelUploadOptions} [options] Options to Upload to Block Blob operation.
* @returns {(Promise<BlobUploadCommonResponse>)} Response data for the Blob Upload operation.
* @memberof BlockBlobClient
*/
BlockBlobClient.prototype.uploadResetableStream = function (streamFactory, size, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, numBlocks_2, blockList_3, blockIDPrefix_3, transferProgress_4, batch, _loop_3, i, e_33;
var _this = this;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!options.blockSize) {
options.blockSize = 0;
}
if (options.blockSize < 0 || options.blockSize > BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES) {
throw new RangeError("blockSize option must be >= 0 and <= " + BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES);
}
if (options.maxSingleShotSize !== 0 && !options.maxSingleShotSize) {
options.maxSingleShotSize = BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES;
}
if (options.maxSingleShotSize < 0 ||
options.maxSingleShotSize > BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES) {
throw new RangeError("maxSingleShotSize option must be >= 0 and <= " + BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES);
}
if (options.blockSize === 0) {
if (size > BLOCK_BLOB_MAX_BLOCKS * BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES) {
throw new RangeError(size + " is too larger to upload to a block blob.");
}
if (size > options.maxSingleShotSize) {
options.blockSize = Math.ceil(size / BLOCK_BLOB_MAX_BLOCKS);
if (options.blockSize < DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES) {
options.blockSize = DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES;
}
}
}
if (!options.blobHTTPHeaders) {
options.blobHTTPHeaders = {};
}
if (!options.conditions) {
options.conditions = {};
}
_a = createSpan("BlockBlobClient-uploadResetableStream", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions;
_b.label = 1;
case 1:
_b.trys.push([1, 6, 7, 8]);
if (!(size <= options.maxSingleShotSize)) return [3 /*break*/, 3];
return [4 /*yield*/, this.upload(function () { return streamFactory(0); }, size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
numBlocks_2 = Math.floor((size - 1) / options.blockSize) + 1;
if (numBlocks_2 > BLOCK_BLOB_MAX_BLOCKS) {
throw new RangeError("The buffer's size is too big or the BlockSize is too small;" +
("the number of blocks must be <= " + BLOCK_BLOB_MAX_BLOCKS));
}
blockList_3 = [];
blockIDPrefix_3 = coreHttp.generateUuid();
transferProgress_4 = 0;
batch = new Batch(options.concurrency);
_loop_3 = function (i) {
batch.addOperation(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
var blockID, start, end, contentLength;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0:
blockID = generateBlockID(blockIDPrefix_3, i);
start = options.blockSize * i;
end = i === numBlocks_2 - 1 ? size : start + options.blockSize;
contentLength = end - start;
blockList_3.push(blockID);
return [4 /*yield*/, this.stageBlock(blockID, function () { return streamFactory(start, contentLength); }, contentLength, {
abortSignal: options.abortSignal,
conditions: options.conditions,
encryptionScope: options.encryptionScope,
tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions })
})];
case 1:
_a.sent();
// Update progress after block is successfully uploaded to server, in case of block trying
transferProgress_4 += contentLength;
if (options.onProgress) {
options.onProgress({ loadedBytes: transferProgress_4 });
}
return [2 /*return*/];
}
});
}); });
};
for (i = 0; i < numBlocks_2; i++) {
_loop_3(i);
}
return [4 /*yield*/, batch.do()];
case 4:
_b.sent();
return [4 /*yield*/, this.commitBlockList(blockList_3, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 5: return [2 /*return*/, _b.sent()];
case 6:
e_33 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_33.message
});
throw e_33;
case 7:
span.end();
return [7 /*endfinally*/];
case 8: return [2 /*return*/];
}
});
});
};
return BlockBlobClient;
}(BlobClient));
/**
@ -28700,7 +28760,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_34;
var _b, span, spanOptions, e_33;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -28725,12 +28785,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_34 = _c.sent();
e_33 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_34.message
message: e_33.message
});
throw e_34;
throw e_33;
case 4:
span.end();
return [7 /*endfinally*/];
@ -28754,7 +28814,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a, _b;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _c, span, spanOptions, conditions, res, e_35;
var _c, span, spanOptions, conditions, res, e_34;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -28769,19 +28829,19 @@ var PageBlobClient = /** @class */ (function (_super) {
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
})];
case 3:
e_35 = _d.sent();
if (((_a = e_35.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") {
e_34 = _d.sent();
if (((_a = e_34.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") {
span.setStatus({
code: api.CanonicalCode.ALREADY_EXISTS,
message: "Expected exception when creating a blob only if it does not already exist."
});
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_35.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_35.response })];
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_34.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_34.response })];
}
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_35.message
message: e_34.message
});
throw e_35;
throw e_34;
case 4:
span.end();
return [7 /*endfinally*/];
@ -28805,7 +28865,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_36;
var _b, span, spanOptions, e_35;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -28830,12 +28890,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_36 = _c.sent();
e_35 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_36.message
message: e_35.message
});
throw e_36;
throw e_35;
case 4:
span.end();
return [7 /*endfinally*/];
@ -28861,7 +28921,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_37;
var _b, span, spanOptions, e_36;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -28891,12 +28951,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_37 = _c.sent();
e_36 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_37.message
message: e_36.message
});
throw e_37;
throw e_36;
case 4:
span.end();
return [7 /*endfinally*/];
@ -28920,7 +28980,7 @@ var PageBlobClient = /** @class */ (function (_super) {
if (offset === void 0) { offset = 0; }
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_38;
var _b, span, spanOptions, e_37;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -28941,12 +29001,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_38 = _c.sent();
e_37 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_38.message
message: e_37.message
});
throw e_38;
throw e_37;
case 4:
span.end();
return [7 /*endfinally*/];
@ -28970,7 +29030,7 @@ var PageBlobClient = /** @class */ (function (_super) {
if (offset === void 0) { offset = 0; }
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_39;
var _b, span, spanOptions, e_38;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -28990,12 +29050,12 @@ var PageBlobClient = /** @class */ (function (_super) {
.then(rangeResponseFromModel)];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_39 = _c.sent();
e_38 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_39.message
message: e_38.message
});
throw e_39;
throw e_38;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29019,7 +29079,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_40;
var _b, span, spanOptions, e_39;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -29040,12 +29100,12 @@ var PageBlobClient = /** @class */ (function (_super) {
.then(rangeResponseFromModel)];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_40 = _c.sent();
e_39 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_40.message
message: e_39.message
});
throw e_40;
throw e_39;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29069,7 +29129,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_41;
var _b, span, spanOptions, e_40;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -29090,12 +29150,12 @@ var PageBlobClient = /** @class */ (function (_super) {
.then(rangeResponseFromModel)];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_41 = _c.sent();
e_40 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_41.message
message: e_40.message
});
throw e_41;
throw e_40;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29117,7 +29177,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_42;
var _b, span, spanOptions, e_41;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -29135,12 +29195,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_42 = _c.sent();
e_41 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_42.message
message: e_41.message
});
throw e_42;
throw e_41;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29163,7 +29223,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_43;
var _b, span, spanOptions, e_42;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -29181,12 +29241,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_43 = _c.sent();
e_42 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_43.message
message: e_42.message
});
throw e_43;
throw e_42;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29213,7 +29273,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_44;
var _b, span, spanOptions, e_43;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -29228,12 +29288,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_44 = _c.sent();
e_43 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_44.message
message: e_43.message
});
throw e_44;
throw e_43;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29318,7 +29378,7 @@ var BlobLeaseClient = /** @class */ (function () {
var _a, _b, _c, _d, _e, _f;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _g, span, spanOptions, e_45;
var _g, span, spanOptions, e_44;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
case 0:
@ -29340,12 +29400,12 @@ var BlobLeaseClient = /** @class */ (function () {
})];
case 2: return [2 /*return*/, _h.sent()];
case 3:
e_45 = _h.sent();
e_44 = _h.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_45.message
message: e_44.message
});
throw e_45;
throw e_44;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29369,7 +29429,7 @@ var BlobLeaseClient = /** @class */ (function () {
var _a, _b, _c, _d, _e, _f;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _g, span, spanOptions, response, e_46;
var _g, span, spanOptions, response, e_45;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
case 0:
@ -29392,12 +29452,12 @@ var BlobLeaseClient = /** @class */ (function () {
this._leaseId = proposedLeaseId;
return [2 /*return*/, response];
case 3:
e_46 = _h.sent();
e_45 = _h.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_46.message
message: e_45.message
});
throw e_46;
throw e_45;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29421,7 +29481,7 @@ var BlobLeaseClient = /** @class */ (function () {
var _a, _b, _c, _d, _e, _f;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _g, span, spanOptions, e_47;
var _g, span, spanOptions, e_46;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
case 0:
@ -29441,12 +29501,12 @@ var BlobLeaseClient = /** @class */ (function () {
})];
case 2: return [2 /*return*/, _h.sent()];
case 3:
e_47 = _h.sent();
e_46 = _h.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_47.message
message: e_46.message
});
throw e_47;
throw e_46;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29469,7 +29529,7 @@ var BlobLeaseClient = /** @class */ (function () {
var _a, _b, _c, _d, _e, _f;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _g, span, spanOptions, e_48;
var _g, span, spanOptions, e_47;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
case 0:
@ -29489,12 +29549,12 @@ var BlobLeaseClient = /** @class */ (function () {
})];
case 2: return [2 /*return*/, _h.sent()];
case 3:
e_48 = _h.sent();
e_47 = _h.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_48.message
message: e_47.message
});
throw e_48;
throw e_47;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29520,7 +29580,7 @@ var BlobLeaseClient = /** @class */ (function () {
var _a, _b, _c, _d, _e, _f;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _g, span, spanOptions, operationOptions, e_49;
var _g, span, spanOptions, operationOptions, e_48;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
case 0:
@ -29542,12 +29602,12 @@ var BlobLeaseClient = /** @class */ (function () {
return [4 /*yield*/, this._containerOrBlobOperation.breakLease(operationOptions)];
case 2: return [2 /*return*/, _h.sent()];
case 3:
e_49 = _h.sent();
e_48 = _h.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_49.message
message: e_48.message
});
throw e_49;
throw e_48;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29652,7 +29712,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.create = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_50;
var _a, span, spanOptions, e_49;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -29666,12 +29726,12 @@ var ContainerClient = /** @class */ (function (_super) {
// this will filter out unwanted properties from the response object into result object
return [2 /*return*/, _b.sent()];
case 3:
e_50 = _b.sent();
e_49 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_50.message
message: e_49.message
});
throw e_50;
throw e_49;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29693,7 +29753,7 @@ var ContainerClient = /** @class */ (function (_super) {
var _a, _b;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _c, span, spanOptions, res, e_51;
var _c, span, spanOptions, res, e_50;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -29707,19 +29767,19 @@ var ContainerClient = /** @class */ (function (_super) {
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
})];
case 3:
e_51 = _d.sent();
if (((_a = e_51.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") {
e_50 = _d.sent();
if (((_a = e_50.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") {
span.setStatus({
code: api.CanonicalCode.ALREADY_EXISTS,
message: "Expected exception when creating a container only if it does not already exist."
});
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_51.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_51.response })];
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_50.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_50.response })];
}
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_51.message
message: e_50.message
});
throw e_51;
throw e_50;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29742,7 +29802,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.exists = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_52;
var _a, span, spanOptions, e_51;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -29758,8 +29818,8 @@ var ContainerClient = /** @class */ (function (_super) {
_b.sent();
return [2 /*return*/, true];
case 3:
e_52 = _b.sent();
if (e_52.statusCode === 404) {
e_51 = _b.sent();
if (e_51.statusCode === 404) {
span.setStatus({
code: api.CanonicalCode.NOT_FOUND,
message: "Expected exception when checking container existence"
@ -29768,9 +29828,9 @@ var ContainerClient = /** @class */ (function (_super) {
}
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_52.message
message: e_51.message
});
throw e_52;
throw e_51;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29845,7 +29905,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.getProperties = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_53;
var _a, span, spanOptions, e_52;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -29859,12 +29919,12 @@ var ContainerClient = /** @class */ (function (_super) {
return [4 /*yield*/, this.containerContext.getProperties(tslib.__assign(tslib.__assign({ abortSignal: options.abortSignal }, options.conditions), { spanOptions: spanOptions }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_53 = _b.sent();
e_52 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_53.message
message: e_52.message
});
throw e_53;
throw e_52;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29885,7 +29945,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.delete = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_54;
var _a, span, spanOptions, e_53;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -29904,12 +29964,12 @@ var ContainerClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_54 = _b.sent();
e_53 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_54.message
message: e_53.message
});
throw e_54;
throw e_53;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29931,7 +29991,7 @@ var ContainerClient = /** @class */ (function (_super) {
var _a, _b;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _c, span, spanOptions, res, e_55;
var _c, span, spanOptions, res, e_54;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -29945,19 +30005,19 @@ var ContainerClient = /** @class */ (function (_super) {
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
})];
case 3:
e_55 = _d.sent();
if (((_a = e_55.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") {
e_54 = _d.sent();
if (((_a = e_54.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") {
span.setStatus({
code: api.CanonicalCode.NOT_FOUND,
message: "Expected exception when deleting a container only if it exists."
});
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_55.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_55.response })];
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_54.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_54.response })];
}
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_55.message
message: e_54.message
});
throw e_55;
throw e_54;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29983,7 +30043,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.setMetadata = function (metadata, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_56;
var _a, span, spanOptions, e_55;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30006,12 +30066,12 @@ var ContainerClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_56 = _b.sent();
e_55 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_56.message
message: e_55.message
});
throw e_56;
throw e_55;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30036,7 +30096,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.getAccessPolicy = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, response, res, _i, response_1, identifier, accessPolicy, e_57;
var _a, span, spanOptions, response, res, _i, response_1, identifier, accessPolicy, e_56;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30087,12 +30147,12 @@ var ContainerClient = /** @class */ (function (_super) {
}
return [2 /*return*/, res];
case 3:
e_57 = _b.sent();
e_56 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_57.message
message: e_56.message
});
throw e_57;
throw e_56;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30123,7 +30183,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.setAccessPolicy = function (access, containerAcl, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, acl, _i, _b, identifier, e_58;
var _a, span, spanOptions, acl, _i, _b, identifier, e_57;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -30158,12 +30218,12 @@ var ContainerClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_58 = _c.sent();
e_57 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_58.message
message: e_57.message
});
throw e_58;
throw e_57;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30208,7 +30268,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.uploadBlockBlob = function (blobName, body, contentLength, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, blockBlobClient, response, e_59;
var _a, span, spanOptions, blockBlobClient, response, e_58;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30225,12 +30285,12 @@ var ContainerClient = /** @class */ (function (_super) {
response: response
}];
case 3:
e_59 = _b.sent();
e_58 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_59.message
message: e_58.message
});
throw e_59;
throw e_58;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30254,7 +30314,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.deleteBlob = function (blobName, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, blobClient, e_60;
var _a, span, spanOptions, blobClient, e_59;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30269,12 +30329,12 @@ var ContainerClient = /** @class */ (function (_super) {
return [4 /*yield*/, blobClient.delete(tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_60 = _b.sent();
e_59 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_60.message
message: e_59.message
});
throw e_60;
throw e_59;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30298,7 +30358,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.listBlobFlatSegment = function (marker, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, response, wrappedResponse, e_61;
var _a, span, spanOptions, response, wrappedResponse, e_60;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30315,12 +30375,12 @@ var ContainerClient = /** @class */ (function (_super) {
}) }) });
return [2 /*return*/, wrappedResponse];
case 3:
e_61 = _b.sent();
e_60 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_61.message
message: e_60.message
});
throw e_61;
throw e_60;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30345,7 +30405,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.listBlobHierarchySegment = function (delimiter, marker, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, response, wrappedResponse, e_62;
var _a, span, spanOptions, response, wrappedResponse, e_61;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30362,12 +30422,12 @@ var ContainerClient = /** @class */ (function (_super) {
}) }) });
return [2 /*return*/, wrappedResponse];
case 3:
e_62 = _b.sent();
e_61 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_62.message
message: e_61.message
});
throw e_62;
throw e_61;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30429,8 +30489,8 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.listItems = function (options) {
if (options === void 0) { options = {}; }
return tslib.__asyncGenerator(this, arguments, function listItems_1() {
var marker, _a, _b, listBlobsFlatSegmentResponse, e_63_1;
var e_63, _c;
var marker, _a, _b, listBlobsFlatSegmentResponse, e_62_1;
var e_62, _c;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -30449,8 +30509,8 @@ var ContainerClient = /** @class */ (function (_super) {
case 5: return [3 /*break*/, 1];
case 6: return [3 /*break*/, 13];
case 7:
e_63_1 = _d.sent();
e_63 = { error: e_63_1 };
e_62_1 = _d.sent();
e_62 = { error: e_62_1 };
return [3 /*break*/, 13];
case 8:
_d.trys.push([8, , 11, 12]);
@ -30461,7 +30521,7 @@ var ContainerClient = /** @class */ (function (_super) {
_d.label = 10;
case 10: return [3 /*break*/, 12];
case 11:
if (e_63) throw e_63.error;
if (e_62) throw e_62.error;
return [7 /*endfinally*/];
case 12: return [7 /*endfinally*/];
case 13: return [2 /*return*/];
@ -30650,8 +30710,8 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.listItemsByHierarchy = function (delimiter, options) {
if (options === void 0) { options = {}; }
return tslib.__asyncGenerator(this, arguments, function listItemsByHierarchy_1() {
var marker, _a, _b, listBlobsHierarchySegmentResponse, segment, _i, _c, prefix, _d, _e, blob, e_64_1;
var e_64, _f;
var marker, _a, _b, listBlobsHierarchySegmentResponse, segment, _i, _c, prefix, _d, _e, blob, e_63_1;
var e_63, _f;
return tslib.__generator(this, function (_g) {
switch (_g.label) {
case 0:
@ -30694,8 +30754,8 @@ var ContainerClient = /** @class */ (function (_super) {
case 12: return [3 /*break*/, 1];
case 13: return [3 /*break*/, 20];
case 14:
e_64_1 = _g.sent();
e_64 = { error: e_64_1 };
e_63_1 = _g.sent();
e_63 = { error: e_63_1 };
return [3 /*break*/, 20];
case 15:
_g.trys.push([15, , 18, 19]);
@ -30706,7 +30766,7 @@ var ContainerClient = /** @class */ (function (_super) {
_g.label = 17;
case 17: return [3 /*break*/, 19];
case 18:
if (e_64) throw e_64.error;
if (e_63) throw e_63.error;
return [7 /*endfinally*/];
case 19: return [7 /*endfinally*/];
case 20: return [2 /*return*/];
@ -31813,6 +31873,48 @@ var BlobServiceClient = /** @class */ (function (_super) {
});
});
};
/**
* Restore a previously deleted Blob container.
* This API is only functional if Container Soft Delete is enabled for the storage account associated with the container.
*
* @param {string} deletedContainerName Name of the previously deleted container.
* @param {string} deletedContainerVersion Version of the previously deleted container, used to uniquely identify the deleted container.
* @returns {Promise<ContainerUndeleteResponse>} Container deletion response.
* @memberof BlobServiceClient
*/
BlobServiceClient.prototype.undeleteContainer = function (deletedContainerName, deletedContainerVersion, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, containerClient, containerContext, containerUndeleteResponse, e_3;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = createSpan("BlobServiceClient-undeleteContainer", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions;
_b.label = 1;
case 1:
_b.trys.push([1, 3, 4, 5]);
containerClient = this.getContainerClient(options.destinationContainerName || deletedContainerName);
containerContext = new Container(containerClient["storageClientContext"]);
return [4 /*yield*/, containerContext.restore(tslib.__assign(tslib.__assign({ deletedContainerName: deletedContainerName,
deletedContainerVersion: deletedContainerVersion }, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 2:
containerUndeleteResponse = _b.sent();
return [2 /*return*/, { containerClient: containerClient, containerUndeleteResponse: containerUndeleteResponse }];
case 3:
e_3 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_3.message
});
throw e_3;
case 4:
span.end();
return [7 /*endfinally*/];
case 5: return [2 /*return*/];
}
});
});
};
/**
* Gets the properties of a storage accounts Blob service, including properties
* for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
@ -31825,7 +31927,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.getProperties = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_3;
var _a, span, spanOptions, e_4;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -31839,12 +31941,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_3 = _b.sent();
e_4 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_3.message
message: e_4.message
});
throw e_3;
throw e_4;
case 4:
span.end();
return [7 /*endfinally*/];
@ -31866,7 +31968,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.setProperties = function (properties, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_4;
var _a, span, spanOptions, e_5;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -31880,12 +31982,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_4 = _b.sent();
e_5 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_4.message
message: e_5.message
});
throw e_4;
throw e_5;
case 4:
span.end();
return [7 /*endfinally*/];
@ -31907,7 +32009,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.getStatistics = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_5;
var _a, span, spanOptions, e_6;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -31921,12 +32023,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_5 = _b.sent();
e_6 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_5.message
message: e_6.message
});
throw e_5;
throw e_6;
case 4:
span.end();
return [7 /*endfinally*/];
@ -31949,7 +32051,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.getAccountInfo = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_6;
var _a, span, spanOptions, e_7;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -31963,12 +32065,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_6 = _b.sent();
e_7 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_6.message
message: e_7.message
});
throw e_6;
throw e_7;
case 4:
span.end();
return [7 /*endfinally*/];
@ -31983,9 +32085,9 @@ var BlobServiceClient = /** @class */ (function (_super) {
*
* @param {string} [marker] A string value that identifies the portion of
* the list of containers to be returned with the next listing operation. The
* operation returns the NextMarker value within the response body if the
* operation returns the continuationToken value within the response body if the
* listing operation did not return all containers remaining to be listed
* with the current page. The NextMarker value can be used as the value for
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param {ServiceListContainersSegmentOptions} [options] Options to the Service List Container Segment operation.
@ -31995,7 +32097,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.listContainersSegment = function (marker, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_7;
var _a, span, spanOptions, e_8;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -32006,12 +32108,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
return [4 /*yield*/, this.serviceContext.listContainersSegment(tslib.__assign(tslib.__assign({ abortSignal: options.abortSignal, marker: marker }, options), { include: typeof options.include === "string" ? [options.include] : options.include, spanOptions: spanOptions }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_7 = _b.sent();
e_8 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_7.message
message: e_8.message
});
throw e_7;
throw e_8;
case 4:
span.end();
return [7 /*endfinally*/];
@ -32032,9 +32134,9 @@ var BlobServiceClient = /** @class */ (function (_super) {
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param {string} [marker] A string value that identifies the portion of
* the list of blobs to be returned with the next listing operation. The
* operation returns the NextMarker value within the response body if the
* operation returns the continuationToken value within the response body if the
* listing operation did not return all blobs remaining to be listed
* with the current page. The NextMarker value can be used as the value for
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param {ServiceFindBlobsByTagsSegmentOptions} [options={}] Options to find blobs by tags.
@ -32044,7 +32146,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.findBlobsByTagsSegment = function (tagFilterSqlExpression, marker, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_8;
var _a, span, spanOptions, e_9;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -32061,12 +32163,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_8 = _b.sent();
e_9 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_8.message
message: e_9.message
});
throw e_8;
throw e_9;
case 4:
span.end();
return [7 /*endfinally*/];
@ -32085,9 +32187,9 @@ var BlobServiceClient = /** @class */ (function (_super) {
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param {string} [marker] A string value that identifies the portion of
* the list of blobs to be returned with the next listing operation. The
* operation returns the NextMarker value within the response body if the
* operation returns the continuationToken value within the response body if the
* listing operation did not return all blobs remaining to be listed
* with the current page. The NextMarker value can be used as the value for
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param {ServiceFindBlobsByTagsSegmentOptions} [options={}] Options to find blobs by tags.
@ -32136,8 +32238,8 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.findBlobsByTagsItems = function (tagFilterSqlExpression, options) {
if (options === void 0) { options = {}; }
return tslib.__asyncGenerator(this, arguments, function findBlobsByTagsItems_1() {
var marker, _a, _b, segment, e_9_1;
var e_9, _c;
var marker, _a, _b, segment, e_10_1;
var e_10, _c;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -32156,8 +32258,8 @@ var BlobServiceClient = /** @class */ (function (_super) {
case 5: return [3 /*break*/, 1];
case 6: return [3 /*break*/, 13];
case 7:
e_9_1 = _d.sent();
e_9 = { error: e_9_1 };
e_10_1 = _d.sent();
e_10 = { error: e_10_1 };
return [3 /*break*/, 13];
case 8:
_d.trys.push([8, , 11, 12]);
@ -32168,7 +32270,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
_d.label = 10;
case 10: return [3 /*break*/, 12];
case 11:
if (e_9) throw e_9.error;
if (e_10) throw e_10.error;
return [7 /*endfinally*/];
case 12: return [7 /*endfinally*/];
case 13: return [2 /*return*/];
@ -32293,9 +32395,9 @@ var BlobServiceClient = /** @class */ (function (_super) {
* @private
* @param {string} [marker] A string value that identifies the portion of
* the list of containers to be returned with the next listing operation. The
* operation returns the NextMarker value within the response body if the
* operation returns the continuationToken value within the response body if the
* listing operation did not return all containers remaining to be listed
* with the current page. The NextMarker value can be used as the value for
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param {ServiceListContainersSegmentOptions} [options] Options to list containers operation.
@ -32342,8 +32444,8 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.listItems = function (options) {
if (options === void 0) { options = {}; }
return tslib.__asyncGenerator(this, arguments, function listItems_1() {
var marker, _a, _b, segment, e_10_1;
var e_10, _c;
var marker, _a, _b, segment, e_11_1;
var e_11, _c;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -32362,8 +32464,8 @@ var BlobServiceClient = /** @class */ (function (_super) {
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 };
e_11_1 = _d.sent();
e_11 = { error: e_11_1 };
return [3 /*break*/, 13];
case 8:
_d.trys.push([8, , 11, 12]);
@ -32374,7 +32476,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
_d.label = 10;
case 10: return [3 /*break*/, 12];
case 11:
if (e_10) throw e_10.error;
if (e_11) throw e_11.error;
return [7 /*endfinally*/];
case 12: return [7 /*endfinally*/];
case 13: return [2 /*return*/];
@ -32464,8 +32566,15 @@ var BlobServiceClient = /** @class */ (function (_super) {
if (options.prefix === "") {
options.prefix = undefined;
}
var include = [];
if (options.includeDeleted) {
include.push("deleted");
}
if (options.includeMetadata) {
include.push("metadata");
}
// AsyncIterableIterator to iterate over containers
var listSegmentOptions = tslib.__assign(tslib.__assign({}, options), (options.includeMetadata ? { include: "metadata" } : {}));
var listSegmentOptions = tslib.__assign(tslib.__assign({}, options), (include.length > 0 ? { include: include } : {}));
var iter = this.listItems(listSegmentOptions);
return _a = {
/**
@ -32506,7 +32615,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.getUserDelegationKey = function (startsOn, expiresOn, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, response, userDelegationKey, res, e_11;
var _a, span, spanOptions, response, userDelegationKey, res, e_12;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -32535,12 +32644,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
res = tslib.__assign({ _response: response._response, requestId: response.requestId, clientRequestId: response.clientRequestId, version: response.version, date: response.date, errorCode: response.errorCode }, userDelegationKey);
return [2 /*return*/, res];
case 3:
e_11 = _b.sent();
e_12 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_11.message
message: e_12.message
});
throw e_11;
throw e_12;
case 4:
span.end();
return [7 /*endfinally*/];
@ -32996,52 +33105,61 @@ function ipRangeToString(ipRange) {
* @class SASQueryParameters
*/
var SASQueryParameters = /** @class */ (function () {
/**
* Creates an instance of SASQueryParameters.
*
* @param {string} version Representing the storage version
* @param {string} signature Representing the signature for the SAS token
* @param {string} [permissions] Representing the storage permissions
* @param {string} [services] Representing the storage services being accessed (only for Account SAS)
* @param {string} [resourceTypes] Representing the storage resource types being accessed (only for Account SAS)
* @param {SASProtocol} [protocol] Representing the allowed HTTP protocol(s)
* @param {Date} [startsOn] Representing the start time for this SAS token
* @param {Date} [expiresOn] Representing the expiry time for this SAS token
* @param {SasIPRange} [ipRange] Representing the range of valid IP addresses for this SAS token
* @param {string} [identifier] Representing the signed identifier (only for Service SAS)
* @param {string} [resource] Representing the storage container or blob (only for Service SAS)
* @param {string} [cacheControl] Representing the cache-control header (only for Blob/File Service SAS)
* @param {string} [contentDisposition] Representing the content-disposition header (only for Blob/File Service SAS)
* @param {string} [contentEncoding] Representing the content-encoding header (only for Blob/File Service SAS)
* @param {string} [contentLanguage] Representing the content-language header (only for Blob/File Service SAS)
* @param {string} [contentType] Representing the content-type header (only for Blob/File Service SAS)
* @param {userDelegationKey} [userDelegationKey] Representing the user delegation key properties
* @memberof SASQueryParameters
*/
function SASQueryParameters(version, signature, permissions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey) {
function SASQueryParameters(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, preauthorizedAgentObjectId, correlationId) {
this.version = version;
this.services = services;
this.resourceTypes = resourceTypes;
this.expiresOn = expiresOn;
this.permissions = permissions;
this.protocol = protocol;
this.startsOn = startsOn;
this.ipRangeInner = ipRange;
this.identifier = identifier;
this.resource = resource;
this.signature = signature;
this.cacheControl = cacheControl;
this.contentDisposition = contentDisposition;
this.contentEncoding = contentEncoding;
this.contentLanguage = contentLanguage;
this.contentType = contentType;
if (userDelegationKey) {
this.signedOid = userDelegationKey.signedObjectId;
this.signedTenantId = userDelegationKey.signedTenantId;
this.signedStartsOn = userDelegationKey.signedStartsOn;
this.signedExpiresOn = userDelegationKey.signedExpiresOn;
this.signedService = userDelegationKey.signedService;
this.signedVersion = userDelegationKey.signedVersion;
if (permissionsOrOptions !== undefined && typeof permissionsOrOptions !== "string") {
// SASQueryParametersOptions
this.permissions = permissionsOrOptions.permissions;
this.services = permissionsOrOptions.services;
this.resourceTypes = permissionsOrOptions.resourceTypes;
this.protocol = permissionsOrOptions.protocol;
this.startsOn = permissionsOrOptions.startsOn;
this.expiresOn = permissionsOrOptions.expiresOn;
this.ipRangeInner = permissionsOrOptions.ipRange;
this.identifier = permissionsOrOptions.identifier;
this.resource = permissionsOrOptions.resource;
this.cacheControl = permissionsOrOptions.cacheControl;
this.contentDisposition = permissionsOrOptions.contentDisposition;
this.contentEncoding = permissionsOrOptions.contentEncoding;
this.contentLanguage = permissionsOrOptions.contentLanguage;
this.contentType = permissionsOrOptions.contentType;
if (permissionsOrOptions.userDelegationKey) {
this.signedOid = permissionsOrOptions.userDelegationKey.signedObjectId;
this.signedTenantId = permissionsOrOptions.userDelegationKey.signedTenantId;
this.signedStartsOn = permissionsOrOptions.userDelegationKey.signedStartsOn;
this.signedExpiresOn = permissionsOrOptions.userDelegationKey.signedExpiresOn;
this.signedService = permissionsOrOptions.userDelegationKey.signedService;
this.signedVersion = permissionsOrOptions.userDelegationKey.signedVersion;
this.preauthorizedAgentObjectId = permissionsOrOptions.preauthorizedAgentObjectId;
this.correlationId = permissionsOrOptions.correlationId;
}
}
else {
this.services = services;
this.resourceTypes = resourceTypes;
this.expiresOn = expiresOn;
this.permissions = permissionsOrOptions;
this.protocol = protocol;
this.startsOn = startsOn;
this.ipRangeInner = ipRange;
this.identifier = identifier;
this.resource = resource;
this.cacheControl = cacheControl;
this.contentDisposition = contentDisposition;
this.contentEncoding = contentEncoding;
this.contentLanguage = contentLanguage;
this.contentType = contentType;
if (userDelegationKey) {
this.signedOid = userDelegationKey.signedObjectId;
this.signedTenantId = userDelegationKey.signedTenantId;
this.signedStartsOn = userDelegationKey.signedStartsOn;
this.signedExpiresOn = userDelegationKey.signedExpiresOn;
this.signedService = userDelegationKey.signedService;
this.signedVersion = userDelegationKey.signedVersion;
this.preauthorizedAgentObjectId = preauthorizedAgentObjectId;
this.correlationId = correlationId;
}
}
}
Object.defineProperty(SASQueryParameters.prototype, "ipRange", {
@ -33093,7 +33211,9 @@ var SASQueryParameters = /** @class */ (function () {
"rscd",
"rsce",
"rscl",
"rsct"
"rsct",
"saoid",
"scid"
];
var queries = [];
for (var _i = 0, params_1 = params; _i < params_1.length; _i++) {
@ -33165,6 +33285,12 @@ var SASQueryParameters = /** @class */ (function () {
case "rsct":
this.tryAppendQueryParameter(queries, param, this.contentType);
break;
case "saoid":
this.tryAppendQueryParameter(queries, param, this.preauthorizedAgentObjectId);
break;
case "scid":
this.tryAppendQueryParameter(queries, param, this.correlationId);
break;
}
}
return queries.join("&");
@ -33311,6 +33437,20 @@ var BlobSASPermissions = /** @class */ (function () {
* @memberof BlobSASPermissions
*/
this.tag = false;
/**
* Specifies Move access granted.
*
* @type {boolean}
* @memberof BlobSASPermissions
*/
this.move = false;
/**
* Specifies Execute access granted.
*
* @type {boolean}
* @memberof BlobSASPermissions
*/
this.execute = false;
}
/**
* Creates a {@link BlobSASPermissions} from the specified permissions string. This method will throw an
@ -33347,6 +33487,12 @@ var BlobSASPermissions = /** @class */ (function () {
case "t":
blobSASPermissions.tag = true;
break;
case "m":
blobSASPermissions.move = true;
break;
case "e":
blobSASPermissions.execute = true;
break;
default:
throw new RangeError("Invalid permission: " + char);
}
@ -33383,6 +33529,12 @@ var BlobSASPermissions = /** @class */ (function () {
if (this.tag) {
permissions.push("t");
}
if (this.move) {
permissions.push("m");
}
if (this.execute) {
permissions.push("e");
}
return permissions.join("");
};
return BlobSASPermissions;
@ -33458,6 +33610,20 @@ var ContainerSASPermissions = /** @class */ (function () {
* @memberof ContainerSASPermissions
*/
this.tag = false;
/**
* Specifies Move access granted.
*
* @type {boolean}
* @memberof ContainerSASPermissions
*/
this.move = false;
/**
* Specifies Execute access granted.
*
* @type {boolean}
* @memberof ContainerSASPermissions
*/
this.execute = false;
}
/**
* Creates an {@link ContainerSASPermissions} from the specified permissions string. This method will throw an
@ -33497,6 +33663,12 @@ var ContainerSASPermissions = /** @class */ (function () {
case "x":
containerSASPermissions.deleteVersion = true;
break;
case "m":
containerSASPermissions.move = true;
break;
case "e":
containerSASPermissions.execute = true;
break;
default:
throw new RangeError("Invalid permission " + char);
}
@ -33539,6 +33711,12 @@ var ContainerSASPermissions = /** @class */ (function () {
if (this.tag) {
permissions.push("t");
}
if (this.move) {
permissions.push("m");
}
if (this.execute) {
permissions.push("e");
}
return permissions.join("");
};
return ContainerSASPermissions;
@ -33602,7 +33780,13 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent
return generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential);
}
else {
return generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential);
// Version 2020-02-10 delegation SAS signature construction includes preauthorizedAgentObjectId, agentObjectId, correlationId.
if (version >= "2020-02-10") {
return generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential);
}
else {
return generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential);
}
}
}
if (version >= "2015-04-05") {
@ -33633,34 +33817,18 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent
* @returns {SASQueryParameters}
*/
function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
if (!blobSASSignatureValues.identifier &&
!blobSASSignatureValues.permissions &&
!blobSASSignatureValues.expiresOn) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided.");
}
var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION;
var resource = "c";
var verifiedPermissions;
if (blobSASSignatureValues.snapshotTime) {
throw RangeError("'version' must be >= '2018-11-09' when provided 'snapshotTime'.");
}
if (blobSASSignatureValues.versionId) {
throw RangeError("'version' must be >= '2019-10-10' when provided 'versionId'.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.deleteVersion &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission.");
}
if (blobSASSignatureValues.blobName) {
resource = "b";
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
var verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
@ -33682,7 +33850,7 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe
blobSASSignatureValues.identifier,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
version,
blobSASSignatureValues.version,
blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "",
blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "",
blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "",
@ -33690,7 +33858,7 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : ""
].join("\n");
var signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
@ -33710,33 +33878,13 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe
* @returns {SASQueryParameters}
*/
function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
if (!blobSASSignatureValues.identifier &&
!blobSASSignatureValues.permissions &&
!blobSASSignatureValues.expiresOn) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided.");
}
var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION;
var resource = "c";
var verifiedPermissions;
if (blobSASSignatureValues.versionId && version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'versionId'.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.deleteVersion &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission.");
}
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) {
throw RangeError("Must provide 'blobName' when provided 'snapshotTime'.");
}
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) {
throw RangeError("Must provide 'blobName' when provided 'versionId'.");
}
var timestamp = blobSASSignatureValues.snapshotTime;
if (blobSASSignatureValues.blobName) {
resource = "b";
@ -33749,6 +33897,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
}
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
var verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
@ -33770,7 +33919,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
blobSASSignatureValues.identifier,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
version,
blobSASSignatureValues.version,
resource,
timestamp,
blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "",
@ -33780,7 +33929,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : ""
].join("\n");
var signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
@ -33789,7 +33938,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
* Creates an instance of SASQueryParameters.
*
* Only accepts required settings needed to create a SAS. For optional settings please
* set corresponding properties directly, such as permissions, startsOn and identifier.
* set corresponding properties directly, such as permissions, startsOn.
*
* WARNING: identifier will be ignored, permissions and expiresOn are required.
*
@ -33798,31 +33947,12 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
* @returns {SASQueryParameters}
*/
function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
// Stored access policies are not supported for a user delegation SAS.
if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS.");
}
var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION;
if (blobSASSignatureValues.versionId && version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'versionId'.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.deleteVersion &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission.");
}
var resource = "c";
var verifiedPermissions;
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) {
throw RangeError("Must provide 'blobName' when provided 'snapshotTime'.");
}
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) {
throw RangeError("Must provide 'blobName' when provided 'versionId'.");
}
var timestamp = blobSASSignatureValues.snapshotTime;
if (blobSASSignatureValues.blobName) {
resource = "b";
@ -33835,6 +33965,7 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD
}
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
var verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
@ -33865,7 +33996,7 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD
userDelegationKeyCredential.userDelegationKey.signedVersion,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
version,
blobSASSignatureValues.version,
resource,
timestamp,
blobSASSignatureValues.cacheControl,
@ -33875,7 +34006,87 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD
blobSASSignatureValues.contentType
].join("\n");
var signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
* IMPLEMENTATION FOR API VERSION FROM 2020-02-10.
*
* Creates an instance of SASQueryParameters.
*
* Only accepts required settings needed to create a SAS. For optional settings please
* set corresponding properties directly, such as permissions, startsOn.
*
* WARNING: identifier will be ignored, permissions and expiresOn are required.
*
* @param {BlobSASSignatureValues} blobSASSignatureValues
* @param {UserDelegationKeyCredential} userDelegationKeyCredential
* @returns {SASQueryParameters}
*/
function generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
// Stored access policies are not supported for a user delegation SAS.
if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS.");
}
var resource = "c";
var timestamp = blobSASSignatureValues.snapshotTime;
if (blobSASSignatureValues.blobName) {
resource = "b";
if (blobSASSignatureValues.snapshotTime) {
resource = "bs";
}
else if (blobSASSignatureValues.versionId) {
resource = "bv";
timestamp = blobSASSignatureValues.versionId;
}
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
var verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
else {
verifiedPermissions = ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
}
// Signature is generated on the un-url-encoded values.
var stringToSign = [
verifiedPermissions ? verifiedPermissions : "",
blobSASSignatureValues.startsOn
? truncatedISO8061Date(blobSASSignatureValues.startsOn, false)
: "",
blobSASSignatureValues.expiresOn
? truncatedISO8061Date(blobSASSignatureValues.expiresOn, false)
: "",
getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName),
userDelegationKeyCredential.userDelegationKey.signedObjectId,
userDelegationKeyCredential.userDelegationKey.signedTenantId,
userDelegationKeyCredential.userDelegationKey.signedStartsOn
? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false)
: "",
userDelegationKeyCredential.userDelegationKey.signedExpiresOn
? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false)
: "",
userDelegationKeyCredential.userDelegationKey.signedService,
userDelegationKeyCredential.userDelegationKey.signedVersion,
blobSASSignatureValues.preauthorizedAgentObjectId,
undefined,
blobSASSignatureValues.correlationId,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
blobSASSignatureValues.version,
resource,
timestamp,
blobSASSignatureValues.cacheControl,
blobSASSignatureValues.contentDisposition,
blobSASSignatureValues.contentEncoding,
blobSASSignatureValues.contentLanguage,
blobSASSignatureValues.contentType
].join("\n");
var signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId);
}
function getCanonicalName(accountName, containerName, blobName) {
// Container: "/blob/account/containerName"
@ -33886,6 +34097,42 @@ function getCanonicalName(accountName, containerName, blobName) {
}
return elements.join("");
}
function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) {
var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION;
if (blobSASSignatureValues.snapshotTime && version < "2018-11-09") {
throw RangeError("'version' must be >= '2018-11-09' when providing 'snapshotTime'.");
}
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) {
throw RangeError("Must provide 'blobName' when providing 'snapshotTime'.");
}
if (blobSASSignatureValues.versionId && version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when providing 'versionId'.");
}
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) {
throw RangeError("Must provide 'blobName' when providing 'versionId'.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.deleteVersion &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when providing 'x' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
throw RangeError("'version' must be >= '2019-12-12' when providing 't' permission.");
}
if (version < "2020-02-10" &&
blobSASSignatureValues.permissions &&
(blobSASSignatureValues.permissions.move || blobSASSignatureValues.permissions.execute)) {
throw RangeError("'version' must be >= '2020-02-10' when providing the 'm' or 'e' permission.");
}
if (version < "2020-02-10" &&
(blobSASSignatureValues.preauthorizedAgentObjectId || blobSASSignatureValues.correlationId)) {
throw RangeError("'version' must be >= '2020-02-10' when providing 'preauthorizedAgentObjectId' or 'correlationId'.");
}
blobSASSignatureValues.version = version;
return blobSASSignatureValues;
}
Object.defineProperty(exports, 'BaseRequestPolicy', {
enumerable: true,
@ -33972,10 +34219,20 @@ exports.newPipeline = newPipeline;
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert = __webpack_require__(357);
const path = __webpack_require__(622);
const pathHelper = __webpack_require__(972);
const path = __importStar(__webpack_require__(622));
const pathHelper = __importStar(__webpack_require__(972));
const assert_1 = __importDefault(__webpack_require__(357));
const IS_WINDOWS = process.platform === 'win32';
/**
* Helper class for parsing paths into segments
@ -33989,7 +34246,7 @@ class Path {
this.segments = [];
// String
if (typeof itemPath === 'string') {
assert(itemPath, `Parameter 'itemPath' must not be empty`);
assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`);
// Normalize slashes and trim unnecessary trailing slash
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
// Not rooted
@ -34016,24 +34273,24 @@ class Path {
// Array
else {
// Must not be empty
assert(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
// Each segment
for (let i = 0; i < itemPath.length; i++) {
let segment = itemPath[i];
// Must not be empty
assert(segment, `Parameter 'itemPath' must not contain any empty segments`);
assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`);
// Normalize slashes
segment = pathHelper.normalizeSeparators(itemPath[i]);
// Root segment
if (i === 0 && pathHelper.hasRoot(segment)) {
segment = pathHelper.safeTrimTrailingSeparator(segment);
assert(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
this.segments.push(segment);
}
// All other segments
else {
// Must not contain slash
assert(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
this.segments.push(segment);
}
}
@ -41207,8 +41464,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const pathHelper = __webpack_require__(972);
const pathHelper = __importStar(__webpack_require__(972));
const internal_match_kind_1 = __webpack_require__(327);
const IS_WINDOWS = process.platform === 'win32';
/**
@ -41290,8 +41554,15 @@ exports.partialMatch = partialMatch;
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __webpack_require__(470);
const core = __importStar(__webpack_require__(470));
/**
* Returns a copy with defaults filled in.
*/
@ -49623,17 +49894,27 @@ __exportStar(__webpack_require__(764), exports);
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert = __webpack_require__(357);
const os = __webpack_require__(87);
const path = __webpack_require__(622);
const pathHelper = __webpack_require__(972);
const os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622));
const pathHelper = __importStar(__webpack_require__(972));
const assert_1 = __importDefault(__webpack_require__(357));
const minimatch_1 = __webpack_require__(93);
const internal_match_kind_1 = __webpack_require__(327);
const internal_path_1 = __webpack_require__(383);
const IS_WINDOWS = process.platform === 'win32';
class Pattern {
constructor(patternOrNegate, segments) {
constructor(patternOrNegate, segments, homedir) {
/**
* Indicates whether matches should be excluded from the result set
*/
@ -49647,9 +49928,9 @@ class Pattern {
else {
// Convert to pattern
segments = segments || [];
assert(segments.length, `Parameter 'segments' must not empty`);
assert_1.default(segments.length, `Parameter 'segments' must not empty`);
const root = Pattern.getLiteral(segments[0]);
assert(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
pattern = new internal_path_1.Path(segments).toString().trim();
if (patternOrNegate) {
pattern = `!${pattern}`;
@ -49661,7 +49942,7 @@ class Pattern {
pattern = pattern.substr(1).trim();
}
// Normalize slashes and ensures absolute root
pattern = Pattern.fixupPattern(pattern);
pattern = Pattern.fixupPattern(pattern, homedir);
// Segments
this.segments = new internal_path_1.Path(pattern).segments;
// Trailing slash indicates the pattern should only match directories, not regular files
@ -49698,11 +49979,11 @@ class Pattern {
// Normalize slashes
itemPath = pathHelper.normalizeSeparators(itemPath);
// Append a trailing slash. Otherwise Minimatch will not match the directory immediately
// preceeding the globstar. For example, given the pattern `/foo/**`, Minimatch returns
// preceding the globstar. For example, given the pattern `/foo/**`, Minimatch returns
// false for `/foo` but returns true for `/foo/`. Append a trailing slash to handle that quirk.
if (!itemPath.endsWith(path.sep)) {
// Note, this is safe because the constructor ensures the pattern has an absolute root.
// For example, formats like C: and C:foo on Windows are resolved to an aboslute root.
// For example, formats like C: and C:foo on Windows are resolved to an absolute root.
itemPath = `${itemPath}${path.sep}`;
}
}
@ -49740,15 +50021,15 @@ class Pattern {
/**
* Normalizes slashes and ensures absolute root
*/
static fixupPattern(pattern) {
static fixupPattern(pattern, homedir) {
// Empty
assert(pattern, 'pattern cannot be empty');
assert_1.default(pattern, 'pattern cannot be empty');
// Must not contain `.` segment, unless first segment
// Must not contain `..` segment
const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x));
assert(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
// Must not contain globs in root, e.g. Windows UNC path \\foo\b*r
assert(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
// Normalize slashes
pattern = pathHelper.normalizeSeparators(pattern);
// Replace leading `.` segment
@ -49757,9 +50038,9 @@ class Pattern {
}
// Replace leading `~` segment
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
const homedir = os.homedir();
assert(homedir, 'Unable to determine HOME directory');
assert(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
homedir = homedir || os.homedir();
assert_1.default(homedir, 'Unable to determine HOME directory');
assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
pattern = Pattern.globEscape(homedir) + pattern.substr(1);
}
// Replace relative drive root, e.g. pattern is C: or C:foo
@ -50548,9 +50829,19 @@ exports.checkBypass = checkBypass;
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert = __webpack_require__(357);
const path = __webpack_require__(622);
const path = __importStar(__webpack_require__(622));
const assert_1 = __importDefault(__webpack_require__(357));
const IS_WINDOWS = process.platform === 'win32';
/**
* Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths.
@ -50590,8 +50881,8 @@ exports.dirname = dirname;
* or `C:` are expanded based on the current working directory.
*/
function ensureAbsoluteRoot(root, itemPath) {
assert(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
assert(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
// Already rooted
if (hasAbsoluteRoot(itemPath)) {
return itemPath;
@ -50601,7 +50892,7 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like C: or C:foo
if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
let cwd = process.cwd();
assert(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
// Drive letter matches cwd? Expand to cwd
if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
// Drive only, e.g. C:
@ -50626,11 +50917,11 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like \ or \foo
else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
const cwd = process.cwd();
assert(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
return `${cwd[0]}:\\${itemPath.substr(1)}`;
}
}
assert(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
// Otherwise ensure root ends with a separator
if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) {
// Intentionally empty
@ -50647,7 +50938,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot;
* `\\hello\share` and `C:\hello` (and using alternate separator).
*/
function hasAbsoluteRoot(itemPath) {
assert(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
// Normalize separators
itemPath = normalizeSeparators(itemPath);
// Windows
@ -50664,7 +50955,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot;
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
*/
function hasRoot(itemPath) {
assert(itemPath, `isRooted parameter 'itemPath' must not be empty`);
assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`);
// Normalize separators
itemPath = normalizeSeparators(itemPath);
// Windows
@ -50945,6 +51236,7 @@ var node_fetch = _interopDefault(__webpack_require__(454));
var abortController = __webpack_require__(106);
var FormData = _interopDefault(__webpack_require__(790));
var util = __webpack_require__(669);
var url = __webpack_require__(835);
var stream = __webpack_require__(794);
var tunnel = __webpack_require__(413);
var coreAuth = __webpack_require__(229);
@ -51128,7 +51420,7 @@ var Constants = {
* @const
* @type {string}
*/
coreHttpVersion: "1.1.9",
coreHttpVersion: "1.2.1",
/**
* Specifies HTTP.
*
@ -51222,6 +51514,17 @@ var Constants = {
}
};
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
/**
* Default key used to access the XML attributes.
*/
var XML_ATTRKEY = "$";
/**
* Default key used to access the XML value content.
*/
var XML_CHARKEY = "_";
// Copyright (c) Microsoft Corporation.
var validUuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;
/**
@ -51369,7 +51672,9 @@ function prepareXMLRootList(obj, elementName, xmlNamespaceKey, xmlNamespace) {
if (!xmlNamespaceKey || !xmlNamespace) {
return _a = {}, _a[elementName] = obj, _a;
}
return _b = {}, _b[elementName] = obj, _b.$ = (_c = {}, _c[xmlNamespaceKey] = xmlNamespace, _c), _b;
var result = (_b = {}, _b[elementName] = obj, _b);
result[XML_ATTRKEY] = (_c = {}, _c[xmlNamespaceKey] = xmlNamespace, _c);
return result;
}
/**
* Applies the properties on the prototype of sourceCtors to the prototype of targetCtor
@ -51482,9 +51787,18 @@ var Serializer = /** @class */ (function () {
*
* @param {string} objectName Name of the serialized object
*
* @param {options} options additional options to deserialization
*
* @returns {object|string|Array|number|boolean|Date|stream} A valid serialized Javascript object
*/
Serializer.prototype.serialize = function (mapper, object, objectName) {
Serializer.prototype.serialize = function (mapper, object, objectName, options) {
var _a, _b, _c;
if (options === void 0) { options = {}; }
var updatedOptions = {
rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "",
includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false,
xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY
};
var payload = {};
var mapperType = mapper.type.name;
if (!objectName) {
@ -51541,13 +51855,13 @@ var Serializer = /** @class */ (function () {
payload = serializeBase64UrlType(objectName, object);
}
else if (mapperType.match(/^Sequence$/i) !== null) {
payload = serializeSequenceType(this, mapper, object, objectName, Boolean(this.isXML));
payload = serializeSequenceType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions);
}
else if (mapperType.match(/^Dictionary$/i) !== null) {
payload = serializeDictionaryType(this, mapper, object, objectName, Boolean(this.isXML));
payload = serializeDictionaryType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions);
}
else if (mapperType.match(/^Composite$/i) !== null) {
payload = serializeCompositeType(this, mapper, object, objectName, Boolean(this.isXML));
payload = serializeCompositeType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions);
}
}
return payload;
@ -51561,9 +51875,18 @@ var Serializer = /** @class */ (function () {
*
* @param {string} objectName Name of the deserialized object
*
* @param options Controls behavior of XML parser and builder.
*
* @returns {object|string|Array|number|boolean|Date|stream} A valid deserialized Javascript object
*/
Serializer.prototype.deserialize = function (mapper, responseBody, objectName) {
Serializer.prototype.deserialize = function (mapper, responseBody, objectName, options) {
var _a, _b, _c;
if (options === void 0) { options = {}; }
var updatedOptions = {
rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "",
includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false,
xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY
};
if (responseBody == undefined) {
if (this.isXML && mapper.type.name === "Sequence" && !mapper.xmlIsWrapped) {
// Edge case for empty XML non-wrapped lists. xml2js can't distinguish
@ -51583,17 +51906,18 @@ var Serializer = /** @class */ (function () {
objectName = mapper.serializedName;
}
if (mapperType.match(/^Composite$/i) !== null) {
payload = deserializeCompositeType(this, mapper, responseBody, objectName);
payload = deserializeCompositeType(this, mapper, responseBody, objectName, updatedOptions);
}
else {
if (this.isXML) {
var xmlCharKey = updatedOptions.xmlCharKey;
/**
* If the mapper specifies this as a non-composite type value but the responseBody contains
* both header ("$") and body ("_") properties, then just reduce the responseBody value to
* the body ("_") property.
* both header ("$" i.e., XML_ATTRKEY) and body ("#" i.e., XML_CHARKEY) properties,
* then just reduce the responseBody value to the body ("#" i.e., XML_CHARKEY) property.
*/
if (responseBody["$"] != undefined && responseBody["_"] != undefined) {
responseBody = responseBody["_"];
if (responseBody[XML_ATTRKEY] != undefined && responseBody[xmlCharKey] != undefined) {
responseBody = responseBody[xmlCharKey];
}
}
if (mapperType.match(/^Number$/i) !== null) {
@ -51629,10 +51953,10 @@ var Serializer = /** @class */ (function () {
payload = base64UrlToByteArray(responseBody);
}
else if (mapperType.match(/^Sequence$/i) !== null) {
payload = deserializeSequenceType(this, mapper, responseBody, objectName);
payload = deserializeSequenceType(this, mapper, responseBody, objectName, updatedOptions);
}
else if (mapperType.match(/^Dictionary$/i) !== null) {
payload = deserializeDictionaryType(this, mapper, responseBody, objectName);
payload = deserializeDictionaryType(this, mapper, responseBody, objectName, updatedOptions);
}
}
if (mapper.isConstant) {
@ -51737,7 +52061,7 @@ function serializeBasicTypes(typeName, objectName, value) {
objectType !== "function" &&
!(value instanceof ArrayBuffer) &&
!ArrayBuffer.isView(value) &&
!(typeof Blob === "function" && value instanceof Blob)) {
!((typeof Blob === "function" || typeof Blob === "object") && value instanceof Blob)) {
throw new Error(objectName + " must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream.");
}
}
@ -51821,7 +52145,7 @@ function serializeDateTypes(typeName, value, objectName) {
}
return value;
}
function serializeSequenceType(serializer, mapper, object, objectName, isXml) {
function serializeSequenceType(serializer, mapper, object, objectName, isXml, options) {
var _a, _b;
if (!Array.isArray(object)) {
throw new Error(objectName + " must be of type Array.");
@ -51833,16 +52157,19 @@ function serializeSequenceType(serializer, mapper, object, objectName, isXml) {
}
var tempArray = [];
for (var i = 0; i < object.length; i++) {
var serializedValue = serializer.serialize(elementType, object[i], objectName);
var serializedValue = serializer.serialize(elementType, object[i], objectName, options);
if (isXml && elementType.xmlNamespace) {
var xmlnsKey = elementType.xmlNamespacePrefix
? "xmlns:" + elementType.xmlNamespacePrefix
: "xmlns";
if (elementType.type.name === "Composite") {
tempArray[i] = tslib.__assign(tslib.__assign({}, serializedValue), { $: (_a = {}, _a[xmlnsKey] = elementType.xmlNamespace, _a) });
tempArray[i] = tslib.__assign({}, serializedValue);
tempArray[i][XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = elementType.xmlNamespace, _a);
}
else {
tempArray[i] = { _: serializedValue, $: (_b = {}, _b[xmlnsKey] = elementType.xmlNamespace, _b) };
tempArray[i] = {};
tempArray[i][options.xmlCharKey] = serializedValue;
tempArray[i][XML_ATTRKEY] = (_b = {}, _b[xmlnsKey] = elementType.xmlNamespace, _b);
}
}
else {
@ -51851,7 +52178,7 @@ function serializeSequenceType(serializer, mapper, object, objectName, isXml) {
}
return tempArray;
}
function serializeDictionaryType(serializer, mapper, object, objectName, isXml) {
function serializeDictionaryType(serializer, mapper, object, objectName, isXml, options) {
var _a;
if (typeof object !== "object") {
throw new Error(objectName + " must be of type object.");
@ -51864,14 +52191,16 @@ function serializeDictionaryType(serializer, mapper, object, objectName, isXml)
var tempDictionary = {};
for (var _i = 0, _b = Object.keys(object); _i < _b.length; _i++) {
var key = _b[_i];
var serializedValue = serializer.serialize(valueType, object[key], objectName);
var serializedValue = serializer.serialize(valueType, object[key], objectName, options);
// If the element needs an XML namespace we need to add it within the $ property
tempDictionary[key] = getXmlObjectValue(valueType, serializedValue, isXml);
tempDictionary[key] = getXmlObjectValue(valueType, serializedValue, isXml, options);
}
// Add the namespace to the root element if needed
if (isXml && mapper.xmlNamespace) {
var xmlnsKey = mapper.xmlNamespacePrefix ? "xmlns:" + mapper.xmlNamespacePrefix : "xmlns";
return tslib.__assign(tslib.__assign({}, tempDictionary), { $: (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a) });
var result = tempDictionary;
result[XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a);
return result;
}
return tempDictionary;
}
@ -51922,7 +52251,7 @@ function resolveModelProperties(serializer, mapper, objectName) {
}
return modelProps;
}
function serializeCompositeType(serializer, mapper, object, objectName, isXml) {
function serializeCompositeType(serializer, mapper, object, objectName, isXml, options) {
var _a, _b;
if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) {
mapper = getPolymorphicMapper(serializer, mapper, object, "clientName");
@ -51964,7 +52293,7 @@ function serializeCompositeType(serializer, mapper, object, objectName, isXml) {
var xmlnsKey = mapper.xmlNamespacePrefix
? "xmlns:" + mapper.xmlNamespacePrefix
: "xmlns";
parentObject.$ = tslib.__assign(tslib.__assign({}, parentObject.$), (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a));
parentObject[XML_ATTRKEY] = tslib.__assign(tslib.__assign({}, parentObject[XML_ATTRKEY]), (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a));
}
var propertyObjectName = propertyMapper.serializedName !== ""
? objectName + "." + propertyMapper.serializedName
@ -51976,15 +52305,15 @@ function serializeCompositeType(serializer, mapper, object, objectName, isXml) {
toSerialize == undefined) {
toSerialize = mapper.serializedName;
}
var serializedValue = serializer.serialize(propertyMapper, toSerialize, propertyObjectName);
var serializedValue = serializer.serialize(propertyMapper, toSerialize, propertyObjectName, options);
if (serializedValue !== undefined && propName != undefined) {
var value = getXmlObjectValue(propertyMapper, serializedValue, isXml);
var value = getXmlObjectValue(propertyMapper, serializedValue, isXml, options);
if (isXml && propertyMapper.xmlIsAttribute) {
// $ is the key attributes are kept under in xml2js.
// XML_ATTRKEY, i.e., $ is the key attributes are kept under in xml2js.
// This keeps things simple while preventing name collision
// with names in user documents.
parentObject.$ = parentObject.$ || {};
parentObject.$[propName] = serializedValue;
parentObject[XML_ATTRKEY] = parentObject[XML_ATTRKEY] || {};
parentObject[XML_ATTRKEY][propName] = serializedValue;
}
else if (isXml && propertyMapper.xmlIsWrapped) {
parentObject[propName] = (_b = {}, _b[propertyMapper.xmlElementName] = value, _b);
@ -52001,7 +52330,7 @@ function serializeCompositeType(serializer, mapper, object, objectName, isXml) {
var _loop_1 = function (clientPropName) {
var isAdditionalProperty = propNames.every(function (pn) { return pn !== clientPropName; });
if (isAdditionalProperty) {
payload[clientPropName] = serializer.serialize(additionalPropertiesMapper, object[clientPropName], objectName + '["' + clientPropName + '"]');
payload[clientPropName] = serializer.serialize(additionalPropertiesMapper, object[clientPropName], objectName + '["' + clientPropName + '"]', options);
}
};
for (var clientPropName in object) {
@ -52012,7 +52341,7 @@ function serializeCompositeType(serializer, mapper, object, objectName, isXml) {
}
return object;
}
function getXmlObjectValue(propertyMapper, serializedValue, isXml) {
function getXmlObjectValue(propertyMapper, serializedValue, isXml, options) {
var _a;
if (!isXml || !propertyMapper.xmlNamespace) {
return serializedValue;
@ -52022,14 +52351,24 @@ function getXmlObjectValue(propertyMapper, serializedValue, isXml) {
: "xmlns";
var xmlNamespace = (_a = {}, _a[xmlnsKey] = propertyMapper.xmlNamespace, _a);
if (["Composite"].includes(propertyMapper.type.name)) {
return tslib.__assign({ $: xmlNamespace }, serializedValue);
if (serializedValue[XML_ATTRKEY]) {
return serializedValue;
}
else {
var result_1 = tslib.__assign({}, serializedValue);
result_1[XML_ATTRKEY] = xmlNamespace;
return result_1;
}
}
return { _: serializedValue, $: xmlNamespace };
var result = {};
result[options.xmlCharKey] = serializedValue;
result[XML_ATTRKEY] = xmlNamespace;
return result;
}
function isSpecialXmlProperty(propertyName) {
return ["$", "_"].includes(propertyName);
function isSpecialXmlProperty(propertyName, options) {
return [XML_ATTRKEY, options.xmlCharKey].includes(propertyName);
}
function deserializeCompositeType(serializer, mapper, responseBody, objectName) {
function deserializeCompositeType(serializer, mapper, responseBody, objectName, options) {
var _a;
if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) {
mapper = getPolymorphicMapper(serializer, mapper, responseBody, "serializedName");
@ -52053,15 +52392,15 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName)
for (var _c = 0, _d = Object.keys(responseBody); _c < _d.length; _c++) {
var headerKey = _d[_c];
if (headerKey.startsWith(headerCollectionPrefix)) {
dictionary[headerKey.substring(headerCollectionPrefix.length)] = serializer.deserialize(propertyMapper.type.value, responseBody[headerKey], propertyObjectName);
dictionary[headerKey.substring(headerCollectionPrefix.length)] = serializer.deserialize(propertyMapper.type.value, responseBody[headerKey], propertyObjectName, options);
}
handledPropertyNames.push(headerKey);
}
instance[key] = dictionary;
}
else if (serializer.isXML) {
if (propertyMapper.xmlIsAttribute && responseBody.$) {
instance[key] = serializer.deserialize(propertyMapper, responseBody.$[xmlName], propertyObjectName);
if (propertyMapper.xmlIsAttribute && responseBody[XML_ATTRKEY]) {
instance[key] = serializer.deserialize(propertyMapper, responseBody[XML_ATTRKEY][xmlName], propertyObjectName, options);
}
else {
var propertyName = xmlElementName || xmlName || serializedName;
@ -52082,11 +52421,11 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName)
*/
var wrapped = responseBody[xmlName];
var elementList = (_a = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _a !== void 0 ? _a : [];
instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName);
instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName, options);
}
else {
var property = responseBody[propertyName];
instance[key] = serializer.deserialize(propertyMapper, property, propertyObjectName);
instance[key] = serializer.deserialize(propertyMapper, property, propertyObjectName, options);
}
}
}
@ -52121,10 +52460,10 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName)
// paging
if (Array.isArray(responseBody[key]) && modelProps[key].serializedName === "") {
propertyInstance = responseBody[key];
instance = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName);
instance = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName, options);
}
else if (propertyInstance !== undefined || propertyMapper.defaultValue !== undefined) {
serializedValue = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName);
serializedValue = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName, options);
instance[key] = serializedValue;
}
}
@ -52142,7 +52481,7 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName)
};
for (var responsePropName in responseBody) {
if (isAdditionalProperty(responsePropName)) {
instance[responsePropName] = serializer.deserialize(additionalPropertiesMapper, responseBody[responsePropName], objectName + '["' + responsePropName + '"]');
instance[responsePropName] = serializer.deserialize(additionalPropertiesMapper, responseBody[responsePropName], objectName + '["' + responsePropName + '"]', options);
}
}
}
@ -52151,14 +52490,14 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName)
var key = _g[_f];
if (instance[key] === undefined &&
!handledPropertyNames.includes(key) &&
!isSpecialXmlProperty(key)) {
!isSpecialXmlProperty(key, options)) {
instance[key] = responseBody[key];
}
}
}
return instance;
}
function deserializeDictionaryType(serializer, mapper, responseBody, objectName) {
function deserializeDictionaryType(serializer, mapper, responseBody, objectName, options) {
var value = mapper.type.value;
if (!value || typeof value !== "object") {
throw new Error("\"value\" metadata for a Dictionary must be defined in the " +
@ -52168,13 +52507,13 @@ function deserializeDictionaryType(serializer, mapper, responseBody, objectName)
var tempDictionary = {};
for (var _i = 0, _a = Object.keys(responseBody); _i < _a.length; _i++) {
var key = _a[_i];
tempDictionary[key] = serializer.deserialize(value, responseBody[key], objectName);
tempDictionary[key] = serializer.deserialize(value, responseBody[key], objectName, options);
}
return tempDictionary;
}
return responseBody;
}
function deserializeSequenceType(serializer, mapper, responseBody, objectName) {
function deserializeSequenceType(serializer, mapper, responseBody, objectName, options) {
var element = mapper.type.element;
if (!element || typeof element !== "object") {
throw new Error("element\" metadata for an Array must be defined in the " +
@ -52187,7 +52526,7 @@ function deserializeSequenceType(serializer, mapper, responseBody, objectName) {
}
var tempArray = [];
for (var i = 0; i < responseBody.length; i++) {
tempArray[i] = serializer.deserialize(element, responseBody[i], objectName + "[" + i + "]");
tempArray[i] = serializer.deserialize(element, responseBody[i], objectName + "[" + i + "]", options);
}
return tempArray;
}
@ -52488,7 +52827,7 @@ var WebResource = /** @class */ (function () {
if (!this.headers.get("Content-Type")) {
this.headers.set("Content-Type", "application/json; charset=utf-8");
}
// set the request body. request.js automatically sets the Content-Length request header, so we need not set it explicilty
// set the request body. request.js automatically sets the Content-Length request header, so we need not set it explicitly
this.body = options.body;
if (options.body !== undefined && options.body !== null) {
// body as a stream special case. set the body as-is and check for some special request headers specific to sending a stream.
@ -53347,8 +53686,9 @@ var FetchHttpClient = /** @class */ (function () {
if (typeof value === "function") {
value = value();
}
// eslint-disable-next-line no-prototype-builtins
if (value && value.hasOwnProperty("value") && value.hasOwnProperty("options")) {
if (value &&
Object.prototype.hasOwnProperty.call(value, "value") &&
Object.prototype.hasOwnProperty.call(value, "options")) {
requestForm_1.append(key, value.value, value.options);
}
else {
@ -53399,7 +53739,7 @@ var FetchHttpClient = /** @class */ (function () {
return [4 /*yield*/, this.prepareRequest(httpRequest)];
case 1:
platformSpecificRequestInit = _d.sent();
requestInit = tslib.__assign({ body: body, headers: httpRequest.headers.rawHeaders(), method: httpRequest.method, signal: abortController$1.signal }, platformSpecificRequestInit);
requestInit = tslib.__assign({ body: body, headers: httpRequest.headers.rawHeaders(), method: httpRequest.method, signal: abortController$1.signal, redirect: "manual" }, platformSpecificRequestInit);
_d.label = 2;
case 2:
_d.trys.push([2, 8, 9, 10]);
@ -53879,13 +54219,12 @@ var xml2jsDefaultOptionsV2 = {
trim: false,
normalize: false,
normalizeTags: false,
attrkey: "$",
charkey: "_",
attrkey: XML_ATTRKEY,
explicitArray: true,
ignoreAttrs: false,
mergeAttrs: false,
explicitRoot: true,
validator: null,
validator: undefined,
xmlns: false,
explicitChildren: false,
preserveChildrenOrder: false,
@ -53894,17 +54233,17 @@ var xml2jsDefaultOptionsV2 = {
includeWhiteChars: false,
async: false,
strict: true,
attrNameProcessors: null,
attrValueProcessors: null,
tagNameProcessors: null,
valueProcessors: null,
attrNameProcessors: undefined,
attrValueProcessors: undefined,
tagNameProcessors: undefined,
valueProcessors: undefined,
rootName: "root",
xmldec: {
version: "1.0",
encoding: "UTF-8",
standalone: true
},
doctype: null,
doctype: undefined,
renderOpts: {
pretty: true,
indent: " ",
@ -53931,7 +54270,10 @@ xml2jsBuilderSettings.renderOpts = {
* `rootName` indicates the name of the root element in the resulting XML
*/
function stringifyXML(obj, opts) {
xml2jsBuilderSettings.rootName = (opts || {}).rootName;
var _a;
if (opts === void 0) { opts = {}; }
xml2jsBuilderSettings.rootName = opts.rootName;
xml2jsBuilderSettings.charkey = (_a = opts.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
var builder = new xml2js.Builder(xml2jsBuilderSettings);
return builder.buildObject(obj);
}
@ -53942,7 +54284,10 @@ function stringifyXML(obj, opts) {
* `includeRoot` indicates whether the root element is to be included or not in the output
*/
function parseXML(str, opts) {
xml2jsParserSettings.explicitRoot = !!(opts && opts.includeRoot);
var _a;
if (opts === void 0) { opts = {}; }
xml2jsParserSettings.explicitRoot = !!opts.includeRoot;
xml2jsParserSettings.charkey = (_a = opts.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
var xmlParser = new xml2js.Parser(xml2jsParserSettings);
return new Promise(function (resolve, reject) {
if (!str) {
@ -53966,10 +54311,10 @@ function parseXML(str, opts) {
* Create a new serialization RequestPolicyCreator that will serialized HTTP request bodies as they
* pass through the HTTP pipeline.
*/
function deserializationPolicy(deserializationContentTypes) {
function deserializationPolicy(deserializationContentTypes, parsingOptions) {
return {
create: function (nextPolicy, options) {
return new DeserializationPolicy(nextPolicy, deserializationContentTypes, options);
return new DeserializationPolicy(nextPolicy, options, deserializationContentTypes, parsingOptions);
}
};
}
@ -53987,22 +54332,25 @@ var DefaultDeserializationOptions = {
*/
var DeserializationPolicy = /** @class */ (function (_super) {
tslib.__extends(DeserializationPolicy, _super);
function DeserializationPolicy(nextPolicy, deserializationContentTypes, options) {
var _this = _super.call(this, nextPolicy, options) || this;
function DeserializationPolicy(nextPolicy, requestPolicyOptions, deserializationContentTypes, parsingOptions) {
if (parsingOptions === void 0) { parsingOptions = {}; }
var _a;
var _this = _super.call(this, nextPolicy, requestPolicyOptions) || this;
_this.jsonContentTypes =
(deserializationContentTypes && deserializationContentTypes.json) || defaultJsonContentTypes;
_this.xmlContentTypes =
(deserializationContentTypes && deserializationContentTypes.xml) || defaultXmlContentTypes;
_this.xmlCharKey = (_a = parsingOptions.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
return _this;
}
DeserializationPolicy.prototype.sendRequest = function (request) {
return tslib.__awaiter(this, void 0, void 0, function () {
var _this = this;
return tslib.__generator(this, function (_a) {
return [2 /*return*/, this._nextPolicy
.sendRequest(request)
.then(function (response) {
return deserializeResponseBody(_this.jsonContentTypes, _this.xmlContentTypes, response);
return [2 /*return*/, this._nextPolicy.sendRequest(request).then(function (response) {
return deserializeResponseBody(_this.jsonContentTypes, _this.xmlContentTypes, response, {
xmlCharKey: _this.xmlCharKey
});
})];
});
});
@ -54038,8 +54386,15 @@ function shouldDeserializeResponse(parsedResponse) {
}
return result;
}
function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) {
return parse(jsonContentTypes, xmlContentTypes, response).then(function (parsedResponse) {
function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, options) {
var _a, _b, _c;
if (options === void 0) { options = {}; }
var updatedOptions = {
rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "",
includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false,
xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY
};
return parse(jsonContentTypes, xmlContentTypes, response, updatedOptions).then(function (parsedResponse) {
if (!shouldDeserializeResponse(parsedResponse)) {
return parsedResponse;
}
@ -54048,54 +54403,13 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) {
return parsedResponse;
}
var responseSpec = getOperationResponse(parsedResponse);
var expectedStatusCodes = Object.keys(operationSpec.responses);
var hasNoExpectedStatusCodes = expectedStatusCodes.length === 0 ||
(expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default");
var isExpectedStatusCode = hasNoExpectedStatusCodes
? 200 <= parsedResponse.status && parsedResponse.status < 300
: !!responseSpec;
// There is no operation response spec for current status code.
// So, treat it as an error case and use the default response spec to deserialize the response.
if (!isExpectedStatusCode) {
var defaultResponseSpec = operationSpec.responses.default;
if (!defaultResponseSpec) {
return parsedResponse;
}
var defaultBodyMapper = defaultResponseSpec.bodyMapper;
var defaultHeadersMapper = defaultResponseSpec.headersMapper;
var initialErrorMessage = isStreamOperation(operationSpec)
? "Unexpected status code: " + parsedResponse.status
: parsedResponse.bodyAsText;
var error = new RestError(initialErrorMessage, undefined, parsedResponse.status, parsedResponse.request, parsedResponse);
try {
// If error response has a body, try to extract error code & message from it
// Then try to deserialize it using default body mapper
if (parsedResponse.parsedBody) {
var parsedBody = parsedResponse.parsedBody;
var internalError = parsedBody.error || parsedBody;
error.code = internalError.code;
if (internalError.message) {
error.message = internalError.message;
}
if (defaultBodyMapper) {
var valueToDeserialize = parsedBody;
if (operationSpec.isXML && defaultBodyMapper.type.name === MapperType.Sequence) {
valueToDeserialize =
typeof parsedBody === "object" ? parsedBody[defaultBodyMapper.xmlElementName] : [];
}
error.response.parsedBody = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody");
}
}
// If error response has headers, try to deserialize it using default header mapper
if (parsedResponse.headers && defaultHeadersMapper) {
error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders");
}
}
catch (defaultError) {
error.message = "Error \"" + defaultError.message + "\" occurred in deserializing the responseBody - \"" + parsedResponse.bodyAsText + "\" for the default response.";
}
var _a = handleErrorResponse(parsedResponse, operationSpec, responseSpec), error = _a.error, shouldReturnResponse = _a.shouldReturnResponse;
if (error) {
throw error;
}
else if (shouldReturnResponse) {
return parsedResponse;
}
// An operation response spec does exist for current status code, so
// use it to deserialize the response.
if (responseSpec) {
@ -54108,7 +54422,7 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) {
: [];
}
try {
parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody");
parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody", options);
}
catch (error) {
var restError = new RestError("Error " + error + " occurred in deserializing the responseBody - " + parsedResponse.bodyAsText, undefined, parsedResponse.status, parsedResponse.request, parsedResponse);
@ -54120,13 +54434,78 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) {
parsedResponse.parsedBody = response.status >= 200 && response.status < 300;
}
if (responseSpec.headersMapper) {
parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders");
parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders", options);
}
}
return parsedResponse;
});
}
function parse(jsonContentTypes, xmlContentTypes, operationResponse) {
function isOperationSpecEmpty(operationSpec) {
var expectedStatusCodes = Object.keys(operationSpec.responses);
return (expectedStatusCodes.length === 0 ||
(expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default"));
}
function handleErrorResponse(parsedResponse, operationSpec, responseSpec) {
var isSuccessByStatus = 200 <= parsedResponse.status && parsedResponse.status < 300;
var isExpectedStatusCode = isOperationSpecEmpty(operationSpec)
? isSuccessByStatus
: !!responseSpec;
if (isExpectedStatusCode) {
if (responseSpec) {
if (!responseSpec.isError) {
return { error: null, shouldReturnResponse: false };
}
}
else {
return { error: null, shouldReturnResponse: false };
}
}
var errorResponseSpec = responseSpec !== null && responseSpec !== void 0 ? responseSpec : operationSpec.responses.default;
var initialErrorMessage = isStreamOperation(operationSpec)
? "Unexpected status code: " + parsedResponse.status
: parsedResponse.bodyAsText;
var error = new RestError(initialErrorMessage, undefined, parsedResponse.status, parsedResponse.request, parsedResponse);
// If the item failed but there's no error spec or default spec to deserialize the error,
// we should fail so we just throw the parsed response
if (!errorResponseSpec) {
throw error;
}
var defaultBodyMapper = errorResponseSpec.bodyMapper;
var defaultHeadersMapper = errorResponseSpec.headersMapper;
try {
// If error response has a body, try to deserialize it using default body mapper.
// Then try to extract error code & message from it
if (parsedResponse.parsedBody) {
var parsedBody = parsedResponse.parsedBody;
var parsedError = void 0;
if (defaultBodyMapper) {
var valueToDeserialize = parsedBody;
if (operationSpec.isXML && defaultBodyMapper.type.name === MapperType.Sequence) {
valueToDeserialize =
typeof parsedBody === "object" ? parsedBody[defaultBodyMapper.xmlElementName] : [];
}
parsedError = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody");
}
var internalError = parsedBody.error || parsedError || parsedBody;
error.code = internalError.code;
if (internalError.message) {
error.message = internalError.message;
}
if (defaultBodyMapper) {
error.response.parsedBody = parsedError;
}
}
// If error response has headers, try to deserialize it using default header mapper
if (parsedResponse.headers && defaultHeadersMapper) {
error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders");
}
}
catch (defaultError) {
error.message = "Error \"" + defaultError.message + "\" occurred in deserializing the responseBody - \"" + parsedResponse.bodyAsText + "\" for the default response.";
}
return { error: error, shouldReturnResponse: false };
}
function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts) {
var errorHandler = function (err) {
var msg = "Error \"" + err + "\" occurred while parsing the response body - " + operationResponse.bodyAsText + ".";
var errCode = err.code || RestError.PARSE_ERROR;
@ -54147,7 +54526,7 @@ function parse(jsonContentTypes, xmlContentTypes, operationResponse) {
}).catch(errorHandler);
}
else if (contentComponents.some(function (component) { return xmlContentTypes.indexOf(component) !== -1; })) {
return parseXML(text_1)
return parseXML(text_1, opts)
.then(function (body) {
operationResponse.parsedBody = body;
return operationResponse;
@ -54417,6 +54796,10 @@ var UserAgentPolicy = /** @class */ (function (_super) {
}(BaseRequestPolicy));
// Copyright (c) Microsoft Corporation.
/**
* Methods that are allowed to follow redirects 301 and 302
*/
var allowedRedirect = ["GET", "HEAD"];
var DefaultRedirectOptions = {
handleRedirects: true,
maxRetries: 20
@ -54449,7 +54832,11 @@ function handleRedirect(policy, response, currentRetries) {
var request = response.request, status = response.status;
var locationHeader = response.headers.get("location");
if (locationHeader &&
(status === 300 || status === 307 || (status === 303 && request.method === "POST")) &&
(status === 300 ||
(status === 301 && allowedRedirect.includes(request.method)) ||
(status === 302 && allowedRedirect.includes(request.method)) ||
(status === 303 && request.method === "POST") ||
status === 307) &&
(!policy.maxRetries || currentRetries < policy.maxRetries)) {
var builder = URLBuilder.parse(request.url);
builder.setPath(locationHeader);
@ -54458,6 +54845,7 @@ function handleRedirect(policy, response, currentRetries) {
// redirected GET request if the redirect url is present in the location header
if (status === 303) {
request.method = "GET";
delete request.body;
}
return policy._nextPolicy
.sendRequest(request)
@ -54719,6 +55107,12 @@ var AccessTokenRefresher = /** @class */ (function () {
}());
// Copyright (c) Microsoft Corporation.
/**
* The automated token refresh will only start to happen at the
* expiration date minus the value of timeBetweenRefreshAttemptsInMs,
* which is by default 30 seconds.
*/
var timeBetweenRefreshAttemptsInMs = 30000;
/**
* Creates a new BearerTokenAuthenticationPolicy factory.
*
@ -54734,12 +55128,6 @@ function bearerTokenAuthenticationPolicy(credential, scopes) {
}
};
}
/**
* The automated token refresh will only start to happen at the
* expiration date minus the value of timeBetweenRefreshAttemptsInMs,
* which is by default 30 seconds.
*/
var timeBetweenRefreshAttemptsInMs = 30000;
/**
*
* Provides a RequestPolicy that can request a token from a TokenCredential
@ -55399,10 +55787,15 @@ var ServiceClient = /** @class */ (function () {
var bearerTokenPolicyFactory = undefined;
// eslint-disable-next-line @typescript-eslint/no-this-alias
var serviceClient = _this;
var serviceClientOptions = options;
return {
create: function (nextPolicy, options) {
var credentialScopes = getCredentialScopes(serviceClientOptions, serviceClient.baseUri);
if (!credentialScopes) {
throw new Error("When using credential, the ServiceClient must contain a baseUri or a credentialScopes in ServiceClientOptions. Unable to create a bearerTokenAuthenticationPolicy");
}
if (bearerTokenPolicyFactory === undefined || bearerTokenPolicyFactory === null) {
bearerTokenPolicyFactory = bearerTokenAuthenticationPolicy(credentials, (serviceClient.baseUri || "") + "/.default");
bearerTokenPolicyFactory = bearerTokenAuthenticationPolicy(credentials, credentialScopes);
}
return bearerTokenPolicyFactory.create(nextPolicy, options);
}
@ -55466,19 +55859,21 @@ var ServiceClient = /** @class */ (function () {
* @param {ServiceCallback} callback The callback to call when the response is received.
*/
ServiceClient.prototype.sendOperationRequest = function (operationArguments, operationSpec, callback) {
var _a;
return tslib.__awaiter(this, void 0, void 0, function () {
var httpRequest, result, baseUri, requestUrl, _i, _a, urlParameter, urlParameterValue, _b, _c, queryParameter, queryParameterValue, index, item, index, contentType, _d, _e, headerParameter, headerValue, headerCollectionPrefix, _f, _g, key, options, customHeaderName, rawResponse, sendRequestError, error_1, error_2, cb;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
var serializerOptions, httpRequest, result, baseUri, requestUrl, _i, _b, urlParameter, urlParameterValue, _c, _d, queryParameter, queryParameterValue, index, item, index, contentType, _e, _f, headerParameter, headerValue, headerCollectionPrefix, _g, _h, key, options, customHeaderName, rawResponse, sendRequestError, error_1, error_2, cb;
return tslib.__generator(this, function (_j) {
switch (_j.label) {
case 0:
if (typeof operationArguments.options === "function") {
callback = operationArguments.options;
operationArguments.options = undefined;
}
serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions;
httpRequest = new WebResource();
_h.label = 1;
_j.label = 1;
case 1:
_h.trys.push([1, 6, , 7]);
_j.trys.push([1, 6, , 7]);
baseUri = operationSpec.baseUrl || this.baseUri;
if (!baseUri) {
throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a baseUri string property that contains the base URL to use.");
@ -55490,10 +55885,10 @@ var ServiceClient = /** @class */ (function () {
requestUrl.appendPath(operationSpec.path);
}
if (operationSpec.urlParameters && operationSpec.urlParameters.length > 0) {
for (_i = 0, _a = operationSpec.urlParameters; _i < _a.length; _i++) {
urlParameter = _a[_i];
for (_i = 0, _b = operationSpec.urlParameters; _i < _b.length; _i++) {
urlParameter = _b[_i];
urlParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, urlParameter, operationSpec.serializer);
urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, getPathStringFromParameter(urlParameter));
urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, getPathStringFromParameter(urlParameter), serializerOptions);
if (!urlParameter.skipEncoding) {
urlParameterValue = encodeURIComponent(urlParameterValue);
}
@ -55501,16 +55896,17 @@ var ServiceClient = /** @class */ (function () {
}
}
if (operationSpec.queryParameters && operationSpec.queryParameters.length > 0) {
for (_b = 0, _c = operationSpec.queryParameters; _b < _c.length; _b++) {
queryParameter = _c[_b];
for (_c = 0, _d = operationSpec.queryParameters; _c < _d.length; _c++) {
queryParameter = _d[_c];
queryParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, queryParameter, operationSpec.serializer);
if (queryParameterValue !== undefined && queryParameterValue !== null) {
queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter));
queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter), serializerOptions);
if (queryParameter.collectionFormat !== undefined &&
queryParameter.collectionFormat !== null) {
if (queryParameter.collectionFormat === exports.QueryCollectionFormat.Multi) {
if (queryParameterValue.length === 0) {
queryParameterValue = "";
// The collection is empty, no need to try serializing the current queryParam
continue;
}
else {
for (index in queryParameterValue) {
@ -55555,16 +55951,16 @@ var ServiceClient = /** @class */ (function () {
httpRequest.headers.set("Content-Type", contentType);
}
if (operationSpec.headerParameters) {
for (_d = 0, _e = operationSpec.headerParameters; _d < _e.length; _d++) {
headerParameter = _e[_d];
for (_e = 0, _f = operationSpec.headerParameters; _e < _f.length; _e++) {
headerParameter = _f[_e];
headerValue = getOperationArgumentValueFromParameter(this, operationArguments, headerParameter, operationSpec.serializer);
if (headerValue !== undefined && headerValue !== null) {
headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter));
headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter), serializerOptions);
headerCollectionPrefix = headerParameter.mapper
.headerCollectionPrefix;
if (headerCollectionPrefix) {
for (_f = 0, _g = Object.keys(headerValue); _f < _g.length; _f++) {
key = _g[_f];
for (_g = 0, _h = Object.keys(headerValue); _g < _h.length; _g++) {
key = _h[_g];
httpRequest.headers.set(headerCollectionPrefix + key, headerValue[key]);
}
}
@ -55608,15 +56004,15 @@ var ServiceClient = /** @class */ (function () {
}
rawResponse = void 0;
sendRequestError = void 0;
_h.label = 2;
_j.label = 2;
case 2:
_h.trys.push([2, 4, , 5]);
_j.trys.push([2, 4, , 5]);
return [4 /*yield*/, this.sendRequest(httpRequest)];
case 3:
rawResponse = _h.sent();
rawResponse = _j.sent();
return [3 /*break*/, 5];
case 4:
error_1 = _h.sent();
error_1 = _j.sent();
sendRequestError = error_1;
return [3 /*break*/, 5];
case 5:
@ -55632,7 +56028,7 @@ var ServiceClient = /** @class */ (function () {
}
return [3 /*break*/, 7];
case 6:
error_2 = _h.sent();
error_2 = _j.sent();
result = Promise.reject(error_2);
return [3 /*break*/, 7];
case 7:
@ -55651,7 +56047,14 @@ var ServiceClient = /** @class */ (function () {
return ServiceClient;
}());
function serializeRequestBody(serviceClient, httpRequest, operationArguments, operationSpec) {
var _a;
var _a, _b, _c, _d, _e, _f;
var serializerOptions = (_b = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions) !== null && _b !== void 0 ? _b : {};
var updatedOptions = {
rootName: (_c = serializerOptions.rootName) !== null && _c !== void 0 ? _c : "",
includeRoot: (_d = serializerOptions.includeRoot) !== null && _d !== void 0 ? _d : false,
xmlCharKey: (_e = serializerOptions.xmlCharKey) !== null && _e !== void 0 ? _e : XML_CHARKEY
};
var xmlCharKey = serializerOptions.xmlCharKey;
if (operationSpec.requestBody && operationSpec.requestBody.mapper) {
httpRequest.body = getOperationArgumentValueFromParameter(serviceClient, operationArguments, operationSpec.requestBody, operationSpec.serializer);
var bodyMapper = operationSpec.requestBody.mapper;
@ -55660,22 +56063,26 @@ function serializeRequestBody(serviceClient, httpRequest, operationArguments, op
try {
if ((httpRequest.body !== undefined && httpRequest.body !== null) || required) {
var requestBodyParameterPathString = getPathStringFromParameter(operationSpec.requestBody);
httpRequest.body = operationSpec.serializer.serialize(bodyMapper, httpRequest.body, requestBodyParameterPathString);
httpRequest.body = operationSpec.serializer.serialize(bodyMapper, httpRequest.body, requestBodyParameterPathString, updatedOptions);
var isStream = typeName === MapperType.Stream;
if (operationSpec.isXML) {
var xmlnsKey = xmlNamespacePrefix ? "xmlns:" + xmlNamespacePrefix : "xmlns";
var value = getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, httpRequest.body);
var value = getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, httpRequest.body, updatedOptions);
if (typeName === MapperType.Sequence) {
httpRequest.body = stringifyXML(prepareXMLRootList(value, xmlElementName || xmlName || serializedName, xmlnsKey, xmlNamespace), { rootName: xmlName || serializedName });
httpRequest.body = stringifyXML(prepareXMLRootList(value, xmlElementName || xmlName || serializedName, xmlnsKey, xmlNamespace), {
rootName: xmlName || serializedName,
xmlCharKey: xmlCharKey
});
}
else if (!isStream) {
httpRequest.body = stringifyXML(value, {
rootName: xmlName || serializedName
rootName: xmlName || serializedName,
xmlCharKey: xmlCharKey
});
}
}
else if (typeName === MapperType.String &&
(((_a = operationSpec.contentType) === null || _a === void 0 ? void 0 : _a.match("text/plain")) || operationSpec.mediaType === "text")) {
(((_f = operationSpec.contentType) === null || _f === void 0 ? void 0 : _f.match("text/plain")) || operationSpec.mediaType === "text")) {
// the String serializer has validated that request body is a string
// so just send the string.
return;
@ -55691,12 +56098,12 @@ function serializeRequestBody(serviceClient, httpRequest, operationArguments, op
}
else if (operationSpec.formDataParameters && operationSpec.formDataParameters.length > 0) {
httpRequest.formData = {};
for (var _i = 0, _b = operationSpec.formDataParameters; _i < _b.length; _i++) {
var formDataParameter = _b[_i];
for (var _i = 0, _g = operationSpec.formDataParameters; _i < _g.length; _i++) {
var formDataParameter = _g[_i];
var formDataParameterValue = getOperationArgumentValueFromParameter(serviceClient, operationArguments, formDataParameter, operationSpec.serializer);
if (formDataParameterValue !== undefined && formDataParameterValue !== null) {
var formDataParameterPropertyName = formDataParameter.mapper.serializedName || getPathStringFromParameter(formDataParameter);
httpRequest.formData[formDataParameterPropertyName] = operationSpec.serializer.serialize(formDataParameter.mapper, formDataParameterValue, getPathStringFromParameter(formDataParameter));
httpRequest.formData[formDataParameterPropertyName] = operationSpec.serializer.serialize(formDataParameter.mapper, formDataParameterValue, getPathStringFromParameter(formDataParameter), updatedOptions);
}
}
}
@ -55704,12 +56111,15 @@ function serializeRequestBody(serviceClient, httpRequest, operationArguments, op
/**
* Adds an xml namespace to the xml serialized object if needed, otherwise it just returns the value itself
*/
function getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, serializedValue) {
function getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, serializedValue, options) {
var _a;
// Composite and Sequence schemas already got their root namespace set during serialization
// We just need to add xmlns to the other schema types
if (xmlNamespace && !["Composite", "Sequence", "Dictionary"].includes(typeName)) {
return { _: serializedValue, $: (_a = {}, _a[xmlnsKey] = xmlNamespace, _a) };
var result = {};
result[options.xmlCharKey] = serializedValue;
result[XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = xmlNamespace, _a);
return result;
}
return serializedValue;
}
@ -55798,10 +56208,12 @@ function getOperationArgumentValueFromParameter(serviceClient, operationArgument
return getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, parameter.parameterPath, parameter.mapper, serializer);
}
function getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, parameterPath, parameterMapper, serializer) {
var _a;
var value;
if (typeof parameterPath === "string") {
parameterPath = [parameterPath];
}
var serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions;
if (Array.isArray(parameterPath)) {
if (parameterPath.length > 0) {
if (parameterMapper.isConstant) {
@ -55822,7 +56234,7 @@ function getOperationArgumentValueFromParameterPath(serviceClient, operationArgu
}
// Serialize just for validation purposes.
var parameterPathString = getPathStringFromParameterPath(parameterPath, parameterMapper);
serializer.serialize(parameterMapper, value, parameterPathString);
serializer.serialize(parameterMapper, value, parameterPathString, serializerOptions);
}
}
else {
@ -55835,7 +56247,7 @@ function getOperationArgumentValueFromParameterPath(serviceClient, operationArgu
var propertyValue = getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, propertyPath, propertyMapper, serializer);
// Serialize just for validation purposes.
var propertyPathString = getPathStringFromParameterPath(propertyPath, propertyMapper);
serializer.serialize(propertyMapper, propertyValue, propertyPathString);
serializer.serialize(propertyMapper, propertyValue, propertyPathString, serializerOptions);
if (propertyValue !== undefined && propertyValue !== null) {
if (!value) {
value = {};
@ -55909,6 +56321,46 @@ function flattenResponse(_response, responseSpec) {
}
return addOperationResponse(tslib.__assign(tslib.__assign({}, parsedHeaders), _response.parsedBody));
}
function getCredentialScopes(options, baseUri) {
if (options === null || options === void 0 ? void 0 : options.credentialScopes) {
var scopes = options.credentialScopes;
return Array.isArray(scopes)
? scopes.map(function (scope) { return new url.URL(scope).toString(); })
: new url.URL(scopes).toString();
}
if (baseUri) {
return baseUri + "/.default";
}
return undefined;
}
// Copyright (c) Microsoft Corporation.
/**
* Creates a function called createSpan to create spans using the global tracer.
* @ignore
* @param spanConfig The name of the operation being performed.
* @param tracingOptions The options for the underlying http request.
*/
function createSpanFunction(_a) {
var packagePrefix = _a.packagePrefix, namespace = _a.namespace;
return function (operationName, operationOptions) {
var tracer = coreTracing.getTracer();
var tracingOptions = operationOptions.tracingOptions || {};
var spanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { kind: api.SpanKind.INTERNAL });
var span = tracer.startSpan(packagePrefix + "." + operationName, spanOptions);
span.setAttribute("az.namespace", namespace);
var newSpanOptions = tracingOptions.spanOptions || {};
if (span.isRecording()) {
newSpanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: tslib.__assign(tslib.__assign({}, spanOptions.attributes), { "az.namespace": namespace }) });
}
var newTracingOptions = tslib.__assign(tslib.__assign({}, tracingOptions), { spanOptions: newSpanOptions });
var newOperationOptions = tslib.__assign(tslib.__assign({}, operationOptions), { tracingOptions: newTracingOptions });
return {
span: span,
updatedOptions: newOperationOptions
};
};
}
// Copyright (c) Microsoft Corporation.
var HeaderConstants = Constants.HeaderConstants;
@ -56053,9 +56505,12 @@ exports.TopicCredentials = TopicCredentials;
exports.URLBuilder = URLBuilder;
exports.URLQuery = URLQuery;
exports.WebResource = WebResource;
exports.XML_ATTRKEY = XML_ATTRKEY;
exports.XML_CHARKEY = XML_CHARKEY;
exports.applyMixins = applyMixins;
exports.bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy;
exports.createPipelineFromOptions = createPipelineFromOptions;
exports.createSpanFunction = createSpanFunction;
exports.delay = delay;
exports.deserializationPolicy = deserializationPolicy;
exports.deserializeResponseBody = deserializeResponseBody;

1767
dist/save/index.js vendored
View File

@ -1074,7 +1074,9 @@ function resolvePaths(patterns) {
try {
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
const file = _d.value;
const relativeFile = path.relative(workspace, file);
const relativeFile = path
.relative(workspace, file)
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
core.debug(`Matched: ${relativeFile}`);
// Paths are made relative so the tar entries are all relative to the root of the workspace.
paths.push(`${relativeFile}`);
@ -8540,12 +8542,19 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __webpack_require__(470);
const fs = __webpack_require__(747);
const globOptionsHelper = __webpack_require__(601);
const path = __webpack_require__(622);
const patternHelper = __webpack_require__(597);
const core = __importStar(__webpack_require__(470));
const fs = __importStar(__webpack_require__(747));
const globOptionsHelper = __importStar(__webpack_require__(601));
const path = __importStar(__webpack_require__(622));
const patternHelper = __importStar(__webpack_require__(597));
const internal_match_kind_1 = __webpack_require__(327);
const internal_pattern_1 = __webpack_require__(923);
const internal_search_state_1 = __webpack_require__(728);
@ -9796,6 +9805,13 @@ var StorageError = {
type: {
name: "String"
}
},
code: {
xmlName: "Code",
serializedName: "Code",
type: {
name: "String"
}
}
}
}
@ -10156,6 +10172,13 @@ var BlobPropertiesInternal = {
type: {
name: "String"
}
},
lastAccessedOn: {
xmlName: "LastAccessTime",
serializedName: "LastAccessTime",
type: {
name: "DateTimeRfc1123"
}
}
}
}
@ -10861,6 +10884,70 @@ var JsonTextConfiguration = {
}
}
};
var ArrowField = {
xmlName: "Field",
serializedName: "ArrowField",
type: {
name: "Composite",
className: "ArrowField",
modelProperties: {
type: {
xmlName: "Type",
required: true,
serializedName: "Type",
type: {
name: "String"
}
},
name: {
xmlName: "Name",
serializedName: "Name",
type: {
name: "String"
}
},
precision: {
xmlName: "Precision",
serializedName: "Precision",
type: {
name: "Number"
}
},
scale: {
xmlName: "Scale",
serializedName: "Scale",
type: {
name: "Number"
}
}
}
}
};
var ArrowConfiguration = {
serializedName: "ArrowConfiguration",
type: {
name: "Composite",
className: "ArrowConfiguration",
modelProperties: {
schema: {
xmlIsWrapped: true,
xmlName: "Schema",
xmlElementName: "Field",
required: true,
serializedName: "Schema",
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "ArrowField"
}
}
}
}
}
}
};
var ListContainersSegmentResponse = {
xmlName: "EnumerationResults",
serializedName: "ListContainersSegmentResponse",
@ -11301,7 +11388,8 @@ var QueryFormat = {
name: "Enum",
allowedValues: [
"delimited",
"json"
"json",
"arrow"
]
}
},
@ -11320,6 +11408,14 @@ var QueryFormat = {
name: "Composite",
className: "JsonTextConfiguration"
}
},
arrowConfiguration: {
xmlName: "ArrowConfiguration",
serializedName: "ArrowConfiguration",
type: {
name: "Composite",
className: "ArrowConfiguration"
}
}
}
}
@ -12973,6 +13069,12 @@ var BlobDownloadHeaders = {
name: "Boolean"
}
},
lastAccessed: {
serializedName: "x-ms-last-access-time",
type: {
name: "DateTimeRfc1123"
}
},
contentCrc64: {
serializedName: "x-ms-content-crc64",
type: {
@ -13302,6 +13404,12 @@ var BlobGetPropertiesHeaders = {
name: "String"
}
},
lastAccessed: {
serializedName: "x-ms-last-access-time",
type: {
name: "DateTimeRfc1123"
}
},
errorCode: {
serializedName: "x-ms-error-code",
type: {
@ -17688,7 +17796,7 @@ var version = {
required: true,
isConstant: true,
serializedName: "x-ms-version",
defaultValue: '2019-12-12',
defaultValue: '2020-02-10',
type: {
name: "String"
}
@ -18680,6 +18788,8 @@ var getAccountInfoOperationSpec$1 = {
var Mappers$2 = /*#__PURE__*/Object.freeze({
__proto__: null,
ArrowConfiguration: ArrowConfiguration,
ArrowField: ArrowField,
BlobAbortCopyFromURLHeaders: BlobAbortCopyFromURLHeaders,
BlobAcquireLeaseHeaders: BlobAcquireLeaseHeaders,
BlobBreakLeaseHeaders: BlobBreakLeaseHeaders,
@ -20769,8 +20879,8 @@ var logger = logger$1.createClientLogger("storage-blob");
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
var SDK_VERSION = "12.2.1";
var SERVICE_VERSION = "2019-12-12";
var SDK_VERSION = "12.3.0";
var SERVICE_VERSION = "2020-02-10";
var BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB
var BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB
var BLOCK_BLOB_MAX_BLOCKS = 50000;
@ -21477,7 +21587,7 @@ function toTags(tags) {
* Convert BlobQueryTextConfiguration to QuerySerialization type.
*
* @export
* @param {(BlobQueryJsonTextConfiguration | BlobQueryCsvTextConfiguration)} [textConfiguration]
* @param {(BlobQueryJsonTextConfiguration | BlobQueryCsvTextConfiguration | BlobQueryArrowConfiguration)} [textConfiguration]
* @returns {(QuerySerialization | undefined)}
*/
function toQuerySerialization(textConfiguration) {
@ -21507,6 +21617,15 @@ function toQuerySerialization(textConfiguration) {
}
}
};
case "arrow":
return {
format: {
type: "arrow",
arrowConfiguration: {
schema: textConfiguration.schema
}
}
};
default:
throw Error("Invalid BlobQueryTextConfiguration.");
}
@ -22794,6 +22913,21 @@ var BlobDownloadResponse = /** @class */ (function () {
enumerable: false,
configurable: true
});
Object.defineProperty(BlobDownloadResponse.prototype, "lastAccessed", {
/**
* Returns the UTC date and time generated by the service that indicates the time at which the blob was
* last read or written to.
*
* @readonly
* @type {(Date | undefined)}
* @memberof BlobDownloadResponse
*/
get: function () {
return this.originalResponse.lastAccessed;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BlobDownloadResponse.prototype, "metadata", {
/**
* A name-value pair
@ -24798,7 +24932,7 @@ var StorageSharedKeyCredential = /** @class */ (function (_super) {
* regenerated.
*/
var packageName = "azure-storage-blob";
var packageVersion = "12.2.1";
var packageVersion = "12.3.0";
var StorageClientContext = /** @class */ (function (_super) {
tslib.__extends(StorageClientContext, _super);
/**
@ -24820,7 +24954,7 @@ var StorageClientContext = /** @class */ (function (_super) {
options.userAgent = packageName + "/" + packageVersion + " " + defaultUserAgent;
}
_this = _super.call(this, undefined, options) || this;
_this.version = "2019-12-12";
_this.version = "2020-02-10";
_this.baseUri = "{url}";
_this.requestContentType = "application/json; charset=utf-8";
_this.url = url;
@ -28164,6 +28298,56 @@ var BlockBlobClient = /** @class */ (function (_super) {
});
};
// High level functions
/**
* Uploads a Buffer(Node.js)/Blob(browsers)/ArrayBuffer/ArrayBufferView object to a BlockBlob.
*
* When data length is no more than the specifiled {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is
* {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload.
* Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList}
* to commit the block list.
*
* @export
* @param {Buffer | Blob | ArrayBuffer | ArrayBufferView} data Buffer(Node.js), Blob, ArrayBuffer or ArrayBufferView
* @param {BlockBlobParallelUploadOptions} [options]
* @returns {Promise<BlobUploadCommonResponse>}
* @memberof BlockBlobClient
*/
BlockBlobClient.prototype.uploadData = function (data, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, buffer_1, browserBlob_1;
return tslib.__generator(this, function (_b) {
_a = createSpan("BlockBlobClient-uploadData", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions;
try {
if (true) {
if (data instanceof Buffer) {
buffer_1 = data;
}
else if (data instanceof ArrayBuffer) {
buffer_1 = Buffer.from(data);
}
else {
data = data;
buffer_1 = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
}
return [2 /*return*/, this.uploadSeekableInternal(function (offset, size) { return buffer_1.slice(offset, offset + size); }, buffer_1.byteLength, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
}
else {}
}
catch (e) {
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e.message
});
throw e;
}
finally {
span.end();
}
return [2 /*return*/];
});
});
};
/**
* ONLY AVAILABLE IN BROWSERS.
*
@ -28173,6 +28357,8 @@ var BlockBlobClient = /** @class */ (function (_super) {
* Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call
* {@link commitBlockList} to commit the block list.
*
* @deprecated Use {@link uploadData} instead.
*
* @export
* @param {Blob | ArrayBuffer | ArrayBufferView} browserData Blob, File, ArrayBuffer or ArrayBufferView
* @param {BlockBlobParallelUploadOptions} [options] Options to upload browser data.
@ -28182,7 +28368,7 @@ var BlockBlobClient = /** @class */ (function (_super) {
BlockBlobClient.prototype.uploadBrowserData = function (browserData, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, browserBlob_1, e_29;
var _a, span, spanOptions, browserBlob_2, e_29;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -28190,10 +28376,8 @@ var BlockBlobClient = /** @class */ (function (_super) {
_b.label = 1;
case 1:
_b.trys.push([1, 3, 4, 5]);
browserBlob_1 = new Blob([browserData]);
return [4 /*yield*/, this.uploadSeekableBlob(function (offset, size) {
return browserBlob_1.slice(offset, offset + size);
}, browserBlob_1.size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
browserBlob_2 = new Blob([browserData]);
return [4 /*yield*/, this.uploadSeekableInternal(function (offset, size) { return browserBlob_2.slice(offset, offset + size); }, browserBlob_2.size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_29 = _b.sent();
@ -28211,22 +28395,22 @@ var BlockBlobClient = /** @class */ (function (_super) {
});
};
/**
* ONLY AVAILABLE IN BROWSERS.
*
* Uploads a browser {@link Blob} object to block blob. Requires a blobFactory as the data source,
* which need to return a {@link Blob} object with the offset and size provided.
* Uploads data to block blob. Requires a bodyFactory as the data source,
* which need to return a {@link HttpRequestBody} object with the offset and size provided.
*
* When buffer length <= 256MB, this method will use 1 upload call to finish the upload.
* Otherwise, this method will call stageBlock to upload blocks, and finally call commitBlockList
* When data length is no more than the specifiled {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is
* {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload.
* Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList}
* to commit the block list.
*
* @param {(offset: number, size: number) => Blob} blobFactory
* @param {(offset: number, size: number) => HttpRequestBody} bodyFactory
* @param {number} size size of the data to upload.
* @param {BlockBlobParallelUploadOptions} [options] Options to Upload to Block Blob operation.
* @returns {Promise<BlobUploadCommonResponse>} Response data for the Blob Upload operation.
* @memberof BlockBlobClient
*/
BlockBlobClient.prototype.uploadSeekableBlob = function (blobFactory, size, options) {
BlockBlobClient.prototype.uploadSeekableInternal = function (bodyFactory, size, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, numBlocks_1, blockList_1, blockIDPrefix_1, transferProgress_2, batch, _loop_2, i, e_30;
@ -28264,12 +28448,12 @@ var BlockBlobClient = /** @class */ (function (_super) {
if (!options.conditions) {
options.conditions = {};
}
_a = createSpan("BlockBlobClient-UploadSeekableBlob", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions;
_a = createSpan("BlockBlobClient-uploadSeekableInternal", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions;
_b.label = 1;
case 1:
_b.trys.push([1, 5, 6, 7]);
if (!(size <= options.maxSingleShotSize)) return [3 /*break*/, 3];
return [4 /*yield*/, this.upload(blobFactory(0, size), size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
return [4 /*yield*/, this.upload(bodyFactory(0, size), size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
numBlocks_1 = Math.floor((size - 1) / options.blockSize) + 1;
@ -28292,7 +28476,7 @@ var BlockBlobClient = /** @class */ (function (_super) {
end = i === numBlocks_1 - 1 ? size : start + options.blockSize;
contentLength = end - start;
blockList_1.push(blockID);
return [4 /*yield*/, this.stageBlock(blockID, blobFactory(start, contentLength), contentLength, {
return [4 /*yield*/, this.stageBlock(blockID, bodyFactory(start, contentLength), contentLength, {
abortSignal: options.abortSignal,
conditions: options.conditions,
encryptionScope: options.encryptionScope,
@ -28363,12 +28547,14 @@ var BlockBlobClient = /** @class */ (function (_super) {
return [4 /*yield*/, fsStat(filePath)];
case 2:
size = (_b.sent()).size;
return [4 /*yield*/, this.uploadResetableStream(function (offset, count) {
return fsCreateReadStream(filePath, {
autoClose: true,
end: count ? offset + count - 1 : Infinity,
start: offset
});
return [4 /*yield*/, this.uploadSeekableInternal(function (offset, count) {
return function () {
return fsCreateReadStream(filePath, {
autoClose: true,
end: count ? offset + count - 1 : Infinity,
start: offset
});
};
}, size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 3: return [2 /*return*/, _b.sent()];
case 4:
@ -28476,132 +28662,6 @@ var BlockBlobClient = /** @class */ (function (_super) {
});
});
};
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
*
* Accepts a Node.js Readable stream factory, and uploads in blocks to a block blob.
* The Readable stream factory must returns a Node.js Readable stream starting from the offset defined. The offset
* is the offset in the block blob to be uploaded.
*
* When buffer length <= 256MB, this method will use 1 upload call to finish the upload.
* Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList}
* to commit the block list.
*
* @export
* @param {(offset: number) => NodeJS.ReadableStream} streamFactory Returns a Node.js Readable stream starting
* from the offset defined
* @param {number} size Size of the block blob
* @param {BlockBlobParallelUploadOptions} [options] Options to Upload to Block Blob operation.
* @returns {(Promise<BlobUploadCommonResponse>)} Response data for the Blob Upload operation.
* @memberof BlockBlobClient
*/
BlockBlobClient.prototype.uploadResetableStream = function (streamFactory, size, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, numBlocks_2, blockList_3, blockIDPrefix_3, transferProgress_4, batch, _loop_3, i, e_33;
var _this = this;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!options.blockSize) {
options.blockSize = 0;
}
if (options.blockSize < 0 || options.blockSize > BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES) {
throw new RangeError("blockSize option must be >= 0 and <= " + BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES);
}
if (options.maxSingleShotSize !== 0 && !options.maxSingleShotSize) {
options.maxSingleShotSize = BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES;
}
if (options.maxSingleShotSize < 0 ||
options.maxSingleShotSize > BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES) {
throw new RangeError("maxSingleShotSize option must be >= 0 and <= " + BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES);
}
if (options.blockSize === 0) {
if (size > BLOCK_BLOB_MAX_BLOCKS * BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES) {
throw new RangeError(size + " is too larger to upload to a block blob.");
}
if (size > options.maxSingleShotSize) {
options.blockSize = Math.ceil(size / BLOCK_BLOB_MAX_BLOCKS);
if (options.blockSize < DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES) {
options.blockSize = DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES;
}
}
}
if (!options.blobHTTPHeaders) {
options.blobHTTPHeaders = {};
}
if (!options.conditions) {
options.conditions = {};
}
_a = createSpan("BlockBlobClient-uploadResetableStream", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions;
_b.label = 1;
case 1:
_b.trys.push([1, 6, 7, 8]);
if (!(size <= options.maxSingleShotSize)) return [3 /*break*/, 3];
return [4 /*yield*/, this.upload(function () { return streamFactory(0); }, size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
numBlocks_2 = Math.floor((size - 1) / options.blockSize) + 1;
if (numBlocks_2 > BLOCK_BLOB_MAX_BLOCKS) {
throw new RangeError("The buffer's size is too big or the BlockSize is too small;" +
("the number of blocks must be <= " + BLOCK_BLOB_MAX_BLOCKS));
}
blockList_3 = [];
blockIDPrefix_3 = coreHttp.generateUuid();
transferProgress_4 = 0;
batch = new Batch(options.concurrency);
_loop_3 = function (i) {
batch.addOperation(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
var blockID, start, end, contentLength;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0:
blockID = generateBlockID(blockIDPrefix_3, i);
start = options.blockSize * i;
end = i === numBlocks_2 - 1 ? size : start + options.blockSize;
contentLength = end - start;
blockList_3.push(blockID);
return [4 /*yield*/, this.stageBlock(blockID, function () { return streamFactory(start, contentLength); }, contentLength, {
abortSignal: options.abortSignal,
conditions: options.conditions,
encryptionScope: options.encryptionScope,
tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions })
})];
case 1:
_a.sent();
// Update progress after block is successfully uploaded to server, in case of block trying
transferProgress_4 += contentLength;
if (options.onProgress) {
options.onProgress({ loadedBytes: transferProgress_4 });
}
return [2 /*return*/];
}
});
}); });
};
for (i = 0; i < numBlocks_2; i++) {
_loop_3(i);
}
return [4 /*yield*/, batch.do()];
case 4:
_b.sent();
return [4 /*yield*/, this.commitBlockList(blockList_3, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 5: return [2 /*return*/, _b.sent()];
case 6:
e_33 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_33.message
});
throw e_33;
case 7:
span.end();
return [7 /*endfinally*/];
case 8: return [2 /*return*/];
}
});
});
};
return BlockBlobClient;
}(BlobClient));
/**
@ -28700,7 +28760,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_34;
var _b, span, spanOptions, e_33;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -28725,12 +28785,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_34 = _c.sent();
e_33 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_34.message
message: e_33.message
});
throw e_34;
throw e_33;
case 4:
span.end();
return [7 /*endfinally*/];
@ -28754,7 +28814,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a, _b;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _c, span, spanOptions, conditions, res, e_35;
var _c, span, spanOptions, conditions, res, e_34;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -28769,19 +28829,19 @@ var PageBlobClient = /** @class */ (function (_super) {
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
})];
case 3:
e_35 = _d.sent();
if (((_a = e_35.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") {
e_34 = _d.sent();
if (((_a = e_34.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") {
span.setStatus({
code: api.CanonicalCode.ALREADY_EXISTS,
message: "Expected exception when creating a blob only if it does not already exist."
});
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_35.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_35.response })];
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_34.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_34.response })];
}
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_35.message
message: e_34.message
});
throw e_35;
throw e_34;
case 4:
span.end();
return [7 /*endfinally*/];
@ -28805,7 +28865,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_36;
var _b, span, spanOptions, e_35;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -28830,12 +28890,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_36 = _c.sent();
e_35 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_36.message
message: e_35.message
});
throw e_36;
throw e_35;
case 4:
span.end();
return [7 /*endfinally*/];
@ -28861,7 +28921,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_37;
var _b, span, spanOptions, e_36;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -28891,12 +28951,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_37 = _c.sent();
e_36 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_37.message
message: e_36.message
});
throw e_37;
throw e_36;
case 4:
span.end();
return [7 /*endfinally*/];
@ -28920,7 +28980,7 @@ var PageBlobClient = /** @class */ (function (_super) {
if (offset === void 0) { offset = 0; }
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_38;
var _b, span, spanOptions, e_37;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -28941,12 +29001,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_38 = _c.sent();
e_37 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_38.message
message: e_37.message
});
throw e_38;
throw e_37;
case 4:
span.end();
return [7 /*endfinally*/];
@ -28970,7 +29030,7 @@ var PageBlobClient = /** @class */ (function (_super) {
if (offset === void 0) { offset = 0; }
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_39;
var _b, span, spanOptions, e_38;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -28990,12 +29050,12 @@ var PageBlobClient = /** @class */ (function (_super) {
.then(rangeResponseFromModel)];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_39 = _c.sent();
e_38 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_39.message
message: e_38.message
});
throw e_39;
throw e_38;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29019,7 +29079,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_40;
var _b, span, spanOptions, e_39;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -29040,12 +29100,12 @@ var PageBlobClient = /** @class */ (function (_super) {
.then(rangeResponseFromModel)];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_40 = _c.sent();
e_39 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_40.message
message: e_39.message
});
throw e_40;
throw e_39;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29069,7 +29129,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_41;
var _b, span, spanOptions, e_40;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -29090,12 +29150,12 @@ var PageBlobClient = /** @class */ (function (_super) {
.then(rangeResponseFromModel)];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_41 = _c.sent();
e_40 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_41.message
message: e_40.message
});
throw e_41;
throw e_40;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29117,7 +29177,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_42;
var _b, span, spanOptions, e_41;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -29135,12 +29195,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_42 = _c.sent();
e_41 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_42.message
message: e_41.message
});
throw e_42;
throw e_41;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29163,7 +29223,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_43;
var _b, span, spanOptions, e_42;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -29181,12 +29241,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_43 = _c.sent();
e_42 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_43.message
message: e_42.message
});
throw e_43;
throw e_42;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29213,7 +29273,7 @@ var PageBlobClient = /** @class */ (function (_super) {
var _a;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _b, span, spanOptions, e_44;
var _b, span, spanOptions, e_43;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -29228,12 +29288,12 @@ var PageBlobClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_44 = _c.sent();
e_43 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_44.message
message: e_43.message
});
throw e_44;
throw e_43;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29318,7 +29378,7 @@ var BlobLeaseClient = /** @class */ (function () {
var _a, _b, _c, _d, _e, _f;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _g, span, spanOptions, e_45;
var _g, span, spanOptions, e_44;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
case 0:
@ -29340,12 +29400,12 @@ var BlobLeaseClient = /** @class */ (function () {
})];
case 2: return [2 /*return*/, _h.sent()];
case 3:
e_45 = _h.sent();
e_44 = _h.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_45.message
message: e_44.message
});
throw e_45;
throw e_44;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29369,7 +29429,7 @@ var BlobLeaseClient = /** @class */ (function () {
var _a, _b, _c, _d, _e, _f;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _g, span, spanOptions, response, e_46;
var _g, span, spanOptions, response, e_45;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
case 0:
@ -29392,12 +29452,12 @@ var BlobLeaseClient = /** @class */ (function () {
this._leaseId = proposedLeaseId;
return [2 /*return*/, response];
case 3:
e_46 = _h.sent();
e_45 = _h.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_46.message
message: e_45.message
});
throw e_46;
throw e_45;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29421,7 +29481,7 @@ var BlobLeaseClient = /** @class */ (function () {
var _a, _b, _c, _d, _e, _f;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _g, span, spanOptions, e_47;
var _g, span, spanOptions, e_46;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
case 0:
@ -29441,12 +29501,12 @@ var BlobLeaseClient = /** @class */ (function () {
})];
case 2: return [2 /*return*/, _h.sent()];
case 3:
e_47 = _h.sent();
e_46 = _h.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_47.message
message: e_46.message
});
throw e_47;
throw e_46;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29469,7 +29529,7 @@ var BlobLeaseClient = /** @class */ (function () {
var _a, _b, _c, _d, _e, _f;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _g, span, spanOptions, e_48;
var _g, span, spanOptions, e_47;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
case 0:
@ -29489,12 +29549,12 @@ var BlobLeaseClient = /** @class */ (function () {
})];
case 2: return [2 /*return*/, _h.sent()];
case 3:
e_48 = _h.sent();
e_47 = _h.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_48.message
message: e_47.message
});
throw e_48;
throw e_47;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29520,7 +29580,7 @@ var BlobLeaseClient = /** @class */ (function () {
var _a, _b, _c, _d, _e, _f;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _g, span, spanOptions, operationOptions, e_49;
var _g, span, spanOptions, operationOptions, e_48;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
case 0:
@ -29542,12 +29602,12 @@ var BlobLeaseClient = /** @class */ (function () {
return [4 /*yield*/, this._containerOrBlobOperation.breakLease(operationOptions)];
case 2: return [2 /*return*/, _h.sent()];
case 3:
e_49 = _h.sent();
e_48 = _h.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_49.message
message: e_48.message
});
throw e_49;
throw e_48;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29652,7 +29712,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.create = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_50;
var _a, span, spanOptions, e_49;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -29666,12 +29726,12 @@ var ContainerClient = /** @class */ (function (_super) {
// this will filter out unwanted properties from the response object into result object
return [2 /*return*/, _b.sent()];
case 3:
e_50 = _b.sent();
e_49 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_50.message
message: e_49.message
});
throw e_50;
throw e_49;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29693,7 +29753,7 @@ var ContainerClient = /** @class */ (function (_super) {
var _a, _b;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _c, span, spanOptions, res, e_51;
var _c, span, spanOptions, res, e_50;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -29707,19 +29767,19 @@ var ContainerClient = /** @class */ (function (_super) {
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
})];
case 3:
e_51 = _d.sent();
if (((_a = e_51.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") {
e_50 = _d.sent();
if (((_a = e_50.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") {
span.setStatus({
code: api.CanonicalCode.ALREADY_EXISTS,
message: "Expected exception when creating a container only if it does not already exist."
});
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_51.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_51.response })];
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_50.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_50.response })];
}
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_51.message
message: e_50.message
});
throw e_51;
throw e_50;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29742,7 +29802,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.exists = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_52;
var _a, span, spanOptions, e_51;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -29758,8 +29818,8 @@ var ContainerClient = /** @class */ (function (_super) {
_b.sent();
return [2 /*return*/, true];
case 3:
e_52 = _b.sent();
if (e_52.statusCode === 404) {
e_51 = _b.sent();
if (e_51.statusCode === 404) {
span.setStatus({
code: api.CanonicalCode.NOT_FOUND,
message: "Expected exception when checking container existence"
@ -29768,9 +29828,9 @@ var ContainerClient = /** @class */ (function (_super) {
}
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_52.message
message: e_51.message
});
throw e_52;
throw e_51;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29845,7 +29905,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.getProperties = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_53;
var _a, span, spanOptions, e_52;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -29859,12 +29919,12 @@ var ContainerClient = /** @class */ (function (_super) {
return [4 /*yield*/, this.containerContext.getProperties(tslib.__assign(tslib.__assign({ abortSignal: options.abortSignal }, options.conditions), { spanOptions: spanOptions }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_53 = _b.sent();
e_52 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_53.message
message: e_52.message
});
throw e_53;
throw e_52;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29885,7 +29945,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.delete = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_54;
var _a, span, spanOptions, e_53;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -29904,12 +29964,12 @@ var ContainerClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_54 = _b.sent();
e_53 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_54.message
message: e_53.message
});
throw e_54;
throw e_53;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29931,7 +29991,7 @@ var ContainerClient = /** @class */ (function (_super) {
var _a, _b;
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _c, span, spanOptions, res, e_55;
var _c, span, spanOptions, res, e_54;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -29945,19 +30005,19 @@ var ContainerClient = /** @class */ (function (_super) {
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
})];
case 3:
e_55 = _d.sent();
if (((_a = e_55.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") {
e_54 = _d.sent();
if (((_a = e_54.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") {
span.setStatus({
code: api.CanonicalCode.NOT_FOUND,
message: "Expected exception when deleting a container only if it exists."
});
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_55.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_55.response })];
return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_54.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_54.response })];
}
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_55.message
message: e_54.message
});
throw e_55;
throw e_54;
case 4:
span.end();
return [7 /*endfinally*/];
@ -29983,7 +30043,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.setMetadata = function (metadata, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_56;
var _a, span, spanOptions, e_55;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30006,12 +30066,12 @@ var ContainerClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_56 = _b.sent();
e_55 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_56.message
message: e_55.message
});
throw e_56;
throw e_55;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30036,7 +30096,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.getAccessPolicy = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, response, res, _i, response_1, identifier, accessPolicy, e_57;
var _a, span, spanOptions, response, res, _i, response_1, identifier, accessPolicy, e_56;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30087,12 +30147,12 @@ var ContainerClient = /** @class */ (function (_super) {
}
return [2 /*return*/, res];
case 3:
e_57 = _b.sent();
e_56 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_57.message
message: e_56.message
});
throw e_57;
throw e_56;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30123,7 +30183,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.setAccessPolicy = function (access, containerAcl, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, acl, _i, _b, identifier, e_58;
var _a, span, spanOptions, acl, _i, _b, identifier, e_57;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
@ -30158,12 +30218,12 @@ var ContainerClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _c.sent()];
case 3:
e_58 = _c.sent();
e_57 = _c.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_58.message
message: e_57.message
});
throw e_58;
throw e_57;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30208,7 +30268,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.uploadBlockBlob = function (blobName, body, contentLength, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, blockBlobClient, response, e_59;
var _a, span, spanOptions, blockBlobClient, response, e_58;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30225,12 +30285,12 @@ var ContainerClient = /** @class */ (function (_super) {
response: response
}];
case 3:
e_59 = _b.sent();
e_58 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_59.message
message: e_58.message
});
throw e_59;
throw e_58;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30254,7 +30314,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.deleteBlob = function (blobName, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, blobClient, e_60;
var _a, span, spanOptions, blobClient, e_59;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30269,12 +30329,12 @@ var ContainerClient = /** @class */ (function (_super) {
return [4 /*yield*/, blobClient.delete(tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_60 = _b.sent();
e_59 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_60.message
message: e_59.message
});
throw e_60;
throw e_59;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30298,7 +30358,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.listBlobFlatSegment = function (marker, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, response, wrappedResponse, e_61;
var _a, span, spanOptions, response, wrappedResponse, e_60;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30315,12 +30375,12 @@ var ContainerClient = /** @class */ (function (_super) {
}) }) });
return [2 /*return*/, wrappedResponse];
case 3:
e_61 = _b.sent();
e_60 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_61.message
message: e_60.message
});
throw e_61;
throw e_60;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30345,7 +30405,7 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.listBlobHierarchySegment = function (delimiter, marker, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, response, wrappedResponse, e_62;
var _a, span, spanOptions, response, wrappedResponse, e_61;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -30362,12 +30422,12 @@ var ContainerClient = /** @class */ (function (_super) {
}) }) });
return [2 /*return*/, wrappedResponse];
case 3:
e_62 = _b.sent();
e_61 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_62.message
message: e_61.message
});
throw e_62;
throw e_61;
case 4:
span.end();
return [7 /*endfinally*/];
@ -30429,8 +30489,8 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.listItems = function (options) {
if (options === void 0) { options = {}; }
return tslib.__asyncGenerator(this, arguments, function listItems_1() {
var marker, _a, _b, listBlobsFlatSegmentResponse, e_63_1;
var e_63, _c;
var marker, _a, _b, listBlobsFlatSegmentResponse, e_62_1;
var e_62, _c;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -30449,8 +30509,8 @@ var ContainerClient = /** @class */ (function (_super) {
case 5: return [3 /*break*/, 1];
case 6: return [3 /*break*/, 13];
case 7:
e_63_1 = _d.sent();
e_63 = { error: e_63_1 };
e_62_1 = _d.sent();
e_62 = { error: e_62_1 };
return [3 /*break*/, 13];
case 8:
_d.trys.push([8, , 11, 12]);
@ -30461,7 +30521,7 @@ var ContainerClient = /** @class */ (function (_super) {
_d.label = 10;
case 10: return [3 /*break*/, 12];
case 11:
if (e_63) throw e_63.error;
if (e_62) throw e_62.error;
return [7 /*endfinally*/];
case 12: return [7 /*endfinally*/];
case 13: return [2 /*return*/];
@ -30650,8 +30710,8 @@ var ContainerClient = /** @class */ (function (_super) {
ContainerClient.prototype.listItemsByHierarchy = function (delimiter, options) {
if (options === void 0) { options = {}; }
return tslib.__asyncGenerator(this, arguments, function listItemsByHierarchy_1() {
var marker, _a, _b, listBlobsHierarchySegmentResponse, segment, _i, _c, prefix, _d, _e, blob, e_64_1;
var e_64, _f;
var marker, _a, _b, listBlobsHierarchySegmentResponse, segment, _i, _c, prefix, _d, _e, blob, e_63_1;
var e_63, _f;
return tslib.__generator(this, function (_g) {
switch (_g.label) {
case 0:
@ -30694,8 +30754,8 @@ var ContainerClient = /** @class */ (function (_super) {
case 12: return [3 /*break*/, 1];
case 13: return [3 /*break*/, 20];
case 14:
e_64_1 = _g.sent();
e_64 = { error: e_64_1 };
e_63_1 = _g.sent();
e_63 = { error: e_63_1 };
return [3 /*break*/, 20];
case 15:
_g.trys.push([15, , 18, 19]);
@ -30706,7 +30766,7 @@ var ContainerClient = /** @class */ (function (_super) {
_g.label = 17;
case 17: return [3 /*break*/, 19];
case 18:
if (e_64) throw e_64.error;
if (e_63) throw e_63.error;
return [7 /*endfinally*/];
case 19: return [7 /*endfinally*/];
case 20: return [2 /*return*/];
@ -31813,6 +31873,48 @@ var BlobServiceClient = /** @class */ (function (_super) {
});
});
};
/**
* Restore a previously deleted Blob container.
* This API is only functional if Container Soft Delete is enabled for the storage account associated with the container.
*
* @param {string} deletedContainerName Name of the previously deleted container.
* @param {string} deletedContainerVersion Version of the previously deleted container, used to uniquely identify the deleted container.
* @returns {Promise<ContainerUndeleteResponse>} Container deletion response.
* @memberof BlobServiceClient
*/
BlobServiceClient.prototype.undeleteContainer = function (deletedContainerName, deletedContainerVersion, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, containerClient, containerContext, containerUndeleteResponse, e_3;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = createSpan("BlobServiceClient-undeleteContainer", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions;
_b.label = 1;
case 1:
_b.trys.push([1, 3, 4, 5]);
containerClient = this.getContainerClient(options.destinationContainerName || deletedContainerName);
containerContext = new Container(containerClient["storageClientContext"]);
return [4 /*yield*/, containerContext.restore(tslib.__assign(tslib.__assign({ deletedContainerName: deletedContainerName,
deletedContainerVersion: deletedContainerVersion }, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))];
case 2:
containerUndeleteResponse = _b.sent();
return [2 /*return*/, { containerClient: containerClient, containerUndeleteResponse: containerUndeleteResponse }];
case 3:
e_3 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_3.message
});
throw e_3;
case 4:
span.end();
return [7 /*endfinally*/];
case 5: return [2 /*return*/];
}
});
});
};
/**
* Gets the properties of a storage accounts Blob service, including properties
* for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
@ -31825,7 +31927,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.getProperties = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_3;
var _a, span, spanOptions, e_4;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -31839,12 +31941,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_3 = _b.sent();
e_4 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_3.message
message: e_4.message
});
throw e_3;
throw e_4;
case 4:
span.end();
return [7 /*endfinally*/];
@ -31866,7 +31968,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.setProperties = function (properties, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_4;
var _a, span, spanOptions, e_5;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -31880,12 +31982,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_4 = _b.sent();
e_5 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_4.message
message: e_5.message
});
throw e_4;
throw e_5;
case 4:
span.end();
return [7 /*endfinally*/];
@ -31907,7 +32009,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.getStatistics = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_5;
var _a, span, spanOptions, e_6;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -31921,12 +32023,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_5 = _b.sent();
e_6 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_5.message
message: e_6.message
});
throw e_5;
throw e_6;
case 4:
span.end();
return [7 /*endfinally*/];
@ -31949,7 +32051,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.getAccountInfo = function (options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_6;
var _a, span, spanOptions, e_7;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -31963,12 +32065,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_6 = _b.sent();
e_7 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_6.message
message: e_7.message
});
throw e_6;
throw e_7;
case 4:
span.end();
return [7 /*endfinally*/];
@ -31983,9 +32085,9 @@ var BlobServiceClient = /** @class */ (function (_super) {
*
* @param {string} [marker] A string value that identifies the portion of
* the list of containers to be returned with the next listing operation. The
* operation returns the NextMarker value within the response body if the
* operation returns the continuationToken value within the response body if the
* listing operation did not return all containers remaining to be listed
* with the current page. The NextMarker value can be used as the value for
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param {ServiceListContainersSegmentOptions} [options] Options to the Service List Container Segment operation.
@ -31995,7 +32097,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.listContainersSegment = function (marker, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_7;
var _a, span, spanOptions, e_8;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -32006,12 +32108,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
return [4 /*yield*/, this.serviceContext.listContainersSegment(tslib.__assign(tslib.__assign({ abortSignal: options.abortSignal, marker: marker }, options), { include: typeof options.include === "string" ? [options.include] : options.include, spanOptions: spanOptions }))];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_7 = _b.sent();
e_8 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_7.message
message: e_8.message
});
throw e_7;
throw e_8;
case 4:
span.end();
return [7 /*endfinally*/];
@ -32032,9 +32134,9 @@ var BlobServiceClient = /** @class */ (function (_super) {
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param {string} [marker] A string value that identifies the portion of
* the list of blobs to be returned with the next listing operation. The
* operation returns the NextMarker value within the response body if the
* operation returns the continuationToken value within the response body if the
* listing operation did not return all blobs remaining to be listed
* with the current page. The NextMarker value can be used as the value for
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param {ServiceFindBlobsByTagsSegmentOptions} [options={}] Options to find blobs by tags.
@ -32044,7 +32146,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.findBlobsByTagsSegment = function (tagFilterSqlExpression, marker, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, e_8;
var _a, span, spanOptions, e_9;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -32061,12 +32163,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
})];
case 2: return [2 /*return*/, _b.sent()];
case 3:
e_8 = _b.sent();
e_9 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_8.message
message: e_9.message
});
throw e_8;
throw e_9;
case 4:
span.end();
return [7 /*endfinally*/];
@ -32085,9 +32187,9 @@ var BlobServiceClient = /** @class */ (function (_super) {
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param {string} [marker] A string value that identifies the portion of
* the list of blobs to be returned with the next listing operation. The
* operation returns the NextMarker value within the response body if the
* operation returns the continuationToken value within the response body if the
* listing operation did not return all blobs remaining to be listed
* with the current page. The NextMarker value can be used as the value for
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param {ServiceFindBlobsByTagsSegmentOptions} [options={}] Options to find blobs by tags.
@ -32136,8 +32238,8 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.findBlobsByTagsItems = function (tagFilterSqlExpression, options) {
if (options === void 0) { options = {}; }
return tslib.__asyncGenerator(this, arguments, function findBlobsByTagsItems_1() {
var marker, _a, _b, segment, e_9_1;
var e_9, _c;
var marker, _a, _b, segment, e_10_1;
var e_10, _c;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -32156,8 +32258,8 @@ var BlobServiceClient = /** @class */ (function (_super) {
case 5: return [3 /*break*/, 1];
case 6: return [3 /*break*/, 13];
case 7:
e_9_1 = _d.sent();
e_9 = { error: e_9_1 };
e_10_1 = _d.sent();
e_10 = { error: e_10_1 };
return [3 /*break*/, 13];
case 8:
_d.trys.push([8, , 11, 12]);
@ -32168,7 +32270,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
_d.label = 10;
case 10: return [3 /*break*/, 12];
case 11:
if (e_9) throw e_9.error;
if (e_10) throw e_10.error;
return [7 /*endfinally*/];
case 12: return [7 /*endfinally*/];
case 13: return [2 /*return*/];
@ -32293,9 +32395,9 @@ var BlobServiceClient = /** @class */ (function (_super) {
* @private
* @param {string} [marker] A string value that identifies the portion of
* the list of containers to be returned with the next listing operation. The
* operation returns the NextMarker value within the response body if the
* operation returns the continuationToken value within the response body if the
* listing operation did not return all containers remaining to be listed
* with the current page. The NextMarker value can be used as the value for
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param {ServiceListContainersSegmentOptions} [options] Options to list containers operation.
@ -32342,8 +32444,8 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.listItems = function (options) {
if (options === void 0) { options = {}; }
return tslib.__asyncGenerator(this, arguments, function listItems_1() {
var marker, _a, _b, segment, e_10_1;
var e_10, _c;
var marker, _a, _b, segment, e_11_1;
var e_11, _c;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
@ -32362,8 +32464,8 @@ var BlobServiceClient = /** @class */ (function (_super) {
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 };
e_11_1 = _d.sent();
e_11 = { error: e_11_1 };
return [3 /*break*/, 13];
case 8:
_d.trys.push([8, , 11, 12]);
@ -32374,7 +32476,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
_d.label = 10;
case 10: return [3 /*break*/, 12];
case 11:
if (e_10) throw e_10.error;
if (e_11) throw e_11.error;
return [7 /*endfinally*/];
case 12: return [7 /*endfinally*/];
case 13: return [2 /*return*/];
@ -32464,8 +32566,15 @@ var BlobServiceClient = /** @class */ (function (_super) {
if (options.prefix === "") {
options.prefix = undefined;
}
var include = [];
if (options.includeDeleted) {
include.push("deleted");
}
if (options.includeMetadata) {
include.push("metadata");
}
// AsyncIterableIterator to iterate over containers
var listSegmentOptions = tslib.__assign(tslib.__assign({}, options), (options.includeMetadata ? { include: "metadata" } : {}));
var listSegmentOptions = tslib.__assign(tslib.__assign({}, options), (include.length > 0 ? { include: include } : {}));
var iter = this.listItems(listSegmentOptions);
return _a = {
/**
@ -32506,7 +32615,7 @@ var BlobServiceClient = /** @class */ (function (_super) {
BlobServiceClient.prototype.getUserDelegationKey = function (startsOn, expiresOn, options) {
if (options === void 0) { options = {}; }
return tslib.__awaiter(this, void 0, void 0, function () {
var _a, span, spanOptions, response, userDelegationKey, res, e_11;
var _a, span, spanOptions, response, userDelegationKey, res, e_12;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0:
@ -32535,12 +32644,12 @@ var BlobServiceClient = /** @class */ (function (_super) {
res = tslib.__assign({ _response: response._response, requestId: response.requestId, clientRequestId: response.clientRequestId, version: response.version, date: response.date, errorCode: response.errorCode }, userDelegationKey);
return [2 /*return*/, res];
case 3:
e_11 = _b.sent();
e_12 = _b.sent();
span.setStatus({
code: api.CanonicalCode.UNKNOWN,
message: e_11.message
message: e_12.message
});
throw e_11;
throw e_12;
case 4:
span.end();
return [7 /*endfinally*/];
@ -32996,52 +33105,61 @@ function ipRangeToString(ipRange) {
* @class SASQueryParameters
*/
var SASQueryParameters = /** @class */ (function () {
/**
* Creates an instance of SASQueryParameters.
*
* @param {string} version Representing the storage version
* @param {string} signature Representing the signature for the SAS token
* @param {string} [permissions] Representing the storage permissions
* @param {string} [services] Representing the storage services being accessed (only for Account SAS)
* @param {string} [resourceTypes] Representing the storage resource types being accessed (only for Account SAS)
* @param {SASProtocol} [protocol] Representing the allowed HTTP protocol(s)
* @param {Date} [startsOn] Representing the start time for this SAS token
* @param {Date} [expiresOn] Representing the expiry time for this SAS token
* @param {SasIPRange} [ipRange] Representing the range of valid IP addresses for this SAS token
* @param {string} [identifier] Representing the signed identifier (only for Service SAS)
* @param {string} [resource] Representing the storage container or blob (only for Service SAS)
* @param {string} [cacheControl] Representing the cache-control header (only for Blob/File Service SAS)
* @param {string} [contentDisposition] Representing the content-disposition header (only for Blob/File Service SAS)
* @param {string} [contentEncoding] Representing the content-encoding header (only for Blob/File Service SAS)
* @param {string} [contentLanguage] Representing the content-language header (only for Blob/File Service SAS)
* @param {string} [contentType] Representing the content-type header (only for Blob/File Service SAS)
* @param {userDelegationKey} [userDelegationKey] Representing the user delegation key properties
* @memberof SASQueryParameters
*/
function SASQueryParameters(version, signature, permissions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey) {
function SASQueryParameters(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, preauthorizedAgentObjectId, correlationId) {
this.version = version;
this.services = services;
this.resourceTypes = resourceTypes;
this.expiresOn = expiresOn;
this.permissions = permissions;
this.protocol = protocol;
this.startsOn = startsOn;
this.ipRangeInner = ipRange;
this.identifier = identifier;
this.resource = resource;
this.signature = signature;
this.cacheControl = cacheControl;
this.contentDisposition = contentDisposition;
this.contentEncoding = contentEncoding;
this.contentLanguage = contentLanguage;
this.contentType = contentType;
if (userDelegationKey) {
this.signedOid = userDelegationKey.signedObjectId;
this.signedTenantId = userDelegationKey.signedTenantId;
this.signedStartsOn = userDelegationKey.signedStartsOn;
this.signedExpiresOn = userDelegationKey.signedExpiresOn;
this.signedService = userDelegationKey.signedService;
this.signedVersion = userDelegationKey.signedVersion;
if (permissionsOrOptions !== undefined && typeof permissionsOrOptions !== "string") {
// SASQueryParametersOptions
this.permissions = permissionsOrOptions.permissions;
this.services = permissionsOrOptions.services;
this.resourceTypes = permissionsOrOptions.resourceTypes;
this.protocol = permissionsOrOptions.protocol;
this.startsOn = permissionsOrOptions.startsOn;
this.expiresOn = permissionsOrOptions.expiresOn;
this.ipRangeInner = permissionsOrOptions.ipRange;
this.identifier = permissionsOrOptions.identifier;
this.resource = permissionsOrOptions.resource;
this.cacheControl = permissionsOrOptions.cacheControl;
this.contentDisposition = permissionsOrOptions.contentDisposition;
this.contentEncoding = permissionsOrOptions.contentEncoding;
this.contentLanguage = permissionsOrOptions.contentLanguage;
this.contentType = permissionsOrOptions.contentType;
if (permissionsOrOptions.userDelegationKey) {
this.signedOid = permissionsOrOptions.userDelegationKey.signedObjectId;
this.signedTenantId = permissionsOrOptions.userDelegationKey.signedTenantId;
this.signedStartsOn = permissionsOrOptions.userDelegationKey.signedStartsOn;
this.signedExpiresOn = permissionsOrOptions.userDelegationKey.signedExpiresOn;
this.signedService = permissionsOrOptions.userDelegationKey.signedService;
this.signedVersion = permissionsOrOptions.userDelegationKey.signedVersion;
this.preauthorizedAgentObjectId = permissionsOrOptions.preauthorizedAgentObjectId;
this.correlationId = permissionsOrOptions.correlationId;
}
}
else {
this.services = services;
this.resourceTypes = resourceTypes;
this.expiresOn = expiresOn;
this.permissions = permissionsOrOptions;
this.protocol = protocol;
this.startsOn = startsOn;
this.ipRangeInner = ipRange;
this.identifier = identifier;
this.resource = resource;
this.cacheControl = cacheControl;
this.contentDisposition = contentDisposition;
this.contentEncoding = contentEncoding;
this.contentLanguage = contentLanguage;
this.contentType = contentType;
if (userDelegationKey) {
this.signedOid = userDelegationKey.signedObjectId;
this.signedTenantId = userDelegationKey.signedTenantId;
this.signedStartsOn = userDelegationKey.signedStartsOn;
this.signedExpiresOn = userDelegationKey.signedExpiresOn;
this.signedService = userDelegationKey.signedService;
this.signedVersion = userDelegationKey.signedVersion;
this.preauthorizedAgentObjectId = preauthorizedAgentObjectId;
this.correlationId = correlationId;
}
}
}
Object.defineProperty(SASQueryParameters.prototype, "ipRange", {
@ -33093,7 +33211,9 @@ var SASQueryParameters = /** @class */ (function () {
"rscd",
"rsce",
"rscl",
"rsct"
"rsct",
"saoid",
"scid"
];
var queries = [];
for (var _i = 0, params_1 = params; _i < params_1.length; _i++) {
@ -33165,6 +33285,12 @@ var SASQueryParameters = /** @class */ (function () {
case "rsct":
this.tryAppendQueryParameter(queries, param, this.contentType);
break;
case "saoid":
this.tryAppendQueryParameter(queries, param, this.preauthorizedAgentObjectId);
break;
case "scid":
this.tryAppendQueryParameter(queries, param, this.correlationId);
break;
}
}
return queries.join("&");
@ -33311,6 +33437,20 @@ var BlobSASPermissions = /** @class */ (function () {
* @memberof BlobSASPermissions
*/
this.tag = false;
/**
* Specifies Move access granted.
*
* @type {boolean}
* @memberof BlobSASPermissions
*/
this.move = false;
/**
* Specifies Execute access granted.
*
* @type {boolean}
* @memberof BlobSASPermissions
*/
this.execute = false;
}
/**
* Creates a {@link BlobSASPermissions} from the specified permissions string. This method will throw an
@ -33347,6 +33487,12 @@ var BlobSASPermissions = /** @class */ (function () {
case "t":
blobSASPermissions.tag = true;
break;
case "m":
blobSASPermissions.move = true;
break;
case "e":
blobSASPermissions.execute = true;
break;
default:
throw new RangeError("Invalid permission: " + char);
}
@ -33383,6 +33529,12 @@ var BlobSASPermissions = /** @class */ (function () {
if (this.tag) {
permissions.push("t");
}
if (this.move) {
permissions.push("m");
}
if (this.execute) {
permissions.push("e");
}
return permissions.join("");
};
return BlobSASPermissions;
@ -33458,6 +33610,20 @@ var ContainerSASPermissions = /** @class */ (function () {
* @memberof ContainerSASPermissions
*/
this.tag = false;
/**
* Specifies Move access granted.
*
* @type {boolean}
* @memberof ContainerSASPermissions
*/
this.move = false;
/**
* Specifies Execute access granted.
*
* @type {boolean}
* @memberof ContainerSASPermissions
*/
this.execute = false;
}
/**
* Creates an {@link ContainerSASPermissions} from the specified permissions string. This method will throw an
@ -33497,6 +33663,12 @@ var ContainerSASPermissions = /** @class */ (function () {
case "x":
containerSASPermissions.deleteVersion = true;
break;
case "m":
containerSASPermissions.move = true;
break;
case "e":
containerSASPermissions.execute = true;
break;
default:
throw new RangeError("Invalid permission " + char);
}
@ -33539,6 +33711,12 @@ var ContainerSASPermissions = /** @class */ (function () {
if (this.tag) {
permissions.push("t");
}
if (this.move) {
permissions.push("m");
}
if (this.execute) {
permissions.push("e");
}
return permissions.join("");
};
return ContainerSASPermissions;
@ -33602,7 +33780,13 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent
return generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential);
}
else {
return generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential);
// Version 2020-02-10 delegation SAS signature construction includes preauthorizedAgentObjectId, agentObjectId, correlationId.
if (version >= "2020-02-10") {
return generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential);
}
else {
return generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential);
}
}
}
if (version >= "2015-04-05") {
@ -33633,34 +33817,18 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent
* @returns {SASQueryParameters}
*/
function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
if (!blobSASSignatureValues.identifier &&
!blobSASSignatureValues.permissions &&
!blobSASSignatureValues.expiresOn) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided.");
}
var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION;
var resource = "c";
var verifiedPermissions;
if (blobSASSignatureValues.snapshotTime) {
throw RangeError("'version' must be >= '2018-11-09' when provided 'snapshotTime'.");
}
if (blobSASSignatureValues.versionId) {
throw RangeError("'version' must be >= '2019-10-10' when provided 'versionId'.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.deleteVersion &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission.");
}
if (blobSASSignatureValues.blobName) {
resource = "b";
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
var verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
@ -33682,7 +33850,7 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe
blobSASSignatureValues.identifier,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
version,
blobSASSignatureValues.version,
blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "",
blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "",
blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "",
@ -33690,7 +33858,7 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : ""
].join("\n");
var signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
@ -33710,33 +33878,13 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe
* @returns {SASQueryParameters}
*/
function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
if (!blobSASSignatureValues.identifier &&
!blobSASSignatureValues.permissions &&
!blobSASSignatureValues.expiresOn) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided.");
}
var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION;
var resource = "c";
var verifiedPermissions;
if (blobSASSignatureValues.versionId && version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'versionId'.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.deleteVersion &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission.");
}
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) {
throw RangeError("Must provide 'blobName' when provided 'snapshotTime'.");
}
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) {
throw RangeError("Must provide 'blobName' when provided 'versionId'.");
}
var timestamp = blobSASSignatureValues.snapshotTime;
if (blobSASSignatureValues.blobName) {
resource = "b";
@ -33749,6 +33897,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
}
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
var verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
@ -33770,7 +33919,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
blobSASSignatureValues.identifier,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
version,
blobSASSignatureValues.version,
resource,
timestamp,
blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "",
@ -33780,7 +33929,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : ""
].join("\n");
var signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
@ -33789,7 +33938,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
* Creates an instance of SASQueryParameters.
*
* Only accepts required settings needed to create a SAS. For optional settings please
* set corresponding properties directly, such as permissions, startsOn and identifier.
* set corresponding properties directly, such as permissions, startsOn.
*
* WARNING: identifier will be ignored, permissions and expiresOn are required.
*
@ -33798,31 +33947,12 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
* @returns {SASQueryParameters}
*/
function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
// Stored access policies are not supported for a user delegation SAS.
if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS.");
}
var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION;
if (blobSASSignatureValues.versionId && version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'versionId'.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.deleteVersion &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission.");
}
var resource = "c";
var verifiedPermissions;
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) {
throw RangeError("Must provide 'blobName' when provided 'snapshotTime'.");
}
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) {
throw RangeError("Must provide 'blobName' when provided 'versionId'.");
}
var timestamp = blobSASSignatureValues.snapshotTime;
if (blobSASSignatureValues.blobName) {
resource = "b";
@ -33835,6 +33965,7 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD
}
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
var verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
@ -33865,7 +33996,7 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD
userDelegationKeyCredential.userDelegationKey.signedVersion,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
version,
blobSASSignatureValues.version,
resource,
timestamp,
blobSASSignatureValues.cacheControl,
@ -33875,7 +34006,87 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD
blobSASSignatureValues.contentType
].join("\n");
var signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
* IMPLEMENTATION FOR API VERSION FROM 2020-02-10.
*
* Creates an instance of SASQueryParameters.
*
* Only accepts required settings needed to create a SAS. For optional settings please
* set corresponding properties directly, such as permissions, startsOn.
*
* WARNING: identifier will be ignored, permissions and expiresOn are required.
*
* @param {BlobSASSignatureValues} blobSASSignatureValues
* @param {UserDelegationKeyCredential} userDelegationKeyCredential
* @returns {SASQueryParameters}
*/
function generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
// Stored access policies are not supported for a user delegation SAS.
if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS.");
}
var resource = "c";
var timestamp = blobSASSignatureValues.snapshotTime;
if (blobSASSignatureValues.blobName) {
resource = "b";
if (blobSASSignatureValues.snapshotTime) {
resource = "bs";
}
else if (blobSASSignatureValues.versionId) {
resource = "bv";
timestamp = blobSASSignatureValues.versionId;
}
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
var verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
else {
verifiedPermissions = ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
}
// Signature is generated on the un-url-encoded values.
var stringToSign = [
verifiedPermissions ? verifiedPermissions : "",
blobSASSignatureValues.startsOn
? truncatedISO8061Date(blobSASSignatureValues.startsOn, false)
: "",
blobSASSignatureValues.expiresOn
? truncatedISO8061Date(blobSASSignatureValues.expiresOn, false)
: "",
getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName),
userDelegationKeyCredential.userDelegationKey.signedObjectId,
userDelegationKeyCredential.userDelegationKey.signedTenantId,
userDelegationKeyCredential.userDelegationKey.signedStartsOn
? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false)
: "",
userDelegationKeyCredential.userDelegationKey.signedExpiresOn
? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false)
: "",
userDelegationKeyCredential.userDelegationKey.signedService,
userDelegationKeyCredential.userDelegationKey.signedVersion,
blobSASSignatureValues.preauthorizedAgentObjectId,
undefined,
blobSASSignatureValues.correlationId,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
blobSASSignatureValues.version,
resource,
timestamp,
blobSASSignatureValues.cacheControl,
blobSASSignatureValues.contentDisposition,
blobSASSignatureValues.contentEncoding,
blobSASSignatureValues.contentLanguage,
blobSASSignatureValues.contentType
].join("\n");
var signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId);
}
function getCanonicalName(accountName, containerName, blobName) {
// Container: "/blob/account/containerName"
@ -33886,6 +34097,42 @@ function getCanonicalName(accountName, containerName, blobName) {
}
return elements.join("");
}
function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) {
var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION;
if (blobSASSignatureValues.snapshotTime && version < "2018-11-09") {
throw RangeError("'version' must be >= '2018-11-09' when providing 'snapshotTime'.");
}
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) {
throw RangeError("Must provide 'blobName' when providing 'snapshotTime'.");
}
if (blobSASSignatureValues.versionId && version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when providing 'versionId'.");
}
if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) {
throw RangeError("Must provide 'blobName' when providing 'versionId'.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.deleteVersion &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when providing 'x' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
throw RangeError("'version' must be >= '2019-12-12' when providing 't' permission.");
}
if (version < "2020-02-10" &&
blobSASSignatureValues.permissions &&
(blobSASSignatureValues.permissions.move || blobSASSignatureValues.permissions.execute)) {
throw RangeError("'version' must be >= '2020-02-10' when providing the 'm' or 'e' permission.");
}
if (version < "2020-02-10" &&
(blobSASSignatureValues.preauthorizedAgentObjectId || blobSASSignatureValues.correlationId)) {
throw RangeError("'version' must be >= '2020-02-10' when providing 'preauthorizedAgentObjectId' or 'correlationId'.");
}
blobSASSignatureValues.version = version;
return blobSASSignatureValues;
}
Object.defineProperty(exports, 'BaseRequestPolicy', {
enumerable: true,
@ -33972,10 +34219,20 @@ exports.newPipeline = newPipeline;
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert = __webpack_require__(357);
const path = __webpack_require__(622);
const pathHelper = __webpack_require__(972);
const path = __importStar(__webpack_require__(622));
const pathHelper = __importStar(__webpack_require__(972));
const assert_1 = __importDefault(__webpack_require__(357));
const IS_WINDOWS = process.platform === 'win32';
/**
* Helper class for parsing paths into segments
@ -33989,7 +34246,7 @@ class Path {
this.segments = [];
// String
if (typeof itemPath === 'string') {
assert(itemPath, `Parameter 'itemPath' must not be empty`);
assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`);
// Normalize slashes and trim unnecessary trailing slash
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
// Not rooted
@ -34016,24 +34273,24 @@ class Path {
// Array
else {
// Must not be empty
assert(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
// Each segment
for (let i = 0; i < itemPath.length; i++) {
let segment = itemPath[i];
// Must not be empty
assert(segment, `Parameter 'itemPath' must not contain any empty segments`);
assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`);
// Normalize slashes
segment = pathHelper.normalizeSeparators(itemPath[i]);
// Root segment
if (i === 0 && pathHelper.hasRoot(segment)) {
segment = pathHelper.safeTrimTrailingSeparator(segment);
assert(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
this.segments.push(segment);
}
// All other segments
else {
// Must not contain slash
assert(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
this.segments.push(segment);
}
}
@ -41207,8 +41464,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const pathHelper = __webpack_require__(972);
const pathHelper = __importStar(__webpack_require__(972));
const internal_match_kind_1 = __webpack_require__(327);
const IS_WINDOWS = process.platform === 'win32';
/**
@ -41290,8 +41554,15 @@ exports.partialMatch = partialMatch;
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __webpack_require__(470);
const core = __importStar(__webpack_require__(470));
/**
* Returns a copy with defaults filled in.
*/
@ -49621,17 +49892,27 @@ __exportStar(__webpack_require__(764), exports);
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert = __webpack_require__(357);
const os = __webpack_require__(87);
const path = __webpack_require__(622);
const pathHelper = __webpack_require__(972);
const os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622));
const pathHelper = __importStar(__webpack_require__(972));
const assert_1 = __importDefault(__webpack_require__(357));
const minimatch_1 = __webpack_require__(93);
const internal_match_kind_1 = __webpack_require__(327);
const internal_path_1 = __webpack_require__(383);
const IS_WINDOWS = process.platform === 'win32';
class Pattern {
constructor(patternOrNegate, segments) {
constructor(patternOrNegate, segments, homedir) {
/**
* Indicates whether matches should be excluded from the result set
*/
@ -49645,9 +49926,9 @@ class Pattern {
else {
// Convert to pattern
segments = segments || [];
assert(segments.length, `Parameter 'segments' must not empty`);
assert_1.default(segments.length, `Parameter 'segments' must not empty`);
const root = Pattern.getLiteral(segments[0]);
assert(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
pattern = new internal_path_1.Path(segments).toString().trim();
if (patternOrNegate) {
pattern = `!${pattern}`;
@ -49659,7 +49940,7 @@ class Pattern {
pattern = pattern.substr(1).trim();
}
// Normalize slashes and ensures absolute root
pattern = Pattern.fixupPattern(pattern);
pattern = Pattern.fixupPattern(pattern, homedir);
// Segments
this.segments = new internal_path_1.Path(pattern).segments;
// Trailing slash indicates the pattern should only match directories, not regular files
@ -49696,11 +49977,11 @@ class Pattern {
// Normalize slashes
itemPath = pathHelper.normalizeSeparators(itemPath);
// Append a trailing slash. Otherwise Minimatch will not match the directory immediately
// preceeding the globstar. For example, given the pattern `/foo/**`, Minimatch returns
// preceding the globstar. For example, given the pattern `/foo/**`, Minimatch returns
// false for `/foo` but returns true for `/foo/`. Append a trailing slash to handle that quirk.
if (!itemPath.endsWith(path.sep)) {
// Note, this is safe because the constructor ensures the pattern has an absolute root.
// For example, formats like C: and C:foo on Windows are resolved to an aboslute root.
// For example, formats like C: and C:foo on Windows are resolved to an absolute root.
itemPath = `${itemPath}${path.sep}`;
}
}
@ -49738,15 +50019,15 @@ class Pattern {
/**
* Normalizes slashes and ensures absolute root
*/
static fixupPattern(pattern) {
static fixupPattern(pattern, homedir) {
// Empty
assert(pattern, 'pattern cannot be empty');
assert_1.default(pattern, 'pattern cannot be empty');
// Must not contain `.` segment, unless first segment
// Must not contain `..` segment
const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x));
assert(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
// Must not contain globs in root, e.g. Windows UNC path \\foo\b*r
assert(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
// Normalize slashes
pattern = pathHelper.normalizeSeparators(pattern);
// Replace leading `.` segment
@ -49755,9 +50036,9 @@ class Pattern {
}
// Replace leading `~` segment
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
const homedir = os.homedir();
assert(homedir, 'Unable to determine HOME directory');
assert(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
homedir = homedir || os.homedir();
assert_1.default(homedir, 'Unable to determine HOME directory');
assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
pattern = Pattern.globEscape(homedir) + pattern.substr(1);
}
// Replace relative drive root, e.g. pattern is C: or C:foo
@ -50546,9 +50827,19 @@ exports.checkBypass = checkBypass;
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert = __webpack_require__(357);
const path = __webpack_require__(622);
const path = __importStar(__webpack_require__(622));
const assert_1 = __importDefault(__webpack_require__(357));
const IS_WINDOWS = process.platform === 'win32';
/**
* Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths.
@ -50588,8 +50879,8 @@ exports.dirname = dirname;
* or `C:` are expanded based on the current working directory.
*/
function ensureAbsoluteRoot(root, itemPath) {
assert(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
assert(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
// Already rooted
if (hasAbsoluteRoot(itemPath)) {
return itemPath;
@ -50599,7 +50890,7 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like C: or C:foo
if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
let cwd = process.cwd();
assert(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
// Drive letter matches cwd? Expand to cwd
if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
// Drive only, e.g. C:
@ -50624,11 +50915,11 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like \ or \foo
else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
const cwd = process.cwd();
assert(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
return `${cwd[0]}:\\${itemPath.substr(1)}`;
}
}
assert(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
// Otherwise ensure root ends with a separator
if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) {
// Intentionally empty
@ -50645,7 +50936,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot;
* `\\hello\share` and `C:\hello` (and using alternate separator).
*/
function hasAbsoluteRoot(itemPath) {
assert(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
// Normalize separators
itemPath = normalizeSeparators(itemPath);
// Windows
@ -50662,7 +50953,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot;
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
*/
function hasRoot(itemPath) {
assert(itemPath, `isRooted parameter 'itemPath' must not be empty`);
assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`);
// Normalize separators
itemPath = normalizeSeparators(itemPath);
// Windows
@ -50943,6 +51234,7 @@ var node_fetch = _interopDefault(__webpack_require__(454));
var abortController = __webpack_require__(106);
var FormData = _interopDefault(__webpack_require__(790));
var util = __webpack_require__(669);
var url = __webpack_require__(835);
var stream = __webpack_require__(794);
var tunnel = __webpack_require__(413);
var coreAuth = __webpack_require__(229);
@ -51126,7 +51418,7 @@ var Constants = {
* @const
* @type {string}
*/
coreHttpVersion: "1.1.9",
coreHttpVersion: "1.2.1",
/**
* Specifies HTTP.
*
@ -51220,6 +51512,17 @@ var Constants = {
}
};
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
/**
* Default key used to access the XML attributes.
*/
var XML_ATTRKEY = "$";
/**
* Default key used to access the XML value content.
*/
var XML_CHARKEY = "_";
// Copyright (c) Microsoft Corporation.
var validUuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;
/**
@ -51367,7 +51670,9 @@ function prepareXMLRootList(obj, elementName, xmlNamespaceKey, xmlNamespace) {
if (!xmlNamespaceKey || !xmlNamespace) {
return _a = {}, _a[elementName] = obj, _a;
}
return _b = {}, _b[elementName] = obj, _b.$ = (_c = {}, _c[xmlNamespaceKey] = xmlNamespace, _c), _b;
var result = (_b = {}, _b[elementName] = obj, _b);
result[XML_ATTRKEY] = (_c = {}, _c[xmlNamespaceKey] = xmlNamespace, _c);
return result;
}
/**
* Applies the properties on the prototype of sourceCtors to the prototype of targetCtor
@ -51480,9 +51785,18 @@ var Serializer = /** @class */ (function () {
*
* @param {string} objectName Name of the serialized object
*
* @param {options} options additional options to deserialization
*
* @returns {object|string|Array|number|boolean|Date|stream} A valid serialized Javascript object
*/
Serializer.prototype.serialize = function (mapper, object, objectName) {
Serializer.prototype.serialize = function (mapper, object, objectName, options) {
var _a, _b, _c;
if (options === void 0) { options = {}; }
var updatedOptions = {
rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "",
includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false,
xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY
};
var payload = {};
var mapperType = mapper.type.name;
if (!objectName) {
@ -51539,13 +51853,13 @@ var Serializer = /** @class */ (function () {
payload = serializeBase64UrlType(objectName, object);
}
else if (mapperType.match(/^Sequence$/i) !== null) {
payload = serializeSequenceType(this, mapper, object, objectName, Boolean(this.isXML));
payload = serializeSequenceType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions);
}
else if (mapperType.match(/^Dictionary$/i) !== null) {
payload = serializeDictionaryType(this, mapper, object, objectName, Boolean(this.isXML));
payload = serializeDictionaryType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions);
}
else if (mapperType.match(/^Composite$/i) !== null) {
payload = serializeCompositeType(this, mapper, object, objectName, Boolean(this.isXML));
payload = serializeCompositeType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions);
}
}
return payload;
@ -51559,9 +51873,18 @@ var Serializer = /** @class */ (function () {
*
* @param {string} objectName Name of the deserialized object
*
* @param options Controls behavior of XML parser and builder.
*
* @returns {object|string|Array|number|boolean|Date|stream} A valid deserialized Javascript object
*/
Serializer.prototype.deserialize = function (mapper, responseBody, objectName) {
Serializer.prototype.deserialize = function (mapper, responseBody, objectName, options) {
var _a, _b, _c;
if (options === void 0) { options = {}; }
var updatedOptions = {
rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "",
includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false,
xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY
};
if (responseBody == undefined) {
if (this.isXML && mapper.type.name === "Sequence" && !mapper.xmlIsWrapped) {
// Edge case for empty XML non-wrapped lists. xml2js can't distinguish
@ -51581,17 +51904,18 @@ var Serializer = /** @class */ (function () {
objectName = mapper.serializedName;
}
if (mapperType.match(/^Composite$/i) !== null) {
payload = deserializeCompositeType(this, mapper, responseBody, objectName);
payload = deserializeCompositeType(this, mapper, responseBody, objectName, updatedOptions);
}
else {
if (this.isXML) {
var xmlCharKey = updatedOptions.xmlCharKey;
/**
* If the mapper specifies this as a non-composite type value but the responseBody contains
* both header ("$") and body ("_") properties, then just reduce the responseBody value to
* the body ("_") property.
* both header ("$" i.e., XML_ATTRKEY) and body ("#" i.e., XML_CHARKEY) properties,
* then just reduce the responseBody value to the body ("#" i.e., XML_CHARKEY) property.
*/
if (responseBody["$"] != undefined && responseBody["_"] != undefined) {
responseBody = responseBody["_"];
if (responseBody[XML_ATTRKEY] != undefined && responseBody[xmlCharKey] != undefined) {
responseBody = responseBody[xmlCharKey];
}
}
if (mapperType.match(/^Number$/i) !== null) {
@ -51627,10 +51951,10 @@ var Serializer = /** @class */ (function () {
payload = base64UrlToByteArray(responseBody);
}
else if (mapperType.match(/^Sequence$/i) !== null) {
payload = deserializeSequenceType(this, mapper, responseBody, objectName);
payload = deserializeSequenceType(this, mapper, responseBody, objectName, updatedOptions);
}
else if (mapperType.match(/^Dictionary$/i) !== null) {
payload = deserializeDictionaryType(this, mapper, responseBody, objectName);
payload = deserializeDictionaryType(this, mapper, responseBody, objectName, updatedOptions);
}
}
if (mapper.isConstant) {
@ -51735,7 +52059,7 @@ function serializeBasicTypes(typeName, objectName, value) {
objectType !== "function" &&
!(value instanceof ArrayBuffer) &&
!ArrayBuffer.isView(value) &&
!(typeof Blob === "function" && value instanceof Blob)) {
!((typeof Blob === "function" || typeof Blob === "object") && value instanceof Blob)) {
throw new Error(objectName + " must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream.");
}
}
@ -51819,7 +52143,7 @@ function serializeDateTypes(typeName, value, objectName) {
}
return value;
}
function serializeSequenceType(serializer, mapper, object, objectName, isXml) {
function serializeSequenceType(serializer, mapper, object, objectName, isXml, options) {
var _a, _b;
if (!Array.isArray(object)) {
throw new Error(objectName + " must be of type Array.");
@ -51831,16 +52155,19 @@ function serializeSequenceType(serializer, mapper, object, objectName, isXml) {
}
var tempArray = [];
for (var i = 0; i < object.length; i++) {
var serializedValue = serializer.serialize(elementType, object[i], objectName);
var serializedValue = serializer.serialize(elementType, object[i], objectName, options);
if (isXml && elementType.xmlNamespace) {
var xmlnsKey = elementType.xmlNamespacePrefix
? "xmlns:" + elementType.xmlNamespacePrefix
: "xmlns";
if (elementType.type.name === "Composite") {
tempArray[i] = tslib.__assign(tslib.__assign({}, serializedValue), { $: (_a = {}, _a[xmlnsKey] = elementType.xmlNamespace, _a) });
tempArray[i] = tslib.__assign({}, serializedValue);
tempArray[i][XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = elementType.xmlNamespace, _a);
}
else {
tempArray[i] = { _: serializedValue, $: (_b = {}, _b[xmlnsKey] = elementType.xmlNamespace, _b) };
tempArray[i] = {};
tempArray[i][options.xmlCharKey] = serializedValue;
tempArray[i][XML_ATTRKEY] = (_b = {}, _b[xmlnsKey] = elementType.xmlNamespace, _b);
}
}
else {
@ -51849,7 +52176,7 @@ function serializeSequenceType(serializer, mapper, object, objectName, isXml) {
}
return tempArray;
}
function serializeDictionaryType(serializer, mapper, object, objectName, isXml) {
function serializeDictionaryType(serializer, mapper, object, objectName, isXml, options) {
var _a;
if (typeof object !== "object") {
throw new Error(objectName + " must be of type object.");
@ -51862,14 +52189,16 @@ function serializeDictionaryType(serializer, mapper, object, objectName, isXml)
var tempDictionary = {};
for (var _i = 0, _b = Object.keys(object); _i < _b.length; _i++) {
var key = _b[_i];
var serializedValue = serializer.serialize(valueType, object[key], objectName);
var serializedValue = serializer.serialize(valueType, object[key], objectName, options);
// If the element needs an XML namespace we need to add it within the $ property
tempDictionary[key] = getXmlObjectValue(valueType, serializedValue, isXml);
tempDictionary[key] = getXmlObjectValue(valueType, serializedValue, isXml, options);
}
// Add the namespace to the root element if needed
if (isXml && mapper.xmlNamespace) {
var xmlnsKey = mapper.xmlNamespacePrefix ? "xmlns:" + mapper.xmlNamespacePrefix : "xmlns";
return tslib.__assign(tslib.__assign({}, tempDictionary), { $: (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a) });
var result = tempDictionary;
result[XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a);
return result;
}
return tempDictionary;
}
@ -51920,7 +52249,7 @@ function resolveModelProperties(serializer, mapper, objectName) {
}
return modelProps;
}
function serializeCompositeType(serializer, mapper, object, objectName, isXml) {
function serializeCompositeType(serializer, mapper, object, objectName, isXml, options) {
var _a, _b;
if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) {
mapper = getPolymorphicMapper(serializer, mapper, object, "clientName");
@ -51962,7 +52291,7 @@ function serializeCompositeType(serializer, mapper, object, objectName, isXml) {
var xmlnsKey = mapper.xmlNamespacePrefix
? "xmlns:" + mapper.xmlNamespacePrefix
: "xmlns";
parentObject.$ = tslib.__assign(tslib.__assign({}, parentObject.$), (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a));
parentObject[XML_ATTRKEY] = tslib.__assign(tslib.__assign({}, parentObject[XML_ATTRKEY]), (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a));
}
var propertyObjectName = propertyMapper.serializedName !== ""
? objectName + "." + propertyMapper.serializedName
@ -51974,15 +52303,15 @@ function serializeCompositeType(serializer, mapper, object, objectName, isXml) {
toSerialize == undefined) {
toSerialize = mapper.serializedName;
}
var serializedValue = serializer.serialize(propertyMapper, toSerialize, propertyObjectName);
var serializedValue = serializer.serialize(propertyMapper, toSerialize, propertyObjectName, options);
if (serializedValue !== undefined && propName != undefined) {
var value = getXmlObjectValue(propertyMapper, serializedValue, isXml);
var value = getXmlObjectValue(propertyMapper, serializedValue, isXml, options);
if (isXml && propertyMapper.xmlIsAttribute) {
// $ is the key attributes are kept under in xml2js.
// XML_ATTRKEY, i.e., $ is the key attributes are kept under in xml2js.
// This keeps things simple while preventing name collision
// with names in user documents.
parentObject.$ = parentObject.$ || {};
parentObject.$[propName] = serializedValue;
parentObject[XML_ATTRKEY] = parentObject[XML_ATTRKEY] || {};
parentObject[XML_ATTRKEY][propName] = serializedValue;
}
else if (isXml && propertyMapper.xmlIsWrapped) {
parentObject[propName] = (_b = {}, _b[propertyMapper.xmlElementName] = value, _b);
@ -51999,7 +52328,7 @@ function serializeCompositeType(serializer, mapper, object, objectName, isXml) {
var _loop_1 = function (clientPropName) {
var isAdditionalProperty = propNames.every(function (pn) { return pn !== clientPropName; });
if (isAdditionalProperty) {
payload[clientPropName] = serializer.serialize(additionalPropertiesMapper, object[clientPropName], objectName + '["' + clientPropName + '"]');
payload[clientPropName] = serializer.serialize(additionalPropertiesMapper, object[clientPropName], objectName + '["' + clientPropName + '"]', options);
}
};
for (var clientPropName in object) {
@ -52010,7 +52339,7 @@ function serializeCompositeType(serializer, mapper, object, objectName, isXml) {
}
return object;
}
function getXmlObjectValue(propertyMapper, serializedValue, isXml) {
function getXmlObjectValue(propertyMapper, serializedValue, isXml, options) {
var _a;
if (!isXml || !propertyMapper.xmlNamespace) {
return serializedValue;
@ -52020,14 +52349,24 @@ function getXmlObjectValue(propertyMapper, serializedValue, isXml) {
: "xmlns";
var xmlNamespace = (_a = {}, _a[xmlnsKey] = propertyMapper.xmlNamespace, _a);
if (["Composite"].includes(propertyMapper.type.name)) {
return tslib.__assign({ $: xmlNamespace }, serializedValue);
if (serializedValue[XML_ATTRKEY]) {
return serializedValue;
}
else {
var result_1 = tslib.__assign({}, serializedValue);
result_1[XML_ATTRKEY] = xmlNamespace;
return result_1;
}
}
return { _: serializedValue, $: xmlNamespace };
var result = {};
result[options.xmlCharKey] = serializedValue;
result[XML_ATTRKEY] = xmlNamespace;
return result;
}
function isSpecialXmlProperty(propertyName) {
return ["$", "_"].includes(propertyName);
function isSpecialXmlProperty(propertyName, options) {
return [XML_ATTRKEY, options.xmlCharKey].includes(propertyName);
}
function deserializeCompositeType(serializer, mapper, responseBody, objectName) {
function deserializeCompositeType(serializer, mapper, responseBody, objectName, options) {
var _a;
if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) {
mapper = getPolymorphicMapper(serializer, mapper, responseBody, "serializedName");
@ -52051,15 +52390,15 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName)
for (var _c = 0, _d = Object.keys(responseBody); _c < _d.length; _c++) {
var headerKey = _d[_c];
if (headerKey.startsWith(headerCollectionPrefix)) {
dictionary[headerKey.substring(headerCollectionPrefix.length)] = serializer.deserialize(propertyMapper.type.value, responseBody[headerKey], propertyObjectName);
dictionary[headerKey.substring(headerCollectionPrefix.length)] = serializer.deserialize(propertyMapper.type.value, responseBody[headerKey], propertyObjectName, options);
}
handledPropertyNames.push(headerKey);
}
instance[key] = dictionary;
}
else if (serializer.isXML) {
if (propertyMapper.xmlIsAttribute && responseBody.$) {
instance[key] = serializer.deserialize(propertyMapper, responseBody.$[xmlName], propertyObjectName);
if (propertyMapper.xmlIsAttribute && responseBody[XML_ATTRKEY]) {
instance[key] = serializer.deserialize(propertyMapper, responseBody[XML_ATTRKEY][xmlName], propertyObjectName, options);
}
else {
var propertyName = xmlElementName || xmlName || serializedName;
@ -52080,11 +52419,11 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName)
*/
var wrapped = responseBody[xmlName];
var elementList = (_a = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _a !== void 0 ? _a : [];
instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName);
instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName, options);
}
else {
var property = responseBody[propertyName];
instance[key] = serializer.deserialize(propertyMapper, property, propertyObjectName);
instance[key] = serializer.deserialize(propertyMapper, property, propertyObjectName, options);
}
}
}
@ -52119,10 +52458,10 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName)
// paging
if (Array.isArray(responseBody[key]) && modelProps[key].serializedName === "") {
propertyInstance = responseBody[key];
instance = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName);
instance = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName, options);
}
else if (propertyInstance !== undefined || propertyMapper.defaultValue !== undefined) {
serializedValue = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName);
serializedValue = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName, options);
instance[key] = serializedValue;
}
}
@ -52140,7 +52479,7 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName)
};
for (var responsePropName in responseBody) {
if (isAdditionalProperty(responsePropName)) {
instance[responsePropName] = serializer.deserialize(additionalPropertiesMapper, responseBody[responsePropName], objectName + '["' + responsePropName + '"]');
instance[responsePropName] = serializer.deserialize(additionalPropertiesMapper, responseBody[responsePropName], objectName + '["' + responsePropName + '"]', options);
}
}
}
@ -52149,14 +52488,14 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName)
var key = _g[_f];
if (instance[key] === undefined &&
!handledPropertyNames.includes(key) &&
!isSpecialXmlProperty(key)) {
!isSpecialXmlProperty(key, options)) {
instance[key] = responseBody[key];
}
}
}
return instance;
}
function deserializeDictionaryType(serializer, mapper, responseBody, objectName) {
function deserializeDictionaryType(serializer, mapper, responseBody, objectName, options) {
var value = mapper.type.value;
if (!value || typeof value !== "object") {
throw new Error("\"value\" metadata for a Dictionary must be defined in the " +
@ -52166,13 +52505,13 @@ function deserializeDictionaryType(serializer, mapper, responseBody, objectName)
var tempDictionary = {};
for (var _i = 0, _a = Object.keys(responseBody); _i < _a.length; _i++) {
var key = _a[_i];
tempDictionary[key] = serializer.deserialize(value, responseBody[key], objectName);
tempDictionary[key] = serializer.deserialize(value, responseBody[key], objectName, options);
}
return tempDictionary;
}
return responseBody;
}
function deserializeSequenceType(serializer, mapper, responseBody, objectName) {
function deserializeSequenceType(serializer, mapper, responseBody, objectName, options) {
var element = mapper.type.element;
if (!element || typeof element !== "object") {
throw new Error("element\" metadata for an Array must be defined in the " +
@ -52185,7 +52524,7 @@ function deserializeSequenceType(serializer, mapper, responseBody, objectName) {
}
var tempArray = [];
for (var i = 0; i < responseBody.length; i++) {
tempArray[i] = serializer.deserialize(element, responseBody[i], objectName + "[" + i + "]");
tempArray[i] = serializer.deserialize(element, responseBody[i], objectName + "[" + i + "]", options);
}
return tempArray;
}
@ -52486,7 +52825,7 @@ var WebResource = /** @class */ (function () {
if (!this.headers.get("Content-Type")) {
this.headers.set("Content-Type", "application/json; charset=utf-8");
}
// set the request body. request.js automatically sets the Content-Length request header, so we need not set it explicilty
// set the request body. request.js automatically sets the Content-Length request header, so we need not set it explicitly
this.body = options.body;
if (options.body !== undefined && options.body !== null) {
// body as a stream special case. set the body as-is and check for some special request headers specific to sending a stream.
@ -53345,8 +53684,9 @@ var FetchHttpClient = /** @class */ (function () {
if (typeof value === "function") {
value = value();
}
// eslint-disable-next-line no-prototype-builtins
if (value && value.hasOwnProperty("value") && value.hasOwnProperty("options")) {
if (value &&
Object.prototype.hasOwnProperty.call(value, "value") &&
Object.prototype.hasOwnProperty.call(value, "options")) {
requestForm_1.append(key, value.value, value.options);
}
else {
@ -53397,7 +53737,7 @@ var FetchHttpClient = /** @class */ (function () {
return [4 /*yield*/, this.prepareRequest(httpRequest)];
case 1:
platformSpecificRequestInit = _d.sent();
requestInit = tslib.__assign({ body: body, headers: httpRequest.headers.rawHeaders(), method: httpRequest.method, signal: abortController$1.signal }, platformSpecificRequestInit);
requestInit = tslib.__assign({ body: body, headers: httpRequest.headers.rawHeaders(), method: httpRequest.method, signal: abortController$1.signal, redirect: "manual" }, platformSpecificRequestInit);
_d.label = 2;
case 2:
_d.trys.push([2, 8, 9, 10]);
@ -53877,13 +54217,12 @@ var xml2jsDefaultOptionsV2 = {
trim: false,
normalize: false,
normalizeTags: false,
attrkey: "$",
charkey: "_",
attrkey: XML_ATTRKEY,
explicitArray: true,
ignoreAttrs: false,
mergeAttrs: false,
explicitRoot: true,
validator: null,
validator: undefined,
xmlns: false,
explicitChildren: false,
preserveChildrenOrder: false,
@ -53892,17 +54231,17 @@ var xml2jsDefaultOptionsV2 = {
includeWhiteChars: false,
async: false,
strict: true,
attrNameProcessors: null,
attrValueProcessors: null,
tagNameProcessors: null,
valueProcessors: null,
attrNameProcessors: undefined,
attrValueProcessors: undefined,
tagNameProcessors: undefined,
valueProcessors: undefined,
rootName: "root",
xmldec: {
version: "1.0",
encoding: "UTF-8",
standalone: true
},
doctype: null,
doctype: undefined,
renderOpts: {
pretty: true,
indent: " ",
@ -53929,7 +54268,10 @@ xml2jsBuilderSettings.renderOpts = {
* `rootName` indicates the name of the root element in the resulting XML
*/
function stringifyXML(obj, opts) {
xml2jsBuilderSettings.rootName = (opts || {}).rootName;
var _a;
if (opts === void 0) { opts = {}; }
xml2jsBuilderSettings.rootName = opts.rootName;
xml2jsBuilderSettings.charkey = (_a = opts.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
var builder = new xml2js.Builder(xml2jsBuilderSettings);
return builder.buildObject(obj);
}
@ -53940,7 +54282,10 @@ function stringifyXML(obj, opts) {
* `includeRoot` indicates whether the root element is to be included or not in the output
*/
function parseXML(str, opts) {
xml2jsParserSettings.explicitRoot = !!(opts && opts.includeRoot);
var _a;
if (opts === void 0) { opts = {}; }
xml2jsParserSettings.explicitRoot = !!opts.includeRoot;
xml2jsParserSettings.charkey = (_a = opts.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
var xmlParser = new xml2js.Parser(xml2jsParserSettings);
return new Promise(function (resolve, reject) {
if (!str) {
@ -53964,10 +54309,10 @@ function parseXML(str, opts) {
* Create a new serialization RequestPolicyCreator that will serialized HTTP request bodies as they
* pass through the HTTP pipeline.
*/
function deserializationPolicy(deserializationContentTypes) {
function deserializationPolicy(deserializationContentTypes, parsingOptions) {
return {
create: function (nextPolicy, options) {
return new DeserializationPolicy(nextPolicy, deserializationContentTypes, options);
return new DeserializationPolicy(nextPolicy, options, deserializationContentTypes, parsingOptions);
}
};
}
@ -53985,22 +54330,25 @@ var DefaultDeserializationOptions = {
*/
var DeserializationPolicy = /** @class */ (function (_super) {
tslib.__extends(DeserializationPolicy, _super);
function DeserializationPolicy(nextPolicy, deserializationContentTypes, options) {
var _this = _super.call(this, nextPolicy, options) || this;
function DeserializationPolicy(nextPolicy, requestPolicyOptions, deserializationContentTypes, parsingOptions) {
if (parsingOptions === void 0) { parsingOptions = {}; }
var _a;
var _this = _super.call(this, nextPolicy, requestPolicyOptions) || this;
_this.jsonContentTypes =
(deserializationContentTypes && deserializationContentTypes.json) || defaultJsonContentTypes;
_this.xmlContentTypes =
(deserializationContentTypes && deserializationContentTypes.xml) || defaultXmlContentTypes;
_this.xmlCharKey = (_a = parsingOptions.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
return _this;
}
DeserializationPolicy.prototype.sendRequest = function (request) {
return tslib.__awaiter(this, void 0, void 0, function () {
var _this = this;
return tslib.__generator(this, function (_a) {
return [2 /*return*/, this._nextPolicy
.sendRequest(request)
.then(function (response) {
return deserializeResponseBody(_this.jsonContentTypes, _this.xmlContentTypes, response);
return [2 /*return*/, this._nextPolicy.sendRequest(request).then(function (response) {
return deserializeResponseBody(_this.jsonContentTypes, _this.xmlContentTypes, response, {
xmlCharKey: _this.xmlCharKey
});
})];
});
});
@ -54036,8 +54384,15 @@ function shouldDeserializeResponse(parsedResponse) {
}
return result;
}
function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) {
return parse(jsonContentTypes, xmlContentTypes, response).then(function (parsedResponse) {
function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, options) {
var _a, _b, _c;
if (options === void 0) { options = {}; }
var updatedOptions = {
rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "",
includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false,
xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY
};
return parse(jsonContentTypes, xmlContentTypes, response, updatedOptions).then(function (parsedResponse) {
if (!shouldDeserializeResponse(parsedResponse)) {
return parsedResponse;
}
@ -54046,54 +54401,13 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) {
return parsedResponse;
}
var responseSpec = getOperationResponse(parsedResponse);
var expectedStatusCodes = Object.keys(operationSpec.responses);
var hasNoExpectedStatusCodes = expectedStatusCodes.length === 0 ||
(expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default");
var isExpectedStatusCode = hasNoExpectedStatusCodes
? 200 <= parsedResponse.status && parsedResponse.status < 300
: !!responseSpec;
// There is no operation response spec for current status code.
// So, treat it as an error case and use the default response spec to deserialize the response.
if (!isExpectedStatusCode) {
var defaultResponseSpec = operationSpec.responses.default;
if (!defaultResponseSpec) {
return parsedResponse;
}
var defaultBodyMapper = defaultResponseSpec.bodyMapper;
var defaultHeadersMapper = defaultResponseSpec.headersMapper;
var initialErrorMessage = isStreamOperation(operationSpec)
? "Unexpected status code: " + parsedResponse.status
: parsedResponse.bodyAsText;
var error = new RestError(initialErrorMessage, undefined, parsedResponse.status, parsedResponse.request, parsedResponse);
try {
// If error response has a body, try to extract error code & message from it
// Then try to deserialize it using default body mapper
if (parsedResponse.parsedBody) {
var parsedBody = parsedResponse.parsedBody;
var internalError = parsedBody.error || parsedBody;
error.code = internalError.code;
if (internalError.message) {
error.message = internalError.message;
}
if (defaultBodyMapper) {
var valueToDeserialize = parsedBody;
if (operationSpec.isXML && defaultBodyMapper.type.name === MapperType.Sequence) {
valueToDeserialize =
typeof parsedBody === "object" ? parsedBody[defaultBodyMapper.xmlElementName] : [];
}
error.response.parsedBody = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody");
}
}
// If error response has headers, try to deserialize it using default header mapper
if (parsedResponse.headers && defaultHeadersMapper) {
error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders");
}
}
catch (defaultError) {
error.message = "Error \"" + defaultError.message + "\" occurred in deserializing the responseBody - \"" + parsedResponse.bodyAsText + "\" for the default response.";
}
var _a = handleErrorResponse(parsedResponse, operationSpec, responseSpec), error = _a.error, shouldReturnResponse = _a.shouldReturnResponse;
if (error) {
throw error;
}
else if (shouldReturnResponse) {
return parsedResponse;
}
// An operation response spec does exist for current status code, so
// use it to deserialize the response.
if (responseSpec) {
@ -54106,7 +54420,7 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) {
: [];
}
try {
parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody");
parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody", options);
}
catch (error) {
var restError = new RestError("Error " + error + " occurred in deserializing the responseBody - " + parsedResponse.bodyAsText, undefined, parsedResponse.status, parsedResponse.request, parsedResponse);
@ -54118,13 +54432,78 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) {
parsedResponse.parsedBody = response.status >= 200 && response.status < 300;
}
if (responseSpec.headersMapper) {
parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders");
parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders", options);
}
}
return parsedResponse;
});
}
function parse(jsonContentTypes, xmlContentTypes, operationResponse) {
function isOperationSpecEmpty(operationSpec) {
var expectedStatusCodes = Object.keys(operationSpec.responses);
return (expectedStatusCodes.length === 0 ||
(expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default"));
}
function handleErrorResponse(parsedResponse, operationSpec, responseSpec) {
var isSuccessByStatus = 200 <= parsedResponse.status && parsedResponse.status < 300;
var isExpectedStatusCode = isOperationSpecEmpty(operationSpec)
? isSuccessByStatus
: !!responseSpec;
if (isExpectedStatusCode) {
if (responseSpec) {
if (!responseSpec.isError) {
return { error: null, shouldReturnResponse: false };
}
}
else {
return { error: null, shouldReturnResponse: false };
}
}
var errorResponseSpec = responseSpec !== null && responseSpec !== void 0 ? responseSpec : operationSpec.responses.default;
var initialErrorMessage = isStreamOperation(operationSpec)
? "Unexpected status code: " + parsedResponse.status
: parsedResponse.bodyAsText;
var error = new RestError(initialErrorMessage, undefined, parsedResponse.status, parsedResponse.request, parsedResponse);
// If the item failed but there's no error spec or default spec to deserialize the error,
// we should fail so we just throw the parsed response
if (!errorResponseSpec) {
throw error;
}
var defaultBodyMapper = errorResponseSpec.bodyMapper;
var defaultHeadersMapper = errorResponseSpec.headersMapper;
try {
// If error response has a body, try to deserialize it using default body mapper.
// Then try to extract error code & message from it
if (parsedResponse.parsedBody) {
var parsedBody = parsedResponse.parsedBody;
var parsedError = void 0;
if (defaultBodyMapper) {
var valueToDeserialize = parsedBody;
if (operationSpec.isXML && defaultBodyMapper.type.name === MapperType.Sequence) {
valueToDeserialize =
typeof parsedBody === "object" ? parsedBody[defaultBodyMapper.xmlElementName] : [];
}
parsedError = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody");
}
var internalError = parsedBody.error || parsedError || parsedBody;
error.code = internalError.code;
if (internalError.message) {
error.message = internalError.message;
}
if (defaultBodyMapper) {
error.response.parsedBody = parsedError;
}
}
// If error response has headers, try to deserialize it using default header mapper
if (parsedResponse.headers && defaultHeadersMapper) {
error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders");
}
}
catch (defaultError) {
error.message = "Error \"" + defaultError.message + "\" occurred in deserializing the responseBody - \"" + parsedResponse.bodyAsText + "\" for the default response.";
}
return { error: error, shouldReturnResponse: false };
}
function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts) {
var errorHandler = function (err) {
var msg = "Error \"" + err + "\" occurred while parsing the response body - " + operationResponse.bodyAsText + ".";
var errCode = err.code || RestError.PARSE_ERROR;
@ -54145,7 +54524,7 @@ function parse(jsonContentTypes, xmlContentTypes, operationResponse) {
}).catch(errorHandler);
}
else if (contentComponents.some(function (component) { return xmlContentTypes.indexOf(component) !== -1; })) {
return parseXML(text_1)
return parseXML(text_1, opts)
.then(function (body) {
operationResponse.parsedBody = body;
return operationResponse;
@ -54415,6 +54794,10 @@ var UserAgentPolicy = /** @class */ (function (_super) {
}(BaseRequestPolicy));
// Copyright (c) Microsoft Corporation.
/**
* Methods that are allowed to follow redirects 301 and 302
*/
var allowedRedirect = ["GET", "HEAD"];
var DefaultRedirectOptions = {
handleRedirects: true,
maxRetries: 20
@ -54447,7 +54830,11 @@ function handleRedirect(policy, response, currentRetries) {
var request = response.request, status = response.status;
var locationHeader = response.headers.get("location");
if (locationHeader &&
(status === 300 || status === 307 || (status === 303 && request.method === "POST")) &&
(status === 300 ||
(status === 301 && allowedRedirect.includes(request.method)) ||
(status === 302 && allowedRedirect.includes(request.method)) ||
(status === 303 && request.method === "POST") ||
status === 307) &&
(!policy.maxRetries || currentRetries < policy.maxRetries)) {
var builder = URLBuilder.parse(request.url);
builder.setPath(locationHeader);
@ -54456,6 +54843,7 @@ function handleRedirect(policy, response, currentRetries) {
// redirected GET request if the redirect url is present in the location header
if (status === 303) {
request.method = "GET";
delete request.body;
}
return policy._nextPolicy
.sendRequest(request)
@ -54717,6 +55105,12 @@ var AccessTokenRefresher = /** @class */ (function () {
}());
// Copyright (c) Microsoft Corporation.
/**
* The automated token refresh will only start to happen at the
* expiration date minus the value of timeBetweenRefreshAttemptsInMs,
* which is by default 30 seconds.
*/
var timeBetweenRefreshAttemptsInMs = 30000;
/**
* Creates a new BearerTokenAuthenticationPolicy factory.
*
@ -54732,12 +55126,6 @@ function bearerTokenAuthenticationPolicy(credential, scopes) {
}
};
}
/**
* The automated token refresh will only start to happen at the
* expiration date minus the value of timeBetweenRefreshAttemptsInMs,
* which is by default 30 seconds.
*/
var timeBetweenRefreshAttemptsInMs = 30000;
/**
*
* Provides a RequestPolicy that can request a token from a TokenCredential
@ -55397,10 +55785,15 @@ var ServiceClient = /** @class */ (function () {
var bearerTokenPolicyFactory = undefined;
// eslint-disable-next-line @typescript-eslint/no-this-alias
var serviceClient = _this;
var serviceClientOptions = options;
return {
create: function (nextPolicy, options) {
var credentialScopes = getCredentialScopes(serviceClientOptions, serviceClient.baseUri);
if (!credentialScopes) {
throw new Error("When using credential, the ServiceClient must contain a baseUri or a credentialScopes in ServiceClientOptions. Unable to create a bearerTokenAuthenticationPolicy");
}
if (bearerTokenPolicyFactory === undefined || bearerTokenPolicyFactory === null) {
bearerTokenPolicyFactory = bearerTokenAuthenticationPolicy(credentials, (serviceClient.baseUri || "") + "/.default");
bearerTokenPolicyFactory = bearerTokenAuthenticationPolicy(credentials, credentialScopes);
}
return bearerTokenPolicyFactory.create(nextPolicy, options);
}
@ -55464,19 +55857,21 @@ var ServiceClient = /** @class */ (function () {
* @param {ServiceCallback} callback The callback to call when the response is received.
*/
ServiceClient.prototype.sendOperationRequest = function (operationArguments, operationSpec, callback) {
var _a;
return tslib.__awaiter(this, void 0, void 0, function () {
var httpRequest, result, baseUri, requestUrl, _i, _a, urlParameter, urlParameterValue, _b, _c, queryParameter, queryParameterValue, index, item, index, contentType, _d, _e, headerParameter, headerValue, headerCollectionPrefix, _f, _g, key, options, customHeaderName, rawResponse, sendRequestError, error_1, error_2, cb;
return tslib.__generator(this, function (_h) {
switch (_h.label) {
var serializerOptions, httpRequest, result, baseUri, requestUrl, _i, _b, urlParameter, urlParameterValue, _c, _d, queryParameter, queryParameterValue, index, item, index, contentType, _e, _f, headerParameter, headerValue, headerCollectionPrefix, _g, _h, key, options, customHeaderName, rawResponse, sendRequestError, error_1, error_2, cb;
return tslib.__generator(this, function (_j) {
switch (_j.label) {
case 0:
if (typeof operationArguments.options === "function") {
callback = operationArguments.options;
operationArguments.options = undefined;
}
serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions;
httpRequest = new WebResource();
_h.label = 1;
_j.label = 1;
case 1:
_h.trys.push([1, 6, , 7]);
_j.trys.push([1, 6, , 7]);
baseUri = operationSpec.baseUrl || this.baseUri;
if (!baseUri) {
throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a baseUri string property that contains the base URL to use.");
@ -55488,10 +55883,10 @@ var ServiceClient = /** @class */ (function () {
requestUrl.appendPath(operationSpec.path);
}
if (operationSpec.urlParameters && operationSpec.urlParameters.length > 0) {
for (_i = 0, _a = operationSpec.urlParameters; _i < _a.length; _i++) {
urlParameter = _a[_i];
for (_i = 0, _b = operationSpec.urlParameters; _i < _b.length; _i++) {
urlParameter = _b[_i];
urlParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, urlParameter, operationSpec.serializer);
urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, getPathStringFromParameter(urlParameter));
urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, getPathStringFromParameter(urlParameter), serializerOptions);
if (!urlParameter.skipEncoding) {
urlParameterValue = encodeURIComponent(urlParameterValue);
}
@ -55499,16 +55894,17 @@ var ServiceClient = /** @class */ (function () {
}
}
if (operationSpec.queryParameters && operationSpec.queryParameters.length > 0) {
for (_b = 0, _c = operationSpec.queryParameters; _b < _c.length; _b++) {
queryParameter = _c[_b];
for (_c = 0, _d = operationSpec.queryParameters; _c < _d.length; _c++) {
queryParameter = _d[_c];
queryParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, queryParameter, operationSpec.serializer);
if (queryParameterValue !== undefined && queryParameterValue !== null) {
queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter));
queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter), serializerOptions);
if (queryParameter.collectionFormat !== undefined &&
queryParameter.collectionFormat !== null) {
if (queryParameter.collectionFormat === exports.QueryCollectionFormat.Multi) {
if (queryParameterValue.length === 0) {
queryParameterValue = "";
// The collection is empty, no need to try serializing the current queryParam
continue;
}
else {
for (index in queryParameterValue) {
@ -55553,16 +55949,16 @@ var ServiceClient = /** @class */ (function () {
httpRequest.headers.set("Content-Type", contentType);
}
if (operationSpec.headerParameters) {
for (_d = 0, _e = operationSpec.headerParameters; _d < _e.length; _d++) {
headerParameter = _e[_d];
for (_e = 0, _f = operationSpec.headerParameters; _e < _f.length; _e++) {
headerParameter = _f[_e];
headerValue = getOperationArgumentValueFromParameter(this, operationArguments, headerParameter, operationSpec.serializer);
if (headerValue !== undefined && headerValue !== null) {
headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter));
headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter), serializerOptions);
headerCollectionPrefix = headerParameter.mapper
.headerCollectionPrefix;
if (headerCollectionPrefix) {
for (_f = 0, _g = Object.keys(headerValue); _f < _g.length; _f++) {
key = _g[_f];
for (_g = 0, _h = Object.keys(headerValue); _g < _h.length; _g++) {
key = _h[_g];
httpRequest.headers.set(headerCollectionPrefix + key, headerValue[key]);
}
}
@ -55606,15 +56002,15 @@ var ServiceClient = /** @class */ (function () {
}
rawResponse = void 0;
sendRequestError = void 0;
_h.label = 2;
_j.label = 2;
case 2:
_h.trys.push([2, 4, , 5]);
_j.trys.push([2, 4, , 5]);
return [4 /*yield*/, this.sendRequest(httpRequest)];
case 3:
rawResponse = _h.sent();
rawResponse = _j.sent();
return [3 /*break*/, 5];
case 4:
error_1 = _h.sent();
error_1 = _j.sent();
sendRequestError = error_1;
return [3 /*break*/, 5];
case 5:
@ -55630,7 +56026,7 @@ var ServiceClient = /** @class */ (function () {
}
return [3 /*break*/, 7];
case 6:
error_2 = _h.sent();
error_2 = _j.sent();
result = Promise.reject(error_2);
return [3 /*break*/, 7];
case 7:
@ -55649,7 +56045,14 @@ var ServiceClient = /** @class */ (function () {
return ServiceClient;
}());
function serializeRequestBody(serviceClient, httpRequest, operationArguments, operationSpec) {
var _a;
var _a, _b, _c, _d, _e, _f;
var serializerOptions = (_b = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions) !== null && _b !== void 0 ? _b : {};
var updatedOptions = {
rootName: (_c = serializerOptions.rootName) !== null && _c !== void 0 ? _c : "",
includeRoot: (_d = serializerOptions.includeRoot) !== null && _d !== void 0 ? _d : false,
xmlCharKey: (_e = serializerOptions.xmlCharKey) !== null && _e !== void 0 ? _e : XML_CHARKEY
};
var xmlCharKey = serializerOptions.xmlCharKey;
if (operationSpec.requestBody && operationSpec.requestBody.mapper) {
httpRequest.body = getOperationArgumentValueFromParameter(serviceClient, operationArguments, operationSpec.requestBody, operationSpec.serializer);
var bodyMapper = operationSpec.requestBody.mapper;
@ -55658,22 +56061,26 @@ function serializeRequestBody(serviceClient, httpRequest, operationArguments, op
try {
if ((httpRequest.body !== undefined && httpRequest.body !== null) || required) {
var requestBodyParameterPathString = getPathStringFromParameter(operationSpec.requestBody);
httpRequest.body = operationSpec.serializer.serialize(bodyMapper, httpRequest.body, requestBodyParameterPathString);
httpRequest.body = operationSpec.serializer.serialize(bodyMapper, httpRequest.body, requestBodyParameterPathString, updatedOptions);
var isStream = typeName === MapperType.Stream;
if (operationSpec.isXML) {
var xmlnsKey = xmlNamespacePrefix ? "xmlns:" + xmlNamespacePrefix : "xmlns";
var value = getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, httpRequest.body);
var value = getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, httpRequest.body, updatedOptions);
if (typeName === MapperType.Sequence) {
httpRequest.body = stringifyXML(prepareXMLRootList(value, xmlElementName || xmlName || serializedName, xmlnsKey, xmlNamespace), { rootName: xmlName || serializedName });
httpRequest.body = stringifyXML(prepareXMLRootList(value, xmlElementName || xmlName || serializedName, xmlnsKey, xmlNamespace), {
rootName: xmlName || serializedName,
xmlCharKey: xmlCharKey
});
}
else if (!isStream) {
httpRequest.body = stringifyXML(value, {
rootName: xmlName || serializedName
rootName: xmlName || serializedName,
xmlCharKey: xmlCharKey
});
}
}
else if (typeName === MapperType.String &&
(((_a = operationSpec.contentType) === null || _a === void 0 ? void 0 : _a.match("text/plain")) || operationSpec.mediaType === "text")) {
(((_f = operationSpec.contentType) === null || _f === void 0 ? void 0 : _f.match("text/plain")) || operationSpec.mediaType === "text")) {
// the String serializer has validated that request body is a string
// so just send the string.
return;
@ -55689,12 +56096,12 @@ function serializeRequestBody(serviceClient, httpRequest, operationArguments, op
}
else if (operationSpec.formDataParameters && operationSpec.formDataParameters.length > 0) {
httpRequest.formData = {};
for (var _i = 0, _b = operationSpec.formDataParameters; _i < _b.length; _i++) {
var formDataParameter = _b[_i];
for (var _i = 0, _g = operationSpec.formDataParameters; _i < _g.length; _i++) {
var formDataParameter = _g[_i];
var formDataParameterValue = getOperationArgumentValueFromParameter(serviceClient, operationArguments, formDataParameter, operationSpec.serializer);
if (formDataParameterValue !== undefined && formDataParameterValue !== null) {
var formDataParameterPropertyName = formDataParameter.mapper.serializedName || getPathStringFromParameter(formDataParameter);
httpRequest.formData[formDataParameterPropertyName] = operationSpec.serializer.serialize(formDataParameter.mapper, formDataParameterValue, getPathStringFromParameter(formDataParameter));
httpRequest.formData[formDataParameterPropertyName] = operationSpec.serializer.serialize(formDataParameter.mapper, formDataParameterValue, getPathStringFromParameter(formDataParameter), updatedOptions);
}
}
}
@ -55702,12 +56109,15 @@ function serializeRequestBody(serviceClient, httpRequest, operationArguments, op
/**
* Adds an xml namespace to the xml serialized object if needed, otherwise it just returns the value itself
*/
function getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, serializedValue) {
function getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, serializedValue, options) {
var _a;
// Composite and Sequence schemas already got their root namespace set during serialization
// We just need to add xmlns to the other schema types
if (xmlNamespace && !["Composite", "Sequence", "Dictionary"].includes(typeName)) {
return { _: serializedValue, $: (_a = {}, _a[xmlnsKey] = xmlNamespace, _a) };
var result = {};
result[options.xmlCharKey] = serializedValue;
result[XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = xmlNamespace, _a);
return result;
}
return serializedValue;
}
@ -55796,10 +56206,12 @@ function getOperationArgumentValueFromParameter(serviceClient, operationArgument
return getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, parameter.parameterPath, parameter.mapper, serializer);
}
function getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, parameterPath, parameterMapper, serializer) {
var _a;
var value;
if (typeof parameterPath === "string") {
parameterPath = [parameterPath];
}
var serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions;
if (Array.isArray(parameterPath)) {
if (parameterPath.length > 0) {
if (parameterMapper.isConstant) {
@ -55820,7 +56232,7 @@ function getOperationArgumentValueFromParameterPath(serviceClient, operationArgu
}
// Serialize just for validation purposes.
var parameterPathString = getPathStringFromParameterPath(parameterPath, parameterMapper);
serializer.serialize(parameterMapper, value, parameterPathString);
serializer.serialize(parameterMapper, value, parameterPathString, serializerOptions);
}
}
else {
@ -55833,7 +56245,7 @@ function getOperationArgumentValueFromParameterPath(serviceClient, operationArgu
var propertyValue = getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, propertyPath, propertyMapper, serializer);
// Serialize just for validation purposes.
var propertyPathString = getPathStringFromParameterPath(propertyPath, propertyMapper);
serializer.serialize(propertyMapper, propertyValue, propertyPathString);
serializer.serialize(propertyMapper, propertyValue, propertyPathString, serializerOptions);
if (propertyValue !== undefined && propertyValue !== null) {
if (!value) {
value = {};
@ -55907,6 +56319,46 @@ function flattenResponse(_response, responseSpec) {
}
return addOperationResponse(tslib.__assign(tslib.__assign({}, parsedHeaders), _response.parsedBody));
}
function getCredentialScopes(options, baseUri) {
if (options === null || options === void 0 ? void 0 : options.credentialScopes) {
var scopes = options.credentialScopes;
return Array.isArray(scopes)
? scopes.map(function (scope) { return new url.URL(scope).toString(); })
: new url.URL(scopes).toString();
}
if (baseUri) {
return baseUri + "/.default";
}
return undefined;
}
// Copyright (c) Microsoft Corporation.
/**
* Creates a function called createSpan to create spans using the global tracer.
* @ignore
* @param spanConfig The name of the operation being performed.
* @param tracingOptions The options for the underlying http request.
*/
function createSpanFunction(_a) {
var packagePrefix = _a.packagePrefix, namespace = _a.namespace;
return function (operationName, operationOptions) {
var tracer = coreTracing.getTracer();
var tracingOptions = operationOptions.tracingOptions || {};
var spanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { kind: api.SpanKind.INTERNAL });
var span = tracer.startSpan(packagePrefix + "." + operationName, spanOptions);
span.setAttribute("az.namespace", namespace);
var newSpanOptions = tracingOptions.spanOptions || {};
if (span.isRecording()) {
newSpanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: tslib.__assign(tslib.__assign({}, spanOptions.attributes), { "az.namespace": namespace }) });
}
var newTracingOptions = tslib.__assign(tslib.__assign({}, tracingOptions), { spanOptions: newSpanOptions });
var newOperationOptions = tslib.__assign(tslib.__assign({}, operationOptions), { tracingOptions: newTracingOptions });
return {
span: span,
updatedOptions: newOperationOptions
};
};
}
// Copyright (c) Microsoft Corporation.
var HeaderConstants = Constants.HeaderConstants;
@ -56051,9 +56503,12 @@ exports.TopicCredentials = TopicCredentials;
exports.URLBuilder = URLBuilder;
exports.URLQuery = URLQuery;
exports.WebResource = WebResource;
exports.XML_ATTRKEY = XML_ATTRKEY;
exports.XML_CHARKEY = XML_CHARKEY;
exports.applyMixins = applyMixins;
exports.bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy;
exports.createPipelineFromOptions = createPipelineFromOptions;
exports.createSpanFunction = createSpanFunction;
exports.delay = delay;
exports.deserializationPolicy = deserializationPolicy;
exports.deserializeResponseBody = deserializeResponseBody;

36
package-lock.json generated
View File

@ -5,9 +5,9 @@
"requires": true,
"dependencies": {
"@actions/cache": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.4.tgz",
"integrity": "sha512-1grYfbu8P6JDDHc40eOI5tQDRcAxMwq5HBWhaCqEg9o/ixDRZfwPHlQvQAop2ZzFCjF2ns0ENQOIBAH8GNn+zA==",
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.5.tgz",
"integrity": "sha512-TcvJOduwsPP27KLmIa5cqXsQYFK2GzILcEpnhvYmhGwi1aYx9XwhKmp6Im8X6DJMBxbvupKPsOntG6f6sSkIPA==",
"requires": {
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.1",
@ -34,11 +34,11 @@
}
},
"@actions/glob": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.0.tgz",
"integrity": "sha512-lx8SzyQ2FE9+UUvjqY1f28QbTJv+w8qP7kHHbfQRhphrlcx0Mdmm1tZdGJzfxv1jxREa/sLW4Oy8CbGQKCJySA==",
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.1.tgz",
"integrity": "sha512-ikM4GVZOgSGDNTjv0ECJ8AOqmDqQwtO4K1M4P465C9iikRq34+FwCjUVSwzgOYDP85qtddyWpzBw5lTub/9Xmg==",
"requires": {
"@actions/core": "^1.2.0",
"@actions/core": "^1.2.6",
"minimatch": "^3.0.4"
}
},
@ -112,9 +112,9 @@
}
},
"@azure/core-http": {
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.1.9.tgz",
"integrity": "sha512-wM0HMRNQaE2NtTHb+9FXF7uxUqaAHFTMVu6OzlEll6gUGybcDqM7+9Oklp33BhEfq+ZumpCoqxq3njNbMHuf/w==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.2.1.tgz",
"integrity": "sha512-vPHIQXjLVs4iin2BUaj7/sqIAfGq3MW1TLEc3yYKFNpi/sBQn2KI0g+Ow0EQYvAkkHhTHGArA7JKhcjsnJMGLw==",
"requires": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-auth": "^1.1.3",
@ -129,7 +129,7 @@
"tough-cookie": "^4.0.0",
"tslib": "^2.0.0",
"tunnel": "^0.0.6",
"uuid": "^8.1.0",
"uuid": "^8.3.0",
"xml2js": "^0.4.19"
},
"dependencies": {
@ -159,9 +159,9 @@
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
},
"uuid": {
"version": "8.3.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz",
"integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg=="
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
},
@ -249,12 +249,12 @@
}
},
"@azure/storage-blob": {
"version": "12.2.1",
"resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.2.1.tgz",
"integrity": "sha512-erqCSmDL8b/AHZi94nq+nCE+2whQmvBDkAv4N9uic0MRac/gRyZqnsqkfrun/gr2rZo+qVtnMenwkkE3roXn8Q==",
"version": "12.3.0",
"resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.3.0.tgz",
"integrity": "sha512-nCySzNfm782pEW3sg9GHj1zE4gBeVVMeEBdWb4MefifrCwQQOoz5cXZTNFiUJAJqAO+/72r2UjZcUwHk/QmzkA==",
"requires": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-http": "^1.1.6",
"@azure/core-http": "^1.2.0",
"@azure/core-lro": "^1.0.2",
"@azure/core-paging": "^1.1.1",
"@azure/core-tracing": "1.0.0-preview.9",

View File

@ -23,7 +23,7 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/cache": "^1.0.4",
"@actions/cache": "^1.0.5",
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.1",
"@actions/io": "^1.0.1"