@baiducloud/sdk
Advanced tools
Comparing version 1.0.0-rc.0 to 1.0.0-rc.1
{ | ||
"name": "@baiducloud/sdk", | ||
"version": "1.0.0-rc.0", | ||
"version": "1.0.0-rc.1", | ||
"description": "Baidu Cloud Engine JavaScript SDK", | ||
@@ -30,3 +30,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"browserify": "^16.2.2", | ||
"browserify": "10.2.6", | ||
"coveralls": "^3.0.2", | ||
@@ -33,0 +33,0 @@ "expect.js": "^0.3.1", |
@@ -22,2 +22,3 @@ /** | ||
var util = require('util'); | ||
var strings = require('./strings'); | ||
@@ -45,45 +46,2 @@ var u = require('underscore'); | ||
// BRN BEGIN | ||
var exp1 = /^([a-zA-Z0-9-_\.]+)$/; | ||
var exp2 = /^(brn:(.*))$/; | ||
var exp3 = /^([a-zA-Z0-9]+:[a-zA-Z0-9-_\.]+)$/; | ||
function dealFunctionName(fname) { | ||
var data = { | ||
thumbnailName: fname, | ||
version: '', | ||
uid: '' | ||
}; | ||
if (exp1.test(fname)) { | ||
data.thumbnailName = fname; | ||
return data; | ||
} | ||
else if (exp2.test(fname)) { | ||
var brn = fname.split(':'); | ||
if (brn.length < 6) { | ||
return data; | ||
} | ||
data.uid = brn[4]; | ||
if (brn.length === 7) { | ||
data.thumbnailName = brn[6]; | ||
} | ||
else if (brn.length === 8) { | ||
data.thumbnailName = brn[6]; | ||
data.version = brn[7]; | ||
} | ||
return data; | ||
} | ||
else if (exp3.test(fname)) { | ||
var resource = fname.split(':'); | ||
if (resource.length === 2) { | ||
data.thumbnailName = resource[1]; | ||
data.uid = resource[0]; | ||
} | ||
return data; | ||
} | ||
return data; | ||
} | ||
// BRN END | ||
// --- BEGIN --- | ||
@@ -113,3 +71,2 @@ | ||
'Description': 'string', | ||
'Region': 'string', | ||
'Timeout': 0, | ||
@@ -142,3 +99,3 @@ 'FunctionName': 'string', | ||
); | ||
return this.sendRequest('GET', '/v1/functions/' + functionName, { | ||
return this.sendRequest('GET', '/v1/functions/' + strings.normalize(functionName), { | ||
params: params | ||
@@ -148,4 +105,10 @@ }); | ||
CfcClient.prototype.deleteFunction = function (functionName) { | ||
return this.sendRequest('DELETE', '/v1/functions/' + functionName, {}); | ||
CfcClient.prototype.deleteFunction = function (functionName, opt_options) { | ||
var options = opt_options || {}; | ||
var params = u.extend( | ||
u.pick(options, 'Qualifier') | ||
); | ||
return this.sendRequest('DELETE', '/v1/functions/' + functionName, { | ||
params: params | ||
}); | ||
}; | ||
@@ -156,3 +119,3 @@ | ||
var params = u.extend( | ||
u.pick(options, 'Qualifier', 'logToBody', 'invocationType', 'logType') | ||
u.pick(options, 'Qualifier', 'invocationType', 'logType') | ||
); | ||
@@ -166,4 +129,3 @@ /** | ||
*/ | ||
var data = dealFunctionName(functionName); | ||
return this.sendRequest('POST', '/v1/functions/' + data.thumbnailName + '/invocations', { | ||
return this.sendRequest('POST', '/v1/functions/' + strings.normalize(functionName) + '/invocations', { | ||
params: params, | ||
@@ -224,4 +186,3 @@ body: JSON.stringify(body) | ||
); | ||
var data = dealFunctionName(functionName); | ||
return this.sendRequest('GET', '/v1/functions/' + data.thumbnailName + '/versions', { | ||
return this.sendRequest('GET', '/v1/functions/' + functionName + '/versions', { | ||
params: params | ||
@@ -235,4 +196,3 @@ }); | ||
} | ||
var data = dealFunctionName(functionName); | ||
return this.sendRequest('POST', '/v1/functions/' + data.thumbnailName + '/versions', { | ||
return this.sendRequest('POST', '/v1/functions/' + functionName + '/versions', { | ||
body: JSON.stringify(body) | ||
@@ -239,0 +199,0 @@ }); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5
2206853
50654