Skip to content

Commit

Permalink
bump: 1.0.0-rc.38
Browse files Browse the repository at this point in the history
  • Loading branch information
lurunze1226 committed Feb 16, 2023
1 parent 8903354 commit 347501f
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# CHANGELOG
## 1.0.0-rc.38(2023-02-16)

- BosClient: support symlink;

## 1.0.0-rc.37(2023-01-09)

- BosClient: support 'x-bce-server-side-encryption', 'x-bce-restore-days', 'x-bce-restore-tier' headers;
Expand Down
56 changes: 52 additions & 4 deletions dist/baidubce-sdk.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -52164,7 +52164,7 @@ arguments[4][21][0].apply(exports,arguments)
},{"./support/isBuffer":245,"_process":202,"dup":21,"inherits":244}],247:[function(require,module,exports){
module.exports={
"name": "@baiducloud/sdk",
"version": "1.0.0-rc.37",
"version": "1.0.0-rc.38",
"description": "Baidu Cloud Engine JavaScript SDK",
"main": "./index.js",
"browser": {
Expand All @@ -52177,6 +52177,7 @@ module.exports={
"scripts": {
"test": "./test/run-all.sh",
"pack": "rm -rf dist/ && mkdir dist && browserify index.js -s baidubce.sdk -o dist/baidubce-sdk.bundle.js && uglifyjs dist/baidubce-sdk.bundle.js --compress --mangle -o dist/baidubce-sdk.bundle.min.js",
"docs": "cd example && npm run start",
"publish:bos": "node ./publish/publish_to_bos.js"
},
"repository": {
Expand All @@ -52187,8 +52188,7 @@ module.exports={
"leeight <[email protected]>",
"木休大人 <[email protected]>",
"yangwei <[email protected]>",
"lurunze <[email protected]>",
"hanxiao <[email protected]>"
"lurunze <[email protected]>"
],
"license": "MIT",
"dependencies": {
Expand Down Expand Up @@ -53253,6 +53253,9 @@ BosClient.prototype.createBucket = function (bucketName, options) {

return this.sendRequest('PUT', {
bucketName: bucketName,
body: JSON.stringify({
enableMultiAZ: !!(options.body && options.body.enableMultiAZ)
}),
config: options.config
});
};
Expand Down Expand Up @@ -54098,6 +54101,47 @@ BosClient.prototype.postObject = function (bucketName, key, data, options) {
});
};

/**
* 获取软连接,需要对软连接有读取权限,接口响应头的x-bce-symlink-target指向目标文件
*/
BosClient.prototype.getSymlink = function (bucketName, objectName, options) {
options = options || {};

return this.sendRequest('GET', {
bucketName,
key: objectName,
params: {symlink: ''},
config: options.config
});
}

/**
* 为BOS的相同bucket下已有的目的object创建软链接
* @param {string} bucketName 桶名称
* @param {string} objectName 软连接文件名称
* @param {string} target 目标对象名称
* @param {boolean} overwrite 是否覆盖同名Object,默认允许覆盖
*/
BosClient.prototype.putSymlink = function (bucketName, objectName, target, overwrite, options) {
options = options || {};
var headers = {};

if (!target) {
throw new TypeError('target object should not be empty.');
}

headers[H.X_BCE_SYMLINK_TARGET] = target;
headers[H.X_BCE_FORBID_OVERWRITE] = overwrite === true;

return this.sendRequest('PUT', {
bucketName,
key: objectName,
params: {symlink: ''},
headers: headers,
config: options.config
});
}

// --- E N D ---

BosClient.prototype.sendRequest = function (httpMethod, varArgs) {
Expand Down Expand Up @@ -54213,7 +54257,9 @@ BosClient.prototype._prepareObjectHeaders = function (options) {
H.X_BCE_STORAGE_CLASS,
H.X_BCE_SERVER_SIDE_ENCRYPTION,
H.X_BCE_RESTORE_DAYS,
H.X_BCE_RESTORE_TIER
H.X_BCE_RESTORE_TIER,
H.X_BCE_SYMLINK_TARGET,
H.X_BCE_FORBID_OVERWRITE
];
var metaSize = 0;
var headers = u.pick(options, function (value, key) {
Expand Down Expand Up @@ -56205,6 +56251,8 @@ exports.X_BCE_STORAGE_CLASS = 'x-bce-storage-class';
exports.X_BCE_SERVER_SIDE_ENCRYPTION = 'x-bce-server-side-encryption';
exports.X_BCE_RESTORE_DAYS = 'x-bce-restore-days';
exports.X_BCE_RESTORE_TIER = 'x-bce-restore-tier';
exports.X_BCE_SYMLINK_TARGET = 'x-bce-symlink-target';
exports.X_BCE_FORBID_OVERWRITE = 'x-bce-forbid-overwrite';

exports.X_HTTP_HEADERS = 'http_headers';
exports.X_BODY = 'body';
Expand Down
2 changes: 1 addition & 1 deletion dist/baidubce-sdk.bundle.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@baiducloud/sdk",
"version": "1.0.0-rc.37",
"version": "1.0.0-rc.38",
"description": "Baidu Cloud Engine JavaScript SDK",
"main": "./index.js",
"browser": {
Expand Down
6 changes: 3 additions & 3 deletions publish/publish_to_bos.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const {BosClient} = require('../');

const {version, name} = require('../package.json');

const {BOS_AK, BOS_SK} = process.env;
const {BOS_AK_CDN, BOS_SK_CDN} = process.env;
const client = new BosClient({
endpoint: 'https://bj.bcebos.com',
credentials: {ak: BOS_AK, sk: BOS_SK}
credentials: {ak: BOS_AK_CDN, sk: BOS_SK_CDN}
});

function uploadTo(bucketName, objectName, filePath) {
Expand Down Expand Up @@ -44,7 +44,7 @@ function publish(distDir) {
err => console.log(err.message));
}

if (BOS_AK && BOS_SK) {
if (BOS_AK_CDN && BOS_SK_CDN) {
publish(path.join(__dirname, '..', 'dist'));
} else {
console.log('终止发布操作,请配置环境变量BOS_AK、BOS_SK。');
Expand Down

0 comments on commit 347501f

Please sign in to comment.