@azure/storage-blob
Advanced tools
Comparing version 12.3.1-alpha.20201204.1 to 12.3.1-alpha.20201207.1
@@ -5,2 +5,7 @@ # Release History | ||
- Updated Azure Storage Service API version to 2020-04-08. | ||
- Added a new interface `BlockBlobClient.syncUploadFromURL()` to support creating a new Block Blob where the contents of the blob are read from a given URL. | ||
- Blob Tags updates: `BlobClient.setTags()` and `BlobClient.getTags()` now support the `LeaseAccessConditions` and `BlobServiceClient.findBlobsByTags()` will return all matching tags for each blob. | ||
- Added `generateSasUrl` to `BlobClient` and `ContainerClient` to generate a service-level SAS URI for the client. | ||
- Added `generateAccountSasUrl` to `BlobServiceClient` to generate an account-level SAS URI for the client. | ||
- Fixed a bug where the `credential` property of the `StorageClient` is not set correctly when using a Token credential. Fixed bug [12219](https://github.com/Azure/azure-sdk-for-js/issues/12219). | ||
@@ -7,0 +12,0 @@ - Blob Batch operations now reorder the subresponses in the client side to perserve the original input order. See `BlobBatchClient.submitBatch()` and [12335](https://github.com/Azure/azure-sdk-for-js/issues/12335). |
@@ -9,3 +9,3 @@ import { __assign, __asyncDelegator, __asyncGenerator, __asyncValues, __await, __awaiter, __extends, __generator, __values } from "tslib"; | ||
import { ContainerClient } from "./Clients"; | ||
import { appendToURLPath, extractConnectionStringParts } from "./utils/utils.common"; | ||
import { appendToURLPath, appendToURLQuery, extractConnectionStringParts, toTags } from "./utils/utils.common"; | ||
import { StorageSharedKeyCredential } from "./credentials/StorageSharedKeyCredential"; | ||
@@ -18,2 +18,5 @@ import { AnonymousCredential } from "./credentials/AnonymousCredential"; | ||
import { StorageClient } from "./StorageClient"; | ||
import { AccountSASPermissions } from "./sas/AccountSASPermissions"; | ||
import { generateAccountSASQueryParameters } from "./sas/AccountSASSignatureValues"; | ||
import { AccountSASServices } from "./sas/AccountSASServices"; | ||
/** | ||
@@ -450,3 +453,3 @@ * A BlobServiceClient represents a Client to the Azure Storage Blob service allowing you | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, span, spanOptions, e_9; | ||
var _a, span, spanOptions, response, wrappedResponse, e_9; | ||
return __generator(this, function (_b) { | ||
@@ -466,3 +469,13 @@ switch (_b.label) { | ||
})]; | ||
case 2: return [2 /*return*/, _b.sent()]; | ||
case 2: | ||
response = _b.sent(); | ||
wrappedResponse = __assign(__assign({}, response), { _response: response._response, blobs: response.blobs.map(function (blob) { | ||
var _a; | ||
var tagValue = undefined; | ||
if (((_a = blob.tags) === null || _a === void 0 ? void 0 : _a.blobTagSet.length) === 1) { | ||
tagValue = blob.tags.blobTagSet[0].value; | ||
} | ||
return __assign(__assign({}, blob), { tags: toTags(blob.tags), tagValue: tagValue }); | ||
}) }); | ||
return [2 /*return*/, wrappedResponse]; | ||
case 3: | ||
@@ -975,2 +988,33 @@ e_9 = _b.sent(); | ||
}; | ||
/** | ||
* Only available for BlobServiceClient constructed with a shared key credential. | ||
* | ||
* Generates a Blob account Shared Access Signature (SAS) URI based on the client properties | ||
* and parameters passed in. The SAS is signed by the shared key credential of the client. | ||
* | ||
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas | ||
* | ||
* @param {Date} expiresOn Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not provided. | ||
* @param {AccountSASPermissions} [permissions=AccountSASPermissions.parse("r")] Specifies the list of permissions to be associated with the SAS. | ||
* @param {string} [resourceTypes="sco"] Specifies the resource types associated with the shared access signature. | ||
* @param {ServiceGenerateAccountSasUrlOptions} [options={}] Optional parameters. | ||
* @returns {string} An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token. | ||
* @memberof BlobServiceClient | ||
*/ | ||
BlobServiceClient.prototype.generateAccountSasUrl = function (expiresOn, permissions, resourceTypes, options) { | ||
if (permissions === void 0) { permissions = AccountSASPermissions.parse("r"); } | ||
if (resourceTypes === void 0) { resourceTypes = "sco"; } | ||
if (options === void 0) { options = {}; } | ||
if (!(this.credential instanceof StorageSharedKeyCredential)) { | ||
throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential"); | ||
} | ||
if (expiresOn === undefined) { | ||
var now = new Date(); | ||
expiresOn = new Date(now.getTime() + 3600 * 1000); | ||
} | ||
var sas = generateAccountSASQueryParameters(__assign({ permissions: permissions, | ||
expiresOn: expiresOn, | ||
resourceTypes: resourceTypes, services: AccountSASServices.parse("b").toString() }, options), this.credential).toString(); | ||
return appendToURLQuery(this.url, sas); | ||
}; | ||
return BlobServiceClient; | ||
@@ -977,0 +1021,0 @@ }(StorageClient)); |
@@ -8,3 +8,3 @@ /* | ||
*/ | ||
export { Block, BlockBlobCommitBlockListHeaders, BlockBlobGetBlockListHeaders, BlockBlobStageBlockFromURLHeaders, BlockBlobStageBlockHeaders, BlockBlobUploadHeaders, BlockList, BlockLookupList, StorageError } from "../models/mappers"; | ||
export { Block, BlockBlobCommitBlockListHeaders, BlockBlobGetBlockListHeaders, BlockBlobPutBlobFromUrlHeaders, BlockBlobStageBlockFromURLHeaders, BlockBlobStageBlockHeaders, BlockBlobUploadHeaders, BlockList, BlockLookupList, StorageError } from "../models/mappers"; | ||
//# sourceMappingURL=blockBlobMappers.js.map |
@@ -208,2 +208,17 @@ /* | ||
}; | ||
export var blobDeleteType = { | ||
parameterPath: [ | ||
"options", | ||
"blobDeleteType" | ||
], | ||
mapper: { | ||
serializedName: "deletetype", | ||
type: { | ||
name: "Enum", | ||
allowedValues: [ | ||
"Permanent" | ||
] | ||
} | ||
} | ||
}; | ||
export var blobSequenceNumber = { | ||
@@ -675,2 +690,14 @@ parameterPath: [ | ||
}; | ||
export var copySourceBlobProperties = { | ||
parameterPath: [ | ||
"options", | ||
"copySourceBlobProperties" | ||
], | ||
mapper: { | ||
serializedName: "x-ms-copy-source-blob-properties", | ||
type: { | ||
name: "Boolean" | ||
} | ||
} | ||
}; | ||
export var defaultEncryptionScope = { | ||
@@ -1683,3 +1710,3 @@ parameterPath: [ | ||
serializedName: "x-ms-version", | ||
defaultValue: '2020-02-10', | ||
defaultValue: '2020-04-08', | ||
type: { | ||
@@ -1686,0 +1713,0 @@ name: "String" |
@@ -8,3 +8,3 @@ /* | ||
*/ | ||
export { BlobServiceProperties, BlobServiceStatistics, ContainerItem, ContainerProperties, CorsRule, FilterBlobItem, FilterBlobSegment, GeoReplication, KeyInfo, ListContainersSegmentResponse, Logging, Metrics, RetentionPolicy, ServiceFilterBlobsHeaders, ServiceGetAccountInfoHeaders, ServiceGetPropertiesHeaders, ServiceGetStatisticsHeaders, ServiceGetUserDelegationKeyHeaders, ServiceListContainersSegmentHeaders, ServiceSetPropertiesHeaders, ServiceSubmitBatchHeaders, StaticWebsite, StorageError, UserDelegationKey } from "../models/mappers"; | ||
export { BlobServiceProperties, BlobServiceStatistics, BlobTag, BlobTags, ContainerItem, ContainerProperties, CorsRule, FilterBlobItem, FilterBlobSegment, GeoReplication, KeyInfo, ListContainersSegmentResponse, Logging, Metrics, RetentionPolicy, ServiceFilterBlobsHeaders, ServiceGetAccountInfoHeaders, ServiceGetPropertiesHeaders, ServiceGetStatisticsHeaders, ServiceGetUserDelegationKeyHeaders, ServiceListContainersSegmentHeaders, ServiceSetPropertiesHeaders, ServiceSubmitBatchHeaders, StaticWebsite, StorageError, UserDelegationKey } from "../models/mappers"; | ||
//# sourceMappingURL=serviceMappers.js.map |
@@ -256,3 +256,4 @@ /* | ||
Parameters.versionId, | ||
Parameters.timeoutInSeconds | ||
Parameters.timeoutInSeconds, | ||
Parameters.blobDeleteType | ||
], | ||
@@ -973,3 +974,4 @@ headerParameters: [ | ||
Parameters.requestId, | ||
Parameters.ifTags | ||
Parameters.ifTags, | ||
Parameters.leaseId0 | ||
], | ||
@@ -1005,3 +1007,4 @@ responses: { | ||
Parameters.requestId, | ||
Parameters.ifTags | ||
Parameters.ifTags, | ||
Parameters.leaseId0 | ||
], | ||
@@ -1008,0 +1011,0 @@ requestBody: { |
@@ -30,2 +30,9 @@ /* | ||
}; | ||
BlockBlob.prototype.putBlobFromUrl = function (contentLength, copySource, options, callback) { | ||
return this.client.sendOperationRequest({ | ||
contentLength: contentLength, | ||
copySource: copySource, | ||
options: options | ||
}, putBlobFromUrlOperationSpec, callback); | ||
}; | ||
BlockBlob.prototype.stageBlock = function (blockId, contentLength, body, options, callback) { | ||
@@ -122,2 +129,57 @@ return this.client.sendOperationRequest({ | ||
}; | ||
var putBlobFromUrlOperationSpec = { | ||
httpMethod: "PUT", | ||
path: "{containerName}/{blob}", | ||
urlParameters: [ | ||
Parameters.url | ||
], | ||
queryParameters: [ | ||
Parameters.timeoutInSeconds | ||
], | ||
headerParameters: [ | ||
Parameters.transactionalContentMD5, | ||
Parameters.contentLength, | ||
Parameters.metadata, | ||
Parameters.encryptionScope, | ||
Parameters.tier0, | ||
Parameters.version, | ||
Parameters.requestId, | ||
Parameters.sourceContentMD5, | ||
Parameters.blobTagsString, | ||
Parameters.copySource, | ||
Parameters.copySourceBlobProperties, | ||
Parameters.blobType2, | ||
Parameters.blobContentType, | ||
Parameters.blobContentEncoding, | ||
Parameters.blobContentLanguage, | ||
Parameters.blobContentMD5, | ||
Parameters.blobCacheControl, | ||
Parameters.blobContentDisposition, | ||
Parameters.leaseId0, | ||
Parameters.encryptionKey, | ||
Parameters.encryptionKeySha256, | ||
Parameters.encryptionAlgorithm, | ||
Parameters.ifModifiedSince, | ||
Parameters.ifUnmodifiedSince, | ||
Parameters.ifMatch, | ||
Parameters.ifNoneMatch, | ||
Parameters.ifTags, | ||
Parameters.sourceIfModifiedSince, | ||
Parameters.sourceIfUnmodifiedSince, | ||
Parameters.sourceIfMatch, | ||
Parameters.sourceIfNoneMatch, | ||
Parameters.sourceIfTags | ||
], | ||
responses: { | ||
201: { | ||
headersMapper: Mappers.BlockBlobPutBlobFromUrlHeaders | ||
}, | ||
default: { | ||
bodyMapper: Mappers.StorageError, | ||
headersMapper: Mappers.BlockBlobPutBlobFromUrlHeaders | ||
} | ||
}, | ||
isXML: true, | ||
serializer: serializer | ||
}; | ||
var stageBlockOperationSpec = { | ||
@@ -124,0 +186,0 @@ httpMethod: "PUT", |
@@ -35,3 +35,3 @@ /* | ||
_this = _super.call(this, undefined, options) || this; | ||
_this.version = '2020-02-10'; | ||
_this.version = '2020-04-08'; | ||
_this.baseUri = "{url}"; | ||
@@ -38,0 +38,0 @@ _this.requestContentType = "application/json; charset=utf-8"; |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
export var SDK_VERSION = "12.3.1"; | ||
export var SERVICE_VERSION = "2020-02-10"; | ||
export var SERVICE_VERSION = "2020-04-08"; | ||
export var BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB | ||
@@ -6,0 +6,0 @@ export var BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB |
@@ -306,2 +306,22 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
/** | ||
* Append a string to URL query. | ||
* | ||
* @export | ||
* @param {string} url Source URL string. | ||
* @param {string} queryParts String to be appended to the URL query. | ||
* @returns {string} An updated URL string. | ||
*/ | ||
export function appendToURLQuery(url, queryParts) { | ||
var urlParsed = URLBuilder.parse(url); | ||
var query = urlParsed.getQuery(); | ||
if (query) { | ||
query += "&" + queryParts; | ||
} | ||
else { | ||
query = queryParts; | ||
} | ||
urlParsed.setQuery(query); | ||
return urlParsed.toString(); | ||
} | ||
/** | ||
* Rounds a date off to seconds. | ||
@@ -308,0 +328,0 @@ * |
{ | ||
"name": "@azure/storage-blob", | ||
"sdk-type": "client", | ||
"version": "12.3.1-alpha.20201204.1", | ||
"version": "12.3.1-alpha.20201207.1", | ||
"description": "Microsoft Azure Storage SDK for JavaScript - Blob", | ||
@@ -6,0 +6,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
6256585
76449