Skip to content

Commit 66d24e8

Browse files
authored
Merge pull request #474 from XiaoningLiu/v2.10.0
V2.10.0
2 parents f3810de + c92e450 commit 66d24e8

23 files changed

Lines changed: 14595 additions & 12200 deletions

ChangeLog.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Note: This is an Azure Storage only package. The all up Azure node sdk still has the old storage bits in there. In a future release, those storage bits will be removed and an npm dependency to this storage node sdk will
22
be taken. This is a GA release and the changes described below indicate the changes from the Azure node SDK 0.9.8 available here - https://github.com/Azure/azure-sdk-for-node.
33

4+
2018.06 Version 2.10.0
5+
6+
ALL
7+
* Updated storage service version to 2018-03-28.
8+
9+
BLOB
10+
* Fixed a bug that `DeleteRetentionPolicy.Days` should be `number` instead of `string` when calling `getServiceProperties`.
11+
* Added a method `getAccountProperties` to `blobService`.
12+
* Added a method `createBlockFromURL` to `blobService`.
13+
* Added support for static website service properties (in preview).
14+
415
2018.05 Version 2.9.0-preview
516

617
ALL
@@ -11,7 +22,7 @@ ALL
1122
BLOB
1223
* Added `createBlobServiceWithTokenCredential()` to create `BlobService` object with bearer tokens such as OAuth access token (in preview).
1324
* Added support for '$web' as a valid blob container name for static website.
14-
* Added support for write-once read-many containers.
25+
* Added support for write-once read-many containers (in preview).
1526
* The `Get Container Properties` and `List Containers` APIs now return two new properties indicating whether the container has an immutability policy or a legal hold.
1627
* The `Get Blob Properties` and `List Blobs` APIs now return the creation time of the blob as a property.
1728

browser/ChangeLog.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
Note: This is the change log file for Azure Storage JavaScript Client Library.
22

3+
2018.06 Version 2.10.100
4+
5+
ALL
6+
* Generated browser compatible JavaScript files based on Microsoft Azure Storage SDK for Node.js 2.10.0.
7+
* Updated storage service version to 2018-03-28.
8+
9+
BLOB
10+
* Fixed a bug that `DeleteRetentionPolicy.Days` should be `number` instead of `string` when calling `getServiceProperties`.
11+
* Added a method `getAccountProperties` to `blobService`.
12+
* Added a method `createBlockFromURL` to `blobService`.
13+
* Added support for static website service properties (in preview).
14+
315
2018.05 Version 2.9.100-preview
416

517
ALL
@@ -11,14 +23,14 @@ ALL
1123
BLOB
1224
* Added `createBlobServiceWithTokenCredential()` to create `BlobService` object with bearer tokens such as OAuth access token (in preview).
1325
* Added support for '$web' as a valid blob container name for static website.
14-
* Added support for write-once read-many containers.
26+
* Added support for write-once read-many containers (in preview).
1527
* The `Get Container Properties` and `List Containers` APIs now return two new properties indicating whether the container has an immutability policy or a legal hold.
1628
* The `Get Blob Properties` and `List Blobs` APIs now return the creation time of the blob as a property.
1729

1830
QUEUE
1931
* Added `createQueueServiceWithTokenCredential()` to create `QueueService` object with bearer tokens such as OAuth access token (in preview).
2032

21-
2018.04 Version 2.8.100+2.8.2
33+
2018.04 Version 2.8.100
2234

2335
* Fixed a bug that retry policy will not retry for XHR error in browsers.
2436
* Updated README.md under browser folder to make it more clear about the zip file downloading link.

lib/azure-storage.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,33 @@ exports.generateAccountSharedAccessSignature = function(storageAccountOrConnecti
314314
* @property {CorsRule[]} Cors.CorsRules Groups settings for a `[CORS rule]{@link CorsRule}`.
315315
*/
316316

317+
/**
318+
* The properties of a storage account.
319+
* @typedef {object} AccountProperties
320+
* @property {string} SkuName The header that specifies storage SKU, also known as account type.
321+
* @property {string} AccountKind The header that describes the flavour of the storage account, also known as account kind.
322+
*/
323+
324+
/**
325+
* The properties of a blob storage service, including properties of Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and Static Webiste configurations.
326+
* @typedef {object} BlobServiceProperties
327+
* @property {string} DefaultServiceVersion The default version of Storage Analytics currently in use.
328+
* @property {LoggingProperties} Logging The Logging settings.
329+
* @property {MetricsProperties} HourMetrics The HourMetrics settings provide a summary of request statistics grouped by API in hourly aggregates.
330+
* @property {MetricsProperties} MinuteMetrics The HourMetrics settings provide request statistics grouped by API for each minute.
331+
* @property {StaticWebsiteProperties} StaticWebsite The Azure Static Website settings.
332+
* @property {object} Cors Groups all CORS rules.
333+
* @property {CorsRule[]} Cors.CorsRules Groups settings for a `[CORS rule]{@link CorsRule}`.
334+
*/
335+
336+
/**
337+
* The Azure Static Website settings.
338+
* @typedef {object} StaticWebsiteProperties
339+
* @property {boolean} Enabled Whether feature of Static Website is enabled.
340+
* @property {string} IndexDocument Indicates index document page path.
341+
* @property {string} ErrorDocument404Path Indicates 404 document page path.
342+
*/
343+
317344
/**
318345
* The Azure Analytics logging settings.
319346
* @typedef {object} LoggingProperties
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// Copyright (c) Microsoft and contributors. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
//
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
// Module dependencies.
18+
var Constants = require('../util/constants');
19+
var HeaderConstants = Constants.HeaderConstants;
20+
21+
exports.parse = function (headers) {
22+
var accountPropertiesResult = {};
23+
24+
if (headers[HeaderConstants.SKU_NAME]) {
25+
accountPropertiesResult.SkuName = headers[HeaderConstants.SKU_NAME];
26+
}
27+
28+
if (headers[HeaderConstants.ACCOUNT_KIND]) {
29+
accountPropertiesResult.AccountKind = headers[HeaderConstants.ACCOUNT_KIND];
30+
}
31+
32+
return accountPropertiesResult;
33+
};

lib/common/models/servicepropertiesresult.js

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,38 @@ function serializeDeleteRetentionPolicy(doc, policy) {
8484
}
8585
}
8686

87+
function serializeStaticWebsite(doc, staticWebsite) {
88+
if (staticWebsite !== null) {
89+
if (typeof staticWebsite === 'undefined') {
90+
staticWebsite = {};
91+
}
92+
93+
if (typeof staticWebsite.Enabled !== 'undefined') {
94+
doc = doc.ele(ServicePropertiesConstants.ENABLED_ELEMENT)
95+
.txt(staticWebsite.Enabled)
96+
.up();
97+
} else {
98+
doc = doc.ele(ServicePropertiesConstants.ENABLED_ELEMENT)
99+
.txt(false)
100+
.up();
101+
}
102+
103+
if (typeof staticWebsite.IndexDocument !== 'undefined') {
104+
doc = doc.ele(ServicePropertiesConstants.DEFAULT_INDEX_DOCUMENT_ELEMENT)
105+
.txt(staticWebsite.IndexDocument)
106+
.up();
107+
}
108+
109+
if (typeof staticWebsite.ErrorDocument404Path !== 'undefined') {
110+
doc = doc.ele(ServicePropertiesConstants.DEFAULT_ERROR_DOCUMENT_404_PATH_ELEMENT)
111+
.txt(staticWebsite.ErrorDocument404Path)
112+
.up();
113+
}
114+
115+
doc = doc.up();
116+
}
117+
}
118+
87119
function serializeLogging(doc, logging) {
88120
if (typeof logging.Version !== 'undefined') {
89121
doc = doc.ele(ServicePropertiesConstants.VERSION_ELEMENT)
@@ -257,6 +289,12 @@ exports.serialize = function (servicePropertiesJs) {
257289
doc = doc.up();
258290
}
259291

292+
if (servicePropertiesJs.StaticWebsite) {
293+
doc = doc.ele(ServicePropertiesConstants.DEFAULT_STATIC_WEBSITE_ELEMENT);
294+
serializeStaticWebsite(doc, servicePropertiesJs.StaticWebsite);
295+
doc = doc.up();
296+
}
297+
260298
return doc.doc().toString();
261299
};
262300

@@ -390,12 +428,30 @@ function parseDeleteRetentionPolicy(deleteRetentionPolicyXml) {
390428
}
391429

392430
if (typeof deleteRetentionPolicyXml.Days !== 'undefined') {
393-
deleteRetentionPolicy.Days = deleteRetentionPolicyXml.Days;
431+
deleteRetentionPolicy.Days = parseInt(deleteRetentionPolicyXml.Days);
394432
}
395433

396434
return deleteRetentionPolicy;
397435
}
398436

437+
function parseStaticWebsite(staticWebsiteXml) {
438+
var staticWebsite = {};
439+
440+
if (typeof staticWebsiteXml.Enabled !== 'undefined') {
441+
staticWebsite.Enabled = staticWebsiteXml.Enabled === 'true';
442+
}
443+
444+
if (typeof staticWebsiteXml.IndexDocument !== 'undefined') {
445+
staticWebsite.IndexDocument = staticWebsiteXml.IndexDocument;
446+
}
447+
448+
if (typeof staticWebsiteXml.ErrorDocument404Path !== 'undefined') {
449+
staticWebsite.ErrorDocument404Path = staticWebsiteXml.ErrorDocument404Path;
450+
}
451+
452+
return staticWebsite;
453+
}
454+
399455
exports.parse = function (servicePropertiesXml) {
400456
var serviceProperties = {};
401457

@@ -423,5 +479,9 @@ exports.parse = function (servicePropertiesXml) {
423479
serviceProperties.DeleteRetentionPolicy = parseDeleteRetentionPolicy(servicePropertiesXml.DeleteRetentionPolicy);
424480
}
425481

482+
if (typeof servicePropertiesXml.StaticWebsite !== 'undefined') {
483+
serviceProperties.StaticWebsite = parseStaticWebsite(servicePropertiesXml.StaticWebsite);
484+
}
485+
426486
return serviceProperties;
427487
};

lib/common/util/constants.js

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var Constants = {
3737
* @const
3838
* @type {string}
3939
*/
40-
USER_AGENT_PRODUCT_VERSION: '2.9.0-preview',
40+
USER_AGENT_PRODUCT_VERSION: '2.10.0',
4141

4242
/**
4343
* The number of default concurrent requests for parallel operation.
@@ -470,7 +470,31 @@ var Constants = {
470470
* @const
471471
* @type {string}
472472
*/
473-
DEFAULT_DELETE_RETENTION_POLICY_ELEMENT: 'DeleteRetentionPolicy'
473+
DEFAULT_DELETE_RETENTION_POLICY_ELEMENT: 'DeleteRetentionPolicy',
474+
475+
/**
476+
* XML element for StaticWebsite.
477+
*
478+
* @const
479+
* @type {string}
480+
*/
481+
DEFAULT_STATIC_WEBSITE_ELEMENT: 'StaticWebsite',
482+
483+
/**
484+
* XML element for StaticWebsite/IndexDocument.
485+
*
486+
* @const
487+
* @type {string}
488+
*/
489+
DEFAULT_INDEX_DOCUMENT_ELEMENT: 'IndexDocument',
490+
491+
/**
492+
* XML element for StaticWebsite/ErrorDocument404Path.
493+
*
494+
* @const
495+
* @type {string}
496+
*/
497+
DEFAULT_ERROR_DOCUMENT_404_PATH_ELEMENT: 'ErrorDocument404Path'
474498
},
475499

476500
/**
@@ -1426,6 +1450,21 @@ var Constants = {
14261450
*/
14271451
JSON_CONTENT_TYPE_VALUE: 'application/json;',
14281452

1453+
/**
1454+
* The header that specifies storage SKU, also known as account type.
1455+
*
1456+
* @const
1457+
* @type {string}
1458+
*/
1459+
SKU_NAME: 'x-ms-sku-name',
1460+
1461+
/**
1462+
* The header that describes the flavour of the storage account, also known as account kind.
1463+
*
1464+
* @const
1465+
* @type {string}
1466+
*/
1467+
ACCOUNT_KIND: 'x-ms-account-kind',
14291468

14301469
/**
14311470
* The header that specifies lease ID.
@@ -1563,6 +1602,14 @@ var Constants = {
15631602
*/
15641603
RANGE: 'Range',
15651604

1605+
/**
1606+
* The Source Range header.
1607+
*
1608+
* @const
1609+
* @type {string}
1610+
*/
1611+
SOURCE_RANGE: 'x-ms-source-range',
1612+
15661613
/**
15671614
* The header that specifies if the request will populate the ContentMD5 header for range gets.
15681615
*
@@ -1705,7 +1752,7 @@ var Constants = {
17051752
* @const
17061753
* @type {string}
17071754
*/
1708-
TARGET_STORAGE_VERSION: '2017-11-09',
1755+
TARGET_STORAGE_VERSION: '2018-03-28',
17091756

17101757
/**
17111758
* The UserAgent header.

lib/common/util/validate.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ exports.isValidEnumValue = function (value, list, callback) {
7979
* @return {boolean}
8080
*/
8181
exports.isValidUri = function (uri) {
82-
if (!check.isURL(uri)){
82+
if (!check.isURL(uri, { 'require_tld': false })){
8383
throw new URIError('The provided URI "' + uri + '" is invalid.');
8484
}
8585
return true;
@@ -97,12 +97,12 @@ exports.isValidHost= function (host) {
9797
} else {
9898
var storageHost = {};
9999
storageHost.primaryHost = _.isString(host) ? host : host.primaryHost;
100-
if (storageHost.primaryHost && !check.isURL(storageHost.primaryHost)){
100+
if (storageHost.primaryHost && !check.isURL(storageHost.primaryHost, { 'require_tld': false })){
101101
throw new URIError('The provided URI "' + storageHost.primaryHost + '" is invalid.');
102102
}
103103

104104
storageHost.secondaryHost = _.isString(host) ? undefined : host.secondaryHost;
105-
if (storageHost.secondaryHost && !check.isURL(storageHost.secondaryHost)){
105+
if (storageHost.secondaryHost && !check.isURL(storageHost.secondaryHost, { 'require_tld': false })){
106106
throw new URIError('The provided URI "' + storageHost.secondaryHost + '" is invalid.');
107107
}
108108

0 commit comments

Comments
 (0)