Comparing version 6.8.0 to 6.9.0
@@ -5,4 +5,4 @@ # Change Log | ||
<a name="6.8.0"></a> | ||
# [6.8.0](https://github.com/aliyun/oss-nodejs-sdk/compare/v6.5.0...v6.8.0) (2020-05-12) | ||
<a name="6.9.0"></a> | ||
# [6.9.0](https://github.com/aliyun/oss-nodejs-sdk/compare/v6.8.0...v6.9.0) (2020-06-05) | ||
@@ -12,4 +12,14 @@ | ||
* _signatureForURL bug ([#772](https://github.com/aliyun/oss-nodejs-sdk/issues/772)) ([cef1840](https://github.com/aliyun/oss-nodejs-sdk/commit/cef1840)) | ||
* not use compress lib ([ab73899](https://github.com/aliyun/oss-nodejs-sdk/commit/ab73899)) | ||
* _unSupportBrowserTip ([#755](https://github.com/aliyun/oss-nodejs-sdk/issues/755)) ([8ed3228](https://github.com/aliyun/oss-nodejs-sdk/commit/8ed3228)) | ||
* add CORS for server-side-encryption ([449f908](https://github.com/aliyun/oss-nodejs-sdk/commit/449f908)) | ||
* add putSymlink getSymlink deleteMulti getObjectMeta for browser ([#786](https://github.com/aliyun/oss-nodejs-sdk/issues/786)) ([807c7e1](https://github.com/aliyun/oss-nodejs-sdk/commit/807c7e1)) | ||
* add successStatus ([#762](https://github.com/aliyun/oss-nodejs-sdk/issues/762)) ([0ef0fe2](https://github.com/aliyun/oss-nodejs-sdk/commit/0ef0fe2)) | ||
* browser端,去除没有使用的 sha256.js 文件 ([#780](https://github.com/aliyun/oss-nodejs-sdk/issues/780)) ([d721265](https://github.com/aliyun/oss-nodejs-sdk/commit/d721265)) | ||
* checkBucketName bug ([#749](https://github.com/aliyun/oss-nodejs-sdk/issues/749)) ([67275bd](https://github.com/aliyun/oss-nodejs-sdk/commit/67275bd)) | ||
* checkBucketName bug ([#763](https://github.com/aliyun/oss-nodejs-sdk/issues/763)) ([0a3c64c](https://github.com/aliyun/oss-nodejs-sdk/commit/0a3c64c)) | ||
* delete unless code and delete invalid Content-Type ([#805](https://github.com/aliyun/oss-nodejs-sdk/issues/805)) ([72f55bb](https://github.com/aliyun/oss-nodejs-sdk/commit/72f55bb)) | ||
* getBucketVersions result has no prefixes ([#799](https://github.com/aliyun/oss-nodejs-sdk/issues/799)) ([390b449](https://github.com/aliyun/oss-nodejs-sdk/commit/390b449)) | ||
* proto.put TypeError text ([#771](https://github.com/aliyun/oss-nodejs-sdk/issues/771)) ([ffed08c](https://github.com/aliyun/oss-nodejs-sdk/commit/ffed08c)) | ||
* putBucketWebsite testting ([#785](https://github.com/aliyun/oss-nodejs-sdk/issues/785)) ([7a11eda](https://github.com/aliyun/oss-nodejs-sdk/commit/7a11eda)) | ||
* putStream can not close request when stream destroyed ([#782](https://github.com/aliyun/oss-nodejs-sdk/issues/782)) ([c7ceedd](https://github.com/aliyun/oss-nodejs-sdk/commit/c7ceedd)) | ||
@@ -19,8 +29,28 @@ | ||
* bump 6.4.0 ([#722](https://github.com/aliyun/oss-nodejs-sdk/issues/722)) ([f63e40b](https://github.com/aliyun/oss-nodejs-sdk/commit/f63e40b)), closes [#698](https://github.com/aliyun/oss-nodejs-sdk/issues/698) [#703](https://github.com/aliyun/oss-nodejs-sdk/issues/703) [#701](https://github.com/aliyun/oss-nodejs-sdk/issues/701) [#709](https://github.com/aliyun/oss-nodejs-sdk/issues/709) [#712](https://github.com/aliyun/oss-nodejs-sdk/issues/712) [#719](https://github.com/aliyun/oss-nodejs-sdk/issues/719) [#718](https://github.com/aliyun/oss-nodejs-sdk/issues/718) [#715](https://github.com/aliyun/oss-nodejs-sdk/issues/715) [#707](https://github.com/aliyun/oss-nodejs-sdk/issues/707) [#721](https://github.com/aliyun/oss-nodejs-sdk/issues/721) | ||
* remove proto._statFile ([#770](https://github.com/aliyun/oss-nodejs-sdk/issues/770)) ([fed2ba7](https://github.com/aliyun/oss-nodejs-sdk/commit/fed2ba7)) | ||
* support multiversion api ([#784](https://github.com/aliyun/oss-nodejs-sdk/issues/784)) ([2de5afc](https://github.com/aliyun/oss-nodejs-sdk/commit/2de5afc)), closes [#755](https://github.com/aliyun/oss-nodejs-sdk/issues/755) [#749](https://github.com/aliyun/oss-nodejs-sdk/issues/749) [#744](https://github.com/aliyun/oss-nodejs-sdk/issues/744) [#676](https://github.com/aliyun/oss-nodejs-sdk/issues/676) [#736](https://github.com/aliyun/oss-nodejs-sdk/issues/736) [#757](https://github.com/aliyun/oss-nodejs-sdk/issues/757) [#756](https://github.com/aliyun/oss-nodejs-sdk/issues/756) [#751](https://github.com/aliyun/oss-nodejs-sdk/issues/751) [#739](https://github.com/aliyun/oss-nodejs-sdk/issues/739) [#759](https://github.com/aliyun/oss-nodejs-sdk/issues/759) [#762](https://github.com/aliyun/oss-nodejs-sdk/issues/762) [#763](https://github.com/aliyun/oss-nodejs-sdk/issues/763) [#771](https://github.com/aliyun/oss-nodejs-sdk/issues/771) [#776](https://github.com/aliyun/oss-nodejs-sdk/issues/776) [#750](https://github.com/aliyun/oss-nodejs-sdk/issues/750) [#781](https://github.com/aliyun/oss-nodejs-sdk/issues/781) [#780](https://github.com/aliyun/oss-nodejs-sdk/issues/780) [#783](https://github.com/aliyun/oss-nodejs-sdk/issues/783) [#785](https://github.com/aliyun/oss-nodejs-sdk/issues/785) | ||
* **node:** bucket policy ([#751](https://github.com/aliyun/oss-nodejs-sdk/issues/751)) ([2d2b33a](https://github.com/aliyun/oss-nodejs-sdk/commit/2d2b33a)) | ||
* **node:** uploadPart support file stream ([#798](https://github.com/aliyun/oss-nodejs-sdk/issues/798)) ([50321d4](https://github.com/aliyun/oss-nodejs-sdk/commit/50321d4)) | ||
* browser端,将 is-type-of 包的依赖处理为 shim ([#801](https://github.com/aliyun/oss-nodejs-sdk/issues/801)) ([6f4ae51](https://github.com/aliyun/oss-nodejs-sdk/commit/6f4ae51)) | ||
* image processing ([#744](https://github.com/aliyun/oss-nodejs-sdk/issues/744)) ([02d59da](https://github.com/aliyun/oss-nodejs-sdk/commit/02d59da)), closes [#676](https://github.com/aliyun/oss-nodejs-sdk/issues/676) | ||
* multiversion ([#750](https://github.com/aliyun/oss-nodejs-sdk/issues/750)) ([9e8bb20](https://github.com/aliyun/oss-nodejs-sdk/commit/9e8bb20)) | ||
* putBucketWebsite support new parameter ([#736](https://github.com/aliyun/oss-nodejs-sdk/issues/736)) ([e1cb438](https://github.com/aliyun/oss-nodejs-sdk/commit/e1cb438)) | ||
* signatureUrl support trafficLimit ([#756](https://github.com/aliyun/oss-nodejs-sdk/issues/756)) ([a57315f](https://github.com/aliyun/oss-nodejs-sdk/commit/a57315f)) | ||
* support for the latest putBucketLifecycle api features ([#757](https://github.com/aliyun/oss-nodejs-sdk/issues/757)) ([17c2984](https://github.com/aliyun/oss-nodejs-sdk/commit/17c2984)) | ||
* update mime, use mime/lite replace mime and use shims/debug.js replace debug in browser ([#802](https://github.com/aliyun/oss-nodejs-sdk/issues/802)) ([b4d1c56](https://github.com/aliyun/oss-nodejs-sdk/commit/b4d1c56)) | ||
<a name="6.8.0"></a> | ||
# [6.8.0](https://github.com/aliyun/oss-nodejs-sdk/compare/v6.5.0...v6.8.0) (2020-05-12) | ||
### Bug Fixes | ||
* **browser:** remove proto._statFile ([#770](https://github.com/aliyun/oss-nodejs-sdk/issues/770 | ||
)) ([fed2ba7 | ||
](https://github.com/aliyun/oss-nodejs-sdk/commit/fed2ba7)) | ||
* **browser:** remove sha256.js | ||
### Features | ||
* support multiversion api | ||
<a name="6.7.0"></a> | ||
@@ -33,11 +63,5 @@ # [6.7.0](https://github.com/aliyun/oss-nodejs-sdk/compare/v6.5.0...v6.7.0) (2020-04-17) | ||
* _signatureForURL bug ([#772](https://github.com/aliyun/oss-nodejs-sdk/issues/772)) ([cef1840](https://github.com/aliyun/oss-nodejs-sdk/commit/cef1840)) | ||
* not use compress lib ([ab73899](https://github.com/aliyun/oss-nodejs-sdk/commit/ab73899)) | ||
### Features | ||
* bump 6.4.0 ([#722](https://github.com/aliyun/oss-nodejs-sdk/issues/722)) ([f63e40b](https://github.com/aliyun/oss-nodejs-sdk/commit/f63e40b)), closes [#698](https://github.com/aliyun/oss-nodejs-sdk/issues/698) [#703](https://github.com/aliyun/oss-nodejs-sdk/issues/703) [#701](https://github.com/aliyun/oss-nodejs-sdk/issues/701) [#709](https://github.com/aliyun/oss-nodejs-sdk/issues/709) [#712](https://github.com/aliyun/oss-nodejs-sdk/issues/712) [#719](https://github.com/aliyun/oss-nodejs-sdk/issues/719) [#718](https://github.com/aliyun/oss-nodejs-sdk/issues/718) [#715](https://github.com/aliyun/oss-nodejs-sdk/issues/715) [#707](https://github.com/aliyun/oss-nodejs-sdk/issues/707) [#721](https://github.com/aliyun/oss-nodejs-sdk/issues/721) | ||
<a name="6.6.0"></a> | ||
@@ -44,0 +68,0 @@ # [6.6.0](https://github.com/aliyun/oss-nodejs-sdk/compare/v6.5.0...v6.6.0) (2020-04-07) |
const debug = require('debug')('ali-oss'); | ||
const crypto = require('crypto'); | ||
const path = require('path'); | ||
const copy = require('copy-to'); | ||
const mime = require('mime'); | ||
const xml = require('xml2js'); | ||
@@ -15,3 +12,2 @@ const AgentKeepalive = require('agentkeepalive'); | ||
const pkg = require('./version'); | ||
const dateFormat = require('dateformat'); | ||
const bowser = require('bowser'); | ||
@@ -21,9 +17,6 @@ const signUtils = require('../common/signUtils'); | ||
const _initOptions = require('../common/client/initOptions'); | ||
const createRequest = require('../common/utils/createRequest'); | ||
const globalHttpAgent = new AgentKeepalive(); | ||
function getHeader(headers, name) { | ||
return headers[name] || headers[name.toLowerCase()]; | ||
} | ||
function _unSupportBrowserTip() { | ||
@@ -173,70 +166,2 @@ const { name, version } = platform; | ||
/** | ||
* create request params | ||
* See `request` | ||
* @api private | ||
*/ | ||
proto.createRequest = function createRequest(params) { | ||
const headers = { | ||
'x-oss-date': dateFormat(+new Date() + this.options.amendTimeSkewed, 'UTC:ddd, dd mmm yyyy HH:MM:ss \'GMT\''), | ||
'x-oss-user-agent': this.userAgent | ||
}; | ||
if (this.options.isRequestPay) { | ||
Object.assign(headers, { 'x-oss-request-payer': 'requester' }); | ||
} | ||
if (this.options.stsToken) { | ||
headers['x-oss-security-token'] = this.options.stsToken; | ||
} | ||
copy(params.headers).to(headers); | ||
if (!getHeader(headers, 'Content-Type')) { | ||
if (params.mime === mime.default_type) { | ||
params.mime = ''; | ||
} | ||
if (params.mime && params.mime.indexOf('/') > 0) { | ||
headers['Content-Type'] = params.mime; | ||
} else { | ||
headers['Content-Type'] = mime.getType(params.mime || path.extname(params.object || '')) || 'application/octet-stream'; | ||
} | ||
} | ||
if (params.content) { | ||
headers['Content-Md5'] = crypto | ||
.createHash('md5') | ||
.update(Buffer.from(params.content, 'utf8')) | ||
.digest('base64'); | ||
if (!headers['Content-Length']) { | ||
headers['Content-Length'] = params.content.length; | ||
} | ||
} | ||
const authResource = this._getResource(params); | ||
headers.authorization = this.authorization(params.method, authResource, params.subres, headers); | ||
const url = this._getReqUrl(params); | ||
this.debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream, 'info'); | ||
const timeout = params.timeout || this.options.timeout; | ||
const reqParams = { | ||
agent: this.agent, | ||
method: params.method, | ||
content: params.content, | ||
stream: params.stream, | ||
headers, | ||
timeout, | ||
writeStream: params.writeStream, | ||
customResponse: params.customResponse, | ||
ctx: params.ctx || this.ctx | ||
}; | ||
return { | ||
url, | ||
params: reqParams | ||
}; | ||
}; | ||
/** | ||
* request oss server | ||
@@ -261,3 +186,3 @@ * @param {Object} params | ||
proto.request = async function request(params) { | ||
const reqParams = this.createRequest(params); | ||
const reqParams = createRequest.call(this, params); | ||
@@ -264,0 +189,0 @@ if (!this.options.useFetch) { |
@@ -286,8 +286,2 @@ | ||
} | ||
// else if (is.string(file)) { | ||
// return fs.createReadStream(file, { | ||
// start: start, | ||
// end: end - 1 | ||
// }); | ||
// } | ||
@@ -294,0 +288,0 @@ throw new Error('_createStream requires File/Blob.'); |
@@ -171,2 +171,6 @@ | ||
merge(proto, require('../common/object/get')); | ||
merge(proto, require('../common/object/putSymlink')); | ||
merge(proto, require('../common/object/getSymlink')); | ||
merge(proto, require('../common/object/deleteMulti')); | ||
merge(proto, require('../common/object/getObjectMeta')); | ||
@@ -173,0 +177,0 @@ proto.putMeta = async function putMeta(name, meta, options) { |
@@ -1,1 +0,1 @@ | ||
exports.version="6.8.0" | ||
exports.version="6.9.0" |
const debug = require('debug')('ali-oss'); | ||
const sendToWormhole = require('stream-wormhole'); | ||
const crypto = require('crypto'); | ||
const path = require('path'); | ||
const copy = require('copy-to'); | ||
const mime = require('mime'); | ||
const xml = require('xml2js'); | ||
@@ -18,3 +15,2 @@ const AgentKeepalive = require('agentkeepalive'); | ||
const pkg = require('../package.json'); | ||
const dateFormat = require('dateformat'); | ||
const bowser = require('bowser'); | ||
@@ -24,2 +20,3 @@ const signUtils = require('./common/signUtils'); | ||
const _initOptions = require('./common/client/initOptions'); | ||
const createRequest = require('./common/utils/createRequest'); | ||
@@ -29,7 +26,2 @@ const globalHttpAgent = new AgentKeepalive(); | ||
function getHeader(headers, name) { | ||
return headers[name] || headers[name.toLowerCase()]; | ||
} | ||
function Client(options, ctx) { | ||
@@ -160,76 +152,2 @@ if (!(this instanceof Client)) { | ||
/** | ||
* create request params | ||
* See `request` | ||
* @api private | ||
*/ | ||
proto.createRequest = function createRequest(params) { | ||
const headers = { | ||
'x-oss-date': dateFormat(new Date(), 'UTC:ddd, dd mmm yyyy HH:MM:ss \'GMT\''), | ||
'x-oss-user-agent': this.userAgent, | ||
'User-Agent': this.userAgent | ||
}; | ||
if (this.options.isRequestPay) { | ||
Object.assign(headers, { 'x-oss-request-payer': 'requester' }); | ||
} | ||
if (this.options.stsToken) { | ||
headers['x-oss-security-token'] = this.options.stsToken; | ||
} | ||
copy(params.headers).to(headers); | ||
if (!getHeader(headers, 'Content-Type')) { | ||
if (params.mime === mime.default_type) { | ||
params.mime = ''; | ||
} | ||
if (params.mime && params.mime.indexOf('/') > 0) { | ||
headers['Content-Type'] = params.mime; | ||
} else { | ||
headers['Content-Type'] = mime.lookup(params.mime || path.extname(params.object || '')); | ||
} | ||
} | ||
if (params.content) { | ||
headers['Content-Md5'] = crypto | ||
.createHash('md5') | ||
.update(Buffer.from(params.content, 'utf8')) | ||
.digest('base64'); | ||
if (!headers['Content-Length']) { | ||
headers['Content-Length'] = params.content.length; | ||
} | ||
} | ||
const authResource = this._getResource(params); | ||
headers.authorization = this.authorization(params.method, authResource, params.subres, headers); | ||
const url = this._getReqUrl(params); | ||
debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream); | ||
const timeout = params.timeout || this.options.timeout; | ||
const reqParams = { | ||
method: params.method, | ||
content: params.content, | ||
stream: params.stream, | ||
headers, | ||
timeout, | ||
writeStream: params.writeStream, | ||
customResponse: params.customResponse, | ||
ctx: params.ctx || this.ctx | ||
}; | ||
if (this.agent) { | ||
reqParams.agent = this.agent; | ||
} | ||
if (this.httpsAgent) { | ||
reqParams.httpsAgent = this.httpsAgent; | ||
} | ||
return { | ||
url, | ||
params: reqParams | ||
}; | ||
}; | ||
/** | ||
* request oss server | ||
@@ -254,3 +172,3 @@ * @param {Object} params | ||
proto.request = async function request(params) { | ||
const reqParams = this.createRequest(params); | ||
const reqParams = createRequest.call(this, params); | ||
let result; | ||
@@ -257,0 +175,0 @@ let reqErr; |
/* eslint-disable no-use-before-define */ | ||
const proto = exports; | ||
const isObject = require('../utils/isObject'); | ||
const isArray = require('../utils/isArray'); | ||
@@ -50,3 +51,3 @@ | ||
if (deleteMarker) { | ||
if (!Array.isArray(deleteMarker)) { | ||
if (!isArray(deleteMarker)) { | ||
deleteMarker = [deleteMarker]; | ||
@@ -64,2 +65,9 @@ } | ||
} | ||
let prefixes = result.data.CommonPrefixes || null; | ||
if (prefixes) { | ||
if (!isArray(prefixes)) { | ||
prefixes = [prefixes]; | ||
} | ||
prefixes = prefixes.map(item => item.Prefix); | ||
} | ||
return { | ||
@@ -69,2 +77,3 @@ res: result.res, | ||
deleteMarker, | ||
prefixes, | ||
nextMarker: result.data.NextMarker || null, | ||
@@ -71,0 +80,0 @@ NextVersionIdMarker: result.data.NextVersionIdMarker || null, |
@@ -40,3 +40,3 @@ | ||
const filename = isFile(file) ? file.name : file; | ||
options.mime = options.mime || mime.lookup(path.extname(filename)); | ||
options.mime = options.mime || mime.getType(path.extname(filename)); | ||
options.headers = options.headers || {}; | ||
@@ -257,3 +257,5 @@ this._convertMetaToHeaders(options.meta, options.headers); | ||
proto._createStream = function _createStream(file, start, end) { | ||
if (isFile(file)) { | ||
if (is.readableStream(file)) { | ||
return file; | ||
} else if (isFile(file)) { | ||
return new WebFileReadStream(file.slice(start, end)); | ||
@@ -260,0 +262,0 @@ } else if (is.string(file)) { |
@@ -13,2 +13,3 @@ | ||
const { Transform } = require('stream'); | ||
const pump = require('pump'); | ||
@@ -67,3 +68,3 @@ const proto = exports; | ||
} else if (is.string(file)) { | ||
options.mime = options.mime || mime.lookup(path.extname(file)); | ||
options.mime = options.mime || mime.getType(path.extname(file)); | ||
const stream = fs.createReadStream(file); | ||
@@ -134,3 +135,3 @@ options.contentLength = await this._getFileSize(file); | ||
}; | ||
params.stream = stream.pipe(transform); | ||
params.stream = pump(stream, transform); | ||
params.successStatuses = [200]; | ||
@@ -137,0 +138,0 @@ |
{ | ||
"name": "ali-oss", | ||
"version": "6.8.0", | ||
"version": "6.9.0", | ||
"description": "aliyun oss(object storage service) node client", | ||
@@ -13,8 +13,10 @@ "main": "lib/client.js", | ||
"lib/client.js": "./dist/aliyun-oss-sdk.js", | ||
"mime": "./shims/mime.js", | ||
"mime": "mime/lite", | ||
"urllib": "./shims/xhr.js", | ||
"utility": "./shims/utility.js", | ||
"crypto": "./shims/crypto/crypto.js", | ||
"debug": "./shims/debug", | ||
"fs": false, | ||
"child_process": false | ||
"child_process": false, | ||
"is-type-of": "./shims/is-type-of.js" | ||
}, | ||
@@ -24,3 +26,3 @@ "scripts": { | ||
"test": "mocha -t 60000 -r thunk-mocha -r should test/node/*.test.js", | ||
"test-cov": "nyc node_modules/.bin/_mocha -t 60000 -r thunk-mocha -r should test/node/*.test.js", | ||
"test-cov": "nyc --reporter=lcov node_modules/.bin/_mocha -t 60000 -r thunk-mocha -r should test/node/*.test.js", | ||
"jshint": "jshint .", | ||
@@ -98,3 +100,3 @@ "autod": "autod", | ||
"mocha": "^3.5.3", | ||
"nyc": "^13.1.0", | ||
"nyc": "^13.3.0", | ||
"promise-polyfill": "^6.0.2", | ||
@@ -129,5 +131,6 @@ "request": "^2.88.0", | ||
"merge-descriptors": "^1.0.1", | ||
"mime": "^1.3.4", | ||
"mime": "^2.4.5", | ||
"mz-modules": "^2.1.0", | ||
"platform": "^1.3.1", | ||
"pump": "^3.0.0", | ||
"sdk-base": "^2.0.1", | ||
@@ -134,0 +137,0 @@ "stream-http": "2.8.2", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
89
14
15
1658189
26
32321
3960
+ Addedpump@^3.0.0
- Removedmime@1.6.0(transitive)
Updatedmime@^2.4.5