Comparing version 3.19.0 to 3.20.0
@@ -57,3 +57,3 @@ <!-- | ||
Please use the project's developer email list to engage our community: | ||
[dev@openwhisk.incubator.apache.org](dev@openwhisk.incubator.apache.org) | ||
[dev@openwhisk.apache.org](dev@openwhisk.apache.org) | ||
@@ -60,0 +60,0 @@ In addition, we provide a "dev" Slack team channel for conversations at: |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -47,7 +61,4 @@ 'use strict' | ||
actionBody (options) { | ||
if (!options.hasOwnProperty('action')) { | ||
throw new Error(messages.MISSING_ACTION_BODY_ERROR) | ||
} | ||
const body = {exec: {kind: options.kind || 'nodejs:default', code: options.action}} | ||
actionBodyWithCode (options) { | ||
const body = { exec: { kind: options.kind || 'nodejs:default', code: options.action } } | ||
@@ -61,8 +72,43 @@ // allow options to override the derived exec object | ||
body.exec.code = options.action.toString('base64') | ||
} else if (typeof options.action === 'object') { | ||
} | ||
return body | ||
} | ||
actionBodyWithSequence (options) { | ||
if (!(options.sequence instanceof Array)) { | ||
throw new Error(messages.INVALID_SEQ_PARAMETER) | ||
} | ||
if (options.sequence.length === 0) { | ||
throw new Error(messages.INVALID_SEQ_PARAMETER_LENGTH) | ||
} | ||
const body = { exec: { kind: 'sequence', components: options.sequence } } | ||
return body | ||
} | ||
actionBody (options) { | ||
const isCodeAction = options.hasOwnProperty('action') | ||
const isSequenceAction = options.hasOwnProperty('sequence') | ||
if (!isCodeAction && !isSequenceAction) { | ||
throw new Error(messages.MISSING_ACTION_OR_SEQ_BODY_ERROR) | ||
} | ||
if (isCodeAction && isSequenceAction) { | ||
throw new Error(messages.INVALID_ACTION_AND_SEQ_PARAMETERS) | ||
} | ||
// user can manually define & control exact action definition by passing in an object | ||
if (isCodeAction && typeof options.action === 'object' && | ||
(!(options.action instanceof Buffer))) { | ||
return options.action | ||
} | ||
const body = isCodeAction | ||
? this.actionBodyWithCode(options) : this.actionBodyWithSequence(options) | ||
if (typeof options.params === 'object') { | ||
body.parameters = Object.keys(options.params).map(key => ({key, value: options.params[key]})) | ||
body.parameters = Object.keys(options.params).map(key => ({ key, value: options.params[key] })) | ||
} | ||
@@ -78,6 +124,2 @@ | ||
if (typeof options.annotations === 'object') { | ||
body.annotations = Object.keys(options.annotations).map(key => ({ key, value: options.annotations[key] })) | ||
} | ||
return body | ||
@@ -84,0 +126,0 @@ } |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -4,0 +18,0 @@ 'use strict' |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -4,0 +18,0 @@ 'use strict' |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -11,3 +25,3 @@ 'use strict' | ||
const http = require('http') | ||
const ProxyAgent = require('proxy-agent') | ||
/** | ||
@@ -40,14 +54,2 @@ * This implements a request-promise-like facade over the needle | ||
// gather proxy settings if behind a firewall | ||
var proxyUri = process.env.proxy || | ||
process.env.HTTP_PROXY || | ||
process.env.http_proxy || | ||
process.env.HTTPS_PROXY || | ||
process.env.https_proxy | ||
if (proxyUri !== undefined) { | ||
// set the agent with corresponding proxy | ||
opts.agent = new ProxyAgent(proxyUri) | ||
} | ||
return needle(opts.method.toLowerCase(), // needle takes e.g. 'put' not 'PUT' | ||
@@ -100,2 +102,10 @@ opts.url, | ||
// gather proxy settings if behind a firewall | ||
const proxy = options.proxy || process.env.PROXY || process.env.proxy || | ||
process.env.HTTP_PROXY || process.env.http_proxy || | ||
process.env.HTTPS_PROXY || process.env.https_proxy | ||
// custom HTTP agent | ||
const agent = options.agent | ||
// if apiversion is available, use it | ||
@@ -123,3 +133,3 @@ const apiversion = options.apiversion || 'v1' | ||
return {apiKey: apiKey, api, apiVersion: apiversion, ignoreCerts: ignoreCerts, namespace: options.namespace, apigwToken: apigwToken, apigwSpaceGuid: apigwSpaceGuid, authHandler: options.auth_handler, noUserAgent: options.noUserAgent, cert: options.cert, key: options.key} | ||
return { apiKey: apiKey, api, apiVersion: apiversion, ignoreCerts: ignoreCerts, namespace: options.namespace, apigwToken: apigwToken, apigwSpaceGuid: apigwSpaceGuid, authHandler: options.auth_handler, noUserAgent: options.noUserAgent, cert: options.cert, key: options.key, proxy, agent } | ||
} | ||
@@ -152,3 +162,3 @@ | ||
headers: { | ||
'User-Agent': (options && options['User-Agent']) || 'openwhisk-client-js', | ||
'User-Agent': (options && options['User-Agent']) || process.env['__OW_USER_AGENT'] || 'openwhisk-client-js', | ||
Authorization: header | ||
@@ -172,2 +182,10 @@ } | ||
if (this.options.proxy) { | ||
parms.proxy = this.options.proxy | ||
} | ||
if (this.options.agent) { | ||
parms.agent = this.options.agent | ||
} | ||
return parms | ||
@@ -174,0 +192,0 @@ }) |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -4,0 +18,0 @@ 'use strict' |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -4,0 +18,0 @@ import * as Swagger from 'swagger-schema-official' |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -4,0 +18,0 @@ const Actions = require('./actions.js') |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -10,3 +24,6 @@ module.exports = { | ||
INVALID_RESOURCE_ERROR: 'Invalid resource identifier from options. Should be "resource", "/namespace/resource" or "/namespace/package/resource".', | ||
MISSING_ACTION_BODY_ERROR: 'Missing mandatory action parameter from options.', | ||
INVALID_SEQ_PARAMETER: 'Invalid sequence parameter from options. Must be an array.', | ||
INVALID_SEQ_PARAMETER_LENGTH: 'Invalid sequence parameter from options. Array must not be empty.', | ||
INVALID_ACTION_AND_SEQ_PARAMETERS: 'Invalid options parameters, contains both "action" and "sequence" parameters in options.', | ||
MISSING_ACTION_OR_SEQ_BODY_ERROR: 'Missing mandatory action or sequence parameter from options.', | ||
MISSING_RULE_ERROR: 'Missing mandatory ruleName parameter from options.', | ||
@@ -13,0 +30,0 @@ MISSING_TRIGGER_ERROR: 'Missing mandatory triggerName parameter from options.', |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -4,0 +18,0 @@ const messages = require('./messages') |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -20,3 +34,3 @@ 'use strict' | ||
.all([actions, packages, triggers, rules]) | ||
.then(([actions, packages, triggers, rules]) => ({actions, packages, triggers, rules})) | ||
.then(([actions, packages, triggers, rules]) => ({ actions, packages, triggers, rules })) | ||
} | ||
@@ -23,0 +37,0 @@ } |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -4,0 +18,0 @@ 'use strict' |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -4,0 +18,0 @@ 'use strict' |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -34,2 +48,7 @@ 'use strict' | ||
create (options) { | ||
if (options && typeof options.annotations === 'object') { | ||
const annotations = this.parseAnnotations(options.annotations) | ||
options.body = Object.assign({ annotations }, options.body) | ||
} | ||
return this.operationWithId('PUT', options) | ||
@@ -51,3 +70,3 @@ } | ||
const id = options.id | ||
return this.request({method, id, options}) | ||
return this.request({ method, id, options }) | ||
} | ||
@@ -68,3 +87,3 @@ | ||
if (typeof options === 'string') { | ||
options = {name: options} | ||
options = { name: options } | ||
} | ||
@@ -90,2 +109,6 @@ | ||
parseAnnotations (annotations) { | ||
return Object.keys(annotations).map(key => ({ key, value: annotations[key] })) | ||
} | ||
retrieveId (options) { | ||
@@ -92,0 +115,0 @@ options = options || {} |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -4,0 +18,0 @@ 'use strict' |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -54,3 +68,3 @@ 'use strict' | ||
options = options || {} | ||
options.params = {status: 'active'} | ||
options.params = { status: 'active' } | ||
return super.invoke(options) | ||
@@ -61,3 +75,3 @@ } | ||
options = options || {} | ||
options.params = {status: 'inactive'} | ||
options.params = { status: 'inactive' } | ||
return super.invoke(options) | ||
@@ -64,0 +78,0 @@ } |
@@ -1,3 +0,17 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements; and to You under the Apache License, Version 2.0. | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
@@ -4,0 +18,0 @@ 'use strict' |
@@ -190,3 +190,3 @@ | ||
Copyright 2015-2016 IBM Corporation | ||
Copyright [yyyy] [name of copyright owner] | ||
@@ -193,0 +193,0 @@ Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -1,2 +0,2 @@ | ||
Apache OpenWhisk | ||
Apache OpenWhisk Client Js | ||
Copyright 2016-2019 The Apache Software Foundation | ||
@@ -3,0 +3,0 @@ |
{ | ||
"name": "openwhisk", | ||
"version": "3.19.0", | ||
"description": "JavaScript client library for the OpenWhisk platform", | ||
"version": "3.20.0", | ||
"description": "JavaScript client library for the Apache OpenWhisk platform", | ||
"main": "lib/main.js", | ||
"typings": "lib/main.d.ts", | ||
"engines": { | ||
"node": ">=4.0.0" | ||
"node": ">=6.0.0" | ||
}, | ||
@@ -14,22 +14,21 @@ "directories": { | ||
"scripts": { | ||
"test": "standard && ava test/unit", | ||
"test-integration": "ava test/integration/*.test.js", | ||
"code-coverage-build": "babel --out-dir=ecma5 lib", | ||
"code-coverage-run": "./tools/merge-coverage.sh", | ||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
"pre-commit-message": "Pre-commit tasks running ... & exit 0", | ||
"lint": "standard", | ||
"standard-fix": "standard --fix" | ||
"test": "npm run lint && npm run test:unit", | ||
"test:unit": "ava test/unit/*", | ||
"test:integration": "ava test/integration/*.test.js", | ||
"coverage:unit": "nyc --silent npm run test:unit", | ||
"coverage:integration": "nyc --no-clean --silent npm run test:integration", | ||
"coverage:report": "nyc report --reporter=lcov --reporter=text-summary", | ||
"coverage:upload": "codecov", | ||
"check-deps-size": "./tools/check_size.sh 1100", | ||
"lint": "standard" | ||
}, | ||
"pre-commit": [ | ||
"pre-commit-message", | ||
"standard-fix" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/openwhisk/openwhisk-client-js.git" | ||
"url": "git+https://github.com/apache/openwhisk-client-js" | ||
}, | ||
"keywords": [ | ||
"apache openwhisk", | ||
"openwhisk", | ||
"bluemix", | ||
"serverless", | ||
"faas", | ||
"nodejs" | ||
@@ -40,42 +39,18 @@ ], | ||
"bugs": { | ||
"url": "https://github.com/openwhisk/openwhisk-client-js/issues" | ||
"url": "https://github.com/apache/openwhisk-client-js/issues" | ||
}, | ||
"homepage": "https://github.com/openwhisk/openwhisk-client-js#readme", | ||
"homepage": "https://github.com/apache/openwhisk-client-js#readme", | ||
"devDependencies": { | ||
"@types/node": "^9.6.0", | ||
"@types/swagger-schema-official": "^2.0.6", | ||
"ava": "^0.25.0", | ||
"babel-cli": "^6.26.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"codecov": "^3.0.0", | ||
"@types/node": "^12.0.10", | ||
"@types/swagger-schema-official": "^2.0.17", | ||
"ava": "^2.1.0", | ||
"codecov": "^3.5.0", | ||
"jszip": "^3.1.3", | ||
"nyc": "^11.0.3", | ||
"nyc": "^14.1.1", | ||
"pre-commit": "^1.2.2", | ||
"proxyquire": "2.0.1", | ||
"standard": "^11.0.1" | ||
"standard": "^12.0.1" | ||
}, | ||
"dependencies": { | ||
"needle": "^2.1.0", | ||
"proxy-agent": "^3.0.3" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015" | ||
], | ||
"plugins": [ | ||
"transform-runtime" | ||
], | ||
"ignore": "test", | ||
"env": { | ||
"development": { | ||
"sourceMaps": "inline" | ||
} | ||
} | ||
}, | ||
"ava": { | ||
"require": [ | ||
"babel-core/register" | ||
] | ||
"needle": "^2.4.0" | ||
} | ||
} |
118
README.md
@@ -19,11 +19,11 @@ <!-- | ||
--> | ||
# OpenWhisk Client for JavaScript | ||
# Apache OpenWhisk Client for JavaScript | ||
[![Build Status](https://travis-ci.org/apache/incubator-openwhisk-client-js.svg?branch=master)](https://travis-ci.org/apache/incubator-openwhisk-client-js) | ||
[![Build Status](https://travis-ci.org/apache/openwhisk-client-js.svg?branch=master)](https://travis-ci.org/apache/openwhisk-client-js) | ||
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) | ||
[![codecov](https://codecov.io/gh/apache/incubator-openwhisk-client-js/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/incubator-openwhisk-client-js) | ||
[![codecov](https://codecov.io/gh/apache/openwhisk-client-js/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/openwhisk-client-js) | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
JavaScript client library for the [Apache OpenWhisk](https://github.com/apache/incubator-openwhisk) platform. | ||
Provides a wrapper around the [OpenWhisk APIs](https://github.com/apache/incubator-openwhisk/blob/fb001afa237476eda0c0f6494ee92702e5986538/core/controller/src/main/resources/apiv1swagger.json) (Swagger JSON). | ||
JavaScript client library for the [Apache OpenWhisk](https://github.com/apache/openwhisk) platform. | ||
Provides a wrapper around the [OpenWhisk APIs](https://github.com/apache/openwhisk/blob/fb001afa237476eda0c0f6494ee92702e5986538/core/controller/src/main/resources/apiv1swagger.json) (Swagger JSON). | ||
@@ -121,2 +121,4 @@ ## installation | ||
- **key**. Client key to use when connecting to the `apihost` (if `nginx_ssl_verify_client` is turned on in your apihost) | ||
- **proxy.** HTTP(s) URI for proxy service to forwards requests through. Uses Needle's [built-in proxy support](https://github.com/tomas/needle#request-options). | ||
- **agent.** Provide custom [http.Agent](https://nodejs.org/api/http.html#http_class_http_agent) implementation. | ||
@@ -134,2 +136,3 @@ | ||
- *__OW_APIGW_SPACE_SUID* | ||
- *__OW_USER_AGENT* | ||
@@ -161,9 +164,9 @@ ### User-Agent | ||
If you are working behind a firewall, you could use the following environment variables to proxy your HTTP/HTTPS requests | ||
If you are working behind a firewall, HTTP(s) proxy details can be set by using the `proxy` option in the constructor parameters with the proxy service URI, e.g. `http://proxy-server.com:3128`. The proxy URI can also be set using the following environment parameters (to set a proxy without changing application code): | ||
- *http_proxy/HTTP_PROXY* | ||
- *https_proxy/HTTPS_proxy* | ||
- *proxy or PROXY* | ||
- *http_proxy or HTTP_PROXY* | ||
- *https_proxy or HTTPS_proxy* | ||
The openwhisk-client-js SDK supports the use of above mentioned proxies through third-party | ||
HTTP agent such as [proxy-agent](https://github.com/TooTallNate/node-proxy-agent "proxy-agent Github page") | ||
If you need more advanced proxy behaviour, rather than using Needle's default [built-in HTTP agent](https://github.com/tomas/needle), the `agent` constructor parameter can be used to set a custom `http.Agent` implementation, e.g [proxy-agent](https://github.com/TooTallNate/node-proxy-agent "proxy-agent Github page") | ||
@@ -224,2 +227,11 @@ ## Examples | ||
### create sequence from another action | ||
```javascript | ||
const actionName = '/mynamespace/reverseWords' | ||
const name = 'reverse' | ||
ow.actions.create({ name, sequence: [ actionName ] }) | ||
``` | ||
### retrieve action resource | ||
@@ -272,2 +284,20 @@ | ||
### bind a package from another namespace | ||
```javascript | ||
const name = 'myBoundPackage' | ||
const package = { | ||
binding: { | ||
namespace: "othernamespace", // namespace to bind from | ||
name: "otherpackage" // package to bind from | ||
} | ||
} | ||
ow.packages.update({name, package}).then(package => { | ||
console.log('bound package:', package.name) | ||
}).catch(err => { | ||
console.error('failed to bind package', err) | ||
}) | ||
``` | ||
### create trigger feed from alarm package | ||
@@ -436,2 +466,28 @@ | ||
### create & update action sequence | ||
```javascript | ||
ow.actions.create({name: '...', sequence: ["action_name", "next_action", ...]}) | ||
ow.actions.update({name: '...', sequence: ["action_name", "next_action", ...]}) | ||
``` | ||
The following mandatory parameters are supported: | ||
- `name` - action identifier | ||
- `sequence` - Array containing JS strings with action identifiers to use in sequence. This can be a full or relative action identifier (e.g. `action-name` or `/namespace/package/action-name`). | ||
The following optional parameters are supported: | ||
- `namespace` - set custom namespace for endpoint | ||
- `params` - object containing default parameters for the action (default: `{}`) | ||
- `annotations` - object containing annotations for the action (default: `{}`) | ||
- `limits` - object containing limits for the action (default: `{}`) | ||
- `version` - set semantic version of the action. If parameter is empty when create new action openwisk generate 0.0.1 value when update an action increase the patch version. | ||
If you pass in an array for the first parameter, the `create` call will be executed for each array item. The function returns a Promise which resolves with the results when all operations have finished. | ||
```javascript | ||
ow.actions.create([{...}, {...}]) | ||
``` | ||
### fire trigger | ||
@@ -470,2 +526,3 @@ | ||
- `namespace` - set custom namespace for endpoint | ||
- `annotations` - object containing annotations for the trigger (default: `{}`) | ||
@@ -482,2 +539,3 @@ ### create & update packages | ||
- `namespace` - set custom namespace for endpoint | ||
- `annotations` - object containing annotations for the package (default: `{}`) | ||
@@ -497,2 +555,3 @@ ### create & update rule | ||
- `namespace` - set namespace for rule | ||
- `annotations` - object containing annotations for the rule (default: `{}`) | ||
@@ -522,3 +581,3 @@ ### enable & disable rule | ||
OpenWhisk supports a [built-in API gateway service](https://github.com/apache/incubator-openwhisk/blob/master/docs/apigateway.md) and external third-party providers. | ||
OpenWhisk supports a [built-in API gateway service](https://github.com/apache/openwhisk/blob/master/docs/apigateway.md) and external third-party providers. | ||
@@ -584,3 +643,3 @@ This client library defaults to using the platform service. If the `apigw_token` parameter is passed into the client constructor, the implementation will switch to the [IBM Bluemix API Gateway](https://console.ng.bluemix.net/docs/openwhisk/openwhisk_apigateway.html#openwhisk_apigateway). | ||
Swagger parameter must be a well-formed JSON string, containing a valid Swagger API definition, which follows the [OpenWhisk API Gateway route schema](https://github.com/apache/incubator-openwhisk-apigateway/blob/master/doc/v2/management_interface_v2.md#post-v2tenant_idapis). | ||
Swagger parameter must be a well-formed JSON string, containing a valid Swagger API definition, which follows the [OpenWhisk API Gateway route schema](https://github.com/apache/openwhisk-apigateway/blob/master/doc/v2/management_interface_v2.md#post-v2tenant_idapis). | ||
@@ -609,3 +668,3 @@ *No other parameters are supported when creating the route from a JSON Swagger document.* | ||
```bash | ||
$ npm test | ||
$ npm test:unit | ||
``` | ||
@@ -618,35 +677,20 @@ | ||
```bash | ||
$ npm run-script test-integration | ||
$ npm run test:integration | ||
``` | ||
**Note:** The test integration runs in secure mode by default, which means that all trusted signers must be present and available to the client process. | ||
If your local environment is using self-signed certificates, you can use the following command to start the script in insecure mode: | ||
**Note:** The test integration runs in secure mode by default, which means that all trusted signers must be present and available to the client process. If your local environment is using self-signed certificates, you can use the following command to start the script in insecure mode: | ||
`npm run test-integration -i` | ||
`__OW_INSECURE=true npm run test-integration` | ||
This will disable SSL/TLS verification for all SSL communication. | ||
Alternatively, you can run the `prepIntegrationTests.sh` script using guest credentials or by specifying specific credentials. | ||
Run the script with openwhisk credentials: | ||
```bash | ||
$ ./test/integration/prepIntegrationTests.sh <your key in the form of ABCD:EFGH> <openwhisk instance hostname> <openwhisk namespace> <api gatewaytoken> | ||
``` | ||
The `prepIntegrationTests.sh` script is designed to give you feedback if it detects a setting that is not correct on your machine. ex: `node 6 or above is not detected` | ||
### code coverage | ||
## Code-Coverage: | ||
Code coverage data for the unit and integration tests can be created using the following commands: | ||
You can customize how comprehensive the tests are over the code, and generate reports to view the results by using | ||
the provided `code-coverage` commands below. | ||
- `npm run coverage:unit` | ||
- `npm run coverage:integration` | ||
**Note:** Ensure that you use guest credentials with the wsk CLI. | ||
*Generated data in stored in the `.nyc_output` directory.* | ||
To compile down to ECMA5 run the following command: | ||
1 `$ npm run code-coverage-build` | ||
To generate combined reports of both the unit and integration tests, run the following command: | ||
2 `$ npm run code-coverage-run <key> <host> <namespace> <token> <options>` | ||
The report is viewable under `/coverage`. Click **`/coverage/index.html`** to view the full report. | ||
# Disclaimer | ||
Apache OpenWhisk JavaScript Client Library is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. | ||
Running the `npm run coverage:report` command will generate the output reports. |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
95730
1
8
1366
683
23
14
- Removedproxy-agent@^3.0.3
- Removedagent-base@4.2.14.3.0(transitive)
- Removedast-types@0.16.1(transitive)
- Removedbytes@3.1.2(transitive)
- Removedco@4.6.0(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddata-uri-to-buffer@1.2.0(transitive)
- Removeddebug@2.6.93.1.04.3.7(transitive)
- Removeddeep-is@0.1.4(transitive)
- Removeddegenerator@1.0.4(transitive)
- Removeddepd@2.0.0(transitive)
- Removedes6-promise@4.2.8(transitive)
- Removedes6-promisify@5.0.0(transitive)
- Removedescodegen@1.14.3(transitive)
- Removedesprima@3.1.34.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedextend@3.0.2(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedftp@0.3.10(transitive)
- Removedget-uri@2.0.4(transitive)
- Removedhttp-errors@2.0.0(transitive)
- Removedhttp-proxy-agent@2.1.0(transitive)
- Removedhttps-proxy-agent@3.0.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedip@1.1.51.1.9(transitive)
- Removedisarray@0.0.11.0.0(transitive)
- Removedlevn@0.3.0(transitive)
- Removedlru-cache@5.1.1(transitive)
- Removedms@2.0.0(transitive)
- Removednetmask@1.0.6(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedpac-proxy-agent@3.0.1(transitive)
- Removedpac-resolver@3.0.0(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedproxy-agent@3.1.1(transitive)
- Removedproxy-from-env@1.1.0(transitive)
- Removedraw-body@2.5.2(transitive)
- Removedreadable-stream@1.1.142.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsetprototypeof@1.2.0(transitive)
- Removedsmart-buffer@4.2.0(transitive)
- Removedsocks@2.3.3(transitive)
- Removedsocks-proxy-agent@4.0.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedstatuses@2.0.1(transitive)
- Removedstring_decoder@0.10.311.1.1(transitive)
- Removedthunkify@2.1.2(transitive)
- Removedtoidentifier@1.0.1(transitive)
- Removedtslib@2.8.1(transitive)
- Removedtype-check@0.3.2(transitive)
- Removedunpipe@1.0.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedword-wrap@1.2.5(transitive)
- Removedxregexp@2.0.0(transitive)
- Removedyallist@3.1.1(transitive)
Updatedneedle@^2.4.0