Skip to content

Commit

Permalink
Merge pull request #474 from XiaoningLiu/v2.10.0
Browse files Browse the repository at this point in the history
V2.10.0
  • Loading branch information
vinjiang authored Jun 27, 2018
2 parents f3810de + c92e450 commit 66d24e8
Show file tree
Hide file tree
Showing 23 changed files with 14,595 additions and 12,200 deletions.
13 changes: 12 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
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
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.

2018.06 Version 2.10.0

ALL
* Updated storage service version to 2018-03-28.

BLOB
* Fixed a bug that `DeleteRetentionPolicy.Days` should be `number` instead of `string` when calling `getServiceProperties`.
* Added a method `getAccountProperties` to `blobService`.
* Added a method `createBlockFromURL` to `blobService`.
* Added support for static website service properties (in preview).

2018.05 Version 2.9.0-preview

ALL
Expand All @@ -11,7 +22,7 @@ ALL
BLOB
* Added `createBlobServiceWithTokenCredential()` to create `BlobService` object with bearer tokens such as OAuth access token (in preview).
* Added support for '$web' as a valid blob container name for static website.
* Added support for write-once read-many containers.
* Added support for write-once read-many containers (in preview).
* 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.
* The `Get Blob Properties` and `List Blobs` APIs now return the creation time of the blob as a property.

Expand Down
16 changes: 14 additions & 2 deletions browser/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
Note: This is the change log file for Azure Storage JavaScript Client Library.

2018.06 Version 2.10.100

ALL
* Generated browser compatible JavaScript files based on Microsoft Azure Storage SDK for Node.js 2.10.0.
* Updated storage service version to 2018-03-28.

BLOB
* Fixed a bug that `DeleteRetentionPolicy.Days` should be `number` instead of `string` when calling `getServiceProperties`.
* Added a method `getAccountProperties` to `blobService`.
* Added a method `createBlockFromURL` to `blobService`.
* Added support for static website service properties (in preview).

2018.05 Version 2.9.100-preview

ALL
Expand All @@ -11,14 +23,14 @@ ALL
BLOB
* Added `createBlobServiceWithTokenCredential()` to create `BlobService` object with bearer tokens such as OAuth access token (in preview).
* Added support for '$web' as a valid blob container name for static website.
* Added support for write-once read-many containers.
* Added support for write-once read-many containers (in preview).
* 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.
* The `Get Blob Properties` and `List Blobs` APIs now return the creation time of the blob as a property.

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

2018.04 Version 2.8.100+2.8.2
2018.04 Version 2.8.100

* Fixed a bug that retry policy will not retry for XHR error in browsers.
* Updated README.md under browser folder to make it more clear about the zip file downloading link.
Expand Down
27 changes: 27 additions & 0 deletions lib/azure-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,33 @@ exports.generateAccountSharedAccessSignature = function(storageAccountOrConnecti
* @property {CorsRule[]} Cors.CorsRules Groups settings for a `[CORS rule]{@link CorsRule}`.
*/

/**
* The properties of a storage account.
* @typedef {object} AccountProperties
* @property {string} SkuName The header that specifies storage SKU, also known as account type.
* @property {string} AccountKind The header that describes the flavour of the storage account, also known as account kind.
*/

/**
* The properties of a blob storage service, including properties of Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and Static Webiste configurations.
* @typedef {object} BlobServiceProperties
* @property {string} DefaultServiceVersion The default version of Storage Analytics currently in use.
* @property {LoggingProperties} Logging The Logging settings.
* @property {MetricsProperties} HourMetrics The HourMetrics settings provide a summary of request statistics grouped by API in hourly aggregates.
* @property {MetricsProperties} MinuteMetrics The HourMetrics settings provide request statistics grouped by API for each minute.
* @property {StaticWebsiteProperties} StaticWebsite The Azure Static Website settings.
* @property {object} Cors Groups all CORS rules.
* @property {CorsRule[]} Cors.CorsRules Groups settings for a `[CORS rule]{@link CorsRule}`.
*/

/**
* The Azure Static Website settings.
* @typedef {object} StaticWebsiteProperties
* @property {boolean} Enabled Whether feature of Static Website is enabled.
* @property {string} IndexDocument Indicates index document page path.
* @property {string} ErrorDocument404Path Indicates 404 document page path.
*/

/**
* The Azure Analytics logging settings.
* @typedef {object} LoggingProperties
Expand Down
33 changes: 33 additions & 0 deletions lib/common/models/accountpropertiesresult.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//

// Module dependencies.
var Constants = require('../util/constants');
var HeaderConstants = Constants.HeaderConstants;

exports.parse = function (headers) {
var accountPropertiesResult = {};

if (headers[HeaderConstants.SKU_NAME]) {
accountPropertiesResult.SkuName = headers[HeaderConstants.SKU_NAME];
}

if (headers[HeaderConstants.ACCOUNT_KIND]) {
accountPropertiesResult.AccountKind = headers[HeaderConstants.ACCOUNT_KIND];
}

return accountPropertiesResult;
};
62 changes: 61 additions & 1 deletion lib/common/models/servicepropertiesresult.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,38 @@ function serializeDeleteRetentionPolicy(doc, policy) {
}
}

function serializeStaticWebsite(doc, staticWebsite) {
if (staticWebsite !== null) {
if (typeof staticWebsite === 'undefined') {
staticWebsite = {};
}

if (typeof staticWebsite.Enabled !== 'undefined') {
doc = doc.ele(ServicePropertiesConstants.ENABLED_ELEMENT)
.txt(staticWebsite.Enabled)
.up();
} else {
doc = doc.ele(ServicePropertiesConstants.ENABLED_ELEMENT)
.txt(false)
.up();
}

if (typeof staticWebsite.IndexDocument !== 'undefined') {
doc = doc.ele(ServicePropertiesConstants.DEFAULT_INDEX_DOCUMENT_ELEMENT)
.txt(staticWebsite.IndexDocument)
.up();
}

if (typeof staticWebsite.ErrorDocument404Path !== 'undefined') {
doc = doc.ele(ServicePropertiesConstants.DEFAULT_ERROR_DOCUMENT_404_PATH_ELEMENT)
.txt(staticWebsite.ErrorDocument404Path)
.up();
}

doc = doc.up();
}
}

function serializeLogging(doc, logging) {
if (typeof logging.Version !== 'undefined') {
doc = doc.ele(ServicePropertiesConstants.VERSION_ELEMENT)
Expand Down Expand Up @@ -257,6 +289,12 @@ exports.serialize = function (servicePropertiesJs) {
doc = doc.up();
}

if (servicePropertiesJs.StaticWebsite) {
doc = doc.ele(ServicePropertiesConstants.DEFAULT_STATIC_WEBSITE_ELEMENT);
serializeStaticWebsite(doc, servicePropertiesJs.StaticWebsite);
doc = doc.up();
}

return doc.doc().toString();
};

Expand Down Expand Up @@ -390,12 +428,30 @@ function parseDeleteRetentionPolicy(deleteRetentionPolicyXml) {
}

if (typeof deleteRetentionPolicyXml.Days !== 'undefined') {
deleteRetentionPolicy.Days = deleteRetentionPolicyXml.Days;
deleteRetentionPolicy.Days = parseInt(deleteRetentionPolicyXml.Days);
}

return deleteRetentionPolicy;
}

function parseStaticWebsite(staticWebsiteXml) {
var staticWebsite = {};

if (typeof staticWebsiteXml.Enabled !== 'undefined') {
staticWebsite.Enabled = staticWebsiteXml.Enabled === 'true';
}

if (typeof staticWebsiteXml.IndexDocument !== 'undefined') {
staticWebsite.IndexDocument = staticWebsiteXml.IndexDocument;
}

if (typeof staticWebsiteXml.ErrorDocument404Path !== 'undefined') {
staticWebsite.ErrorDocument404Path = staticWebsiteXml.ErrorDocument404Path;
}

return staticWebsite;
}

exports.parse = function (servicePropertiesXml) {
var serviceProperties = {};

Expand Down Expand Up @@ -423,5 +479,9 @@ exports.parse = function (servicePropertiesXml) {
serviceProperties.DeleteRetentionPolicy = parseDeleteRetentionPolicy(servicePropertiesXml.DeleteRetentionPolicy);
}

if (typeof servicePropertiesXml.StaticWebsite !== 'undefined') {
serviceProperties.StaticWebsite = parseStaticWebsite(servicePropertiesXml.StaticWebsite);
}

return serviceProperties;
};
53 changes: 50 additions & 3 deletions lib/common/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var Constants = {
* @const
* @type {string}
*/
USER_AGENT_PRODUCT_VERSION: '2.9.0-preview',
USER_AGENT_PRODUCT_VERSION: '2.10.0',

/**
* The number of default concurrent requests for parallel operation.
Expand Down Expand Up @@ -470,7 +470,31 @@ var Constants = {
* @const
* @type {string}
*/
DEFAULT_DELETE_RETENTION_POLICY_ELEMENT: 'DeleteRetentionPolicy'
DEFAULT_DELETE_RETENTION_POLICY_ELEMENT: 'DeleteRetentionPolicy',

/**
* XML element for StaticWebsite.
*
* @const
* @type {string}
*/
DEFAULT_STATIC_WEBSITE_ELEMENT: 'StaticWebsite',

/**
* XML element for StaticWebsite/IndexDocument.
*
* @const
* @type {string}
*/
DEFAULT_INDEX_DOCUMENT_ELEMENT: 'IndexDocument',

/**
* XML element for StaticWebsite/ErrorDocument404Path.
*
* @const
* @type {string}
*/
DEFAULT_ERROR_DOCUMENT_404_PATH_ELEMENT: 'ErrorDocument404Path'
},

/**
Expand Down Expand Up @@ -1426,6 +1450,21 @@ var Constants = {
*/
JSON_CONTENT_TYPE_VALUE: 'application/json;',

/**
* The header that specifies storage SKU, also known as account type.
*
* @const
* @type {string}
*/
SKU_NAME: 'x-ms-sku-name',

/**
* The header that describes the flavour of the storage account, also known as account kind.
*
* @const
* @type {string}
*/
ACCOUNT_KIND: 'x-ms-account-kind',

/**
* The header that specifies lease ID.
Expand Down Expand Up @@ -1563,6 +1602,14 @@ var Constants = {
*/
RANGE: 'Range',

/**
* The Source Range header.
*
* @const
* @type {string}
*/
SOURCE_RANGE: 'x-ms-source-range',

/**
* The header that specifies if the request will populate the ContentMD5 header for range gets.
*
Expand Down Expand Up @@ -1705,7 +1752,7 @@ var Constants = {
* @const
* @type {string}
*/
TARGET_STORAGE_VERSION: '2017-11-09',
TARGET_STORAGE_VERSION: '2018-03-28',

/**
* The UserAgent header.
Expand Down
6 changes: 3 additions & 3 deletions lib/common/util/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ exports.isValidEnumValue = function (value, list, callback) {
* @return {boolean}
*/
exports.isValidUri = function (uri) {
if (!check.isURL(uri)){
if (!check.isURL(uri, { 'require_tld': false })){
throw new URIError('The provided URI "' + uri + '" is invalid.');
}
return true;
Expand All @@ -97,12 +97,12 @@ exports.isValidHost= function (host) {
} else {
var storageHost = {};
storageHost.primaryHost = _.isString(host) ? host : host.primaryHost;
if (storageHost.primaryHost && !check.isURL(storageHost.primaryHost)){
if (storageHost.primaryHost && !check.isURL(storageHost.primaryHost, { 'require_tld': false })){
throw new URIError('The provided URI "' + storageHost.primaryHost + '" is invalid.');
}

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

Expand Down
Loading

0 comments on commit 66d24e8

Please sign in to comment.