├── plugins
├── plugin-grid
│ ├── .gitignore
│ ├── README.md
│ ├── .npmignore
│ ├── i18n
│ │ └── resources_en_US.json
│ ├── tsconfig-es6.json
│ ├── tsconfig.json
│ ├── CHANGELOG.md
│ ├── src
│ │ ├── index.ts
│ │ ├── lib
│ │ │ ├── apiVersion.ts
│ │ │ ├── drilldown.ts
│ │ │ ├── options.ts
│ │ │ └── activation.ts
│ │ ├── defaults.ts
│ │ ├── preload.ts
│ │ ├── modes
│ │ │ └── grid-legend.ts
│ │ ├── plugin.ts
│ │ ├── non-headless-preload.ts
│ │ ├── test
│ │ │ └── grid
│ │ │ │ └── timeline.ts
│ │ └── models
│ │ │ └── activation-data.ts
│ └── package.json
├── plugin-openwhisk
│ ├── .gitignore
│ ├── tests
│ │ ├── data
│ │ │ └── openwhisk
│ │ │ │ ├── zip
│ │ │ │ ├── data.txt
│ │ │ │ ├── sendmail.zip
│ │ │ │ └── index.js
│ │ │ │ ├── params.json
│ │ │ │ ├── file with spaces.yaml
│ │ │ │ ├── style.css
│ │ │ │ ├── hello-with-script.js
│ │ │ │ ├── hello.html
│ │ │ │ ├── not-really-png.png
│ │ │ │ ├── echo.js
│ │ │ │ ├── headless
│ │ │ │ ├── echo.js
│ │ │ │ └── foo.js
│ │ │ │ ├── dir with spaces
│ │ │ │ └── foo.js
│ │ │ │ ├── error.js
│ │ │ │ ├── jar
│ │ │ │ ├── echo.jar
│ │ │ │ ├── echo.java
│ │ │ │ └── README.md
│ │ │ │ ├── foo2.js
│ │ │ │ ├── zip-action
│ │ │ │ └── src
│ │ │ │ │ ├── package.json
│ │ │ │ │ ├── index.js
│ │ │ │ │ └── package-lock.json
│ │ │ │ ├── hello-with-script.html
│ │ │ │ ├── foo.js
│ │ │ │ ├── zip-python
│ │ │ │ └── index.py
│ │ │ │ ├── long.js
│ │ │ │ ├── commandFile.wsk
│ │ │ │ ├── flip.sh
│ │ │ │ └── icon.svg
│ │ └── package.json
│ ├── tsconfig-es6.json
│ ├── .npmignore
│ ├── tsconfig.json
│ ├── i18n
│ │ └── resources_en_US.json
│ ├── src
│ │ ├── controller
│ │ │ ├── dict.ts
│ │ │ ├── namespace
│ │ │ │ ├── current.ts
│ │ │ │ ├── list.ts
│ │ │ │ └── as-namespace.ts
│ │ │ ├── aliases.ts
│ │ │ ├── ok.ts
│ │ │ ├── activation
│ │ │ │ ├── usage.ts
│ │ │ │ └── result.ts
│ │ │ ├── action
│ │ │ │ ├── let
│ │ │ │ │ └── let-core.ts
│ │ │ │ └── list.ts
│ │ │ ├── package
│ │ │ │ └── list.ts
│ │ │ └── trigger
│ │ │ │ ├── list.ts
│ │ │ │ └── as-trigger.ts
│ │ ├── modes
│ │ │ ├── web-exported.ts
│ │ │ ├── version.ts
│ │ │ ├── status.ts
│ │ │ ├── duration.ts
│ │ │ ├── blackbox.ts
│ │ │ ├── code.ts
│ │ │ ├── edit.ts
│ │ │ ├── namespace
│ │ │ │ ├── rules.ts
│ │ │ │ ├── packages.ts
│ │ │ │ ├── triggers.ts
│ │ │ │ └── actions.ts
│ │ │ ├── package-feeds.ts
│ │ │ ├── show-action.ts
│ │ │ ├── limits.ts
│ │ │ ├── show-trigger.ts
│ │ │ ├── package-actions.ts
│ │ │ ├── show-binding.ts
│ │ │ ├── delete.ts
│ │ │ ├── parameters.ts
│ │ │ ├── annotations.ts
│ │ │ ├── result.ts
│ │ │ ├── raw.ts
│ │ │ ├── invoke.ts
│ │ │ └── zip-code.ts
│ │ ├── views
│ │ │ └── traffic-light.ts
│ │ ├── client
│ │ │ ├── agent.ts
│ │ │ ├── get.ts
│ │ │ └── options.ts
│ │ ├── preload.ts
│ │ ├── test
│ │ │ ├── openwhisk3
│ │ │ │ └── error-handling.ts
│ │ │ ├── openwhisk1
│ │ │ │ ├── list
│ │ │ │ │ ├── namespace.ts
│ │ │ │ │ └── entities.ts
│ │ │ │ ├── all-numeric-uuids.ts
│ │ │ │ └── help.ts
│ │ │ └── openwhisk2
│ │ │ │ └── jar.ts
│ │ └── models
│ │ │ ├── selection.ts
│ │ │ └── synonyms.ts
│ ├── package.json
│ └── CHANGELOG.md
├── plugin-apache-composer
│ ├── .gitignore
│ ├── i18n
│ │ └── resources_en_US.json
│ ├── tests
│ │ ├── data
│ │ │ └── composer
│ │ │ │ ├── composer-source
│ │ │ │ ├── echo.js
│ │ │ │ ├── author-map.json
│ │ │ │ ├── path-rel-require
│ │ │ │ │ ├── actions
│ │ │ │ │ │ ├── options
│ │ │ │ │ │ │ └── index.js
│ │ │ │ │ │ ├── authentication
│ │ │ │ │ │ │ └── index.js
│ │ │ │ │ │ ├── configuration
│ │ │ │ │ │ │ └── index.js
│ │ │ │ │ │ ├── post_processing
│ │ │ │ │ │ │ └── index.js
│ │ │ │ │ │ └── start_session
│ │ │ │ │ │ │ └── index.js
│ │ │ │ │ └── srijith.js
│ │ │ │ ├── seq.js
│ │ │ │ ├── echo-sequence2.js
│ │ │ │ ├── echo-sequence.js
│ │ │ │ ├── error-sequence.js
│ │ │ │ ├── seq-with-comments2.js
│ │ │ │ ├── seq-with-comments.js
│ │ │ │ ├── try.js
│ │ │ │ ├── while-seq.js
│ │ │ │ ├── t2s.js
│ │ │ │ ├── empty.js
│ │ │ │ ├── mask.js
│ │ │ │ ├── require-absolute.js
│ │ │ │ ├── require-relative.js
│ │ │ │ ├── demo-retain.js
│ │ │ │ ├── if.js
│ │ │ │ ├── composer1.js
│ │ │ │ ├── if-with-weird-semicolons.js
│ │ │ │ ├── demo.js
│ │ │ │ ├── if-session.js
│ │ │ │ ├── retry-5-times.js
│ │ │ │ ├── fs-read-v2.js
│ │ │ │ ├── comments.js
│ │ │ │ ├── sms-translate-demo.js
│ │ │ │ ├── fs-read.js
│ │ │ │ ├── sms-translate-demo-with-comments.js
│ │ │ │ ├── sms-translate.js
│ │ │ │ └── travis2slack.js
│ │ │ │ ├── echo.js
│ │ │ │ ├── composer-source-expect-errors
│ │ │ │ ├── openwhisk-composer-throw-err.js
│ │ │ │ ├── if-bad.js
│ │ │ │ ├── nofsm.js
│ │ │ │ ├── t2s.js
│ │ │ │ └── error1.js
│ │ │ │ └── fsm.json
│ │ └── package.json
│ ├── .npmignore
│ ├── tsconfig-es6.json
│ ├── samples
│ │ └── @demos
│ │ │ ├── wookie
│ │ │ ├── report-empty.js
│ │ │ ├── report-stapi.js
│ │ │ ├── report-swapi.js
│ │ │ ├── app.js
│ │ │ ├── validate-stapi.js
│ │ │ ├── validate-swapi.js
│ │ │ ├── README.md
│ │ │ ├── swapi.js
│ │ │ └── stapi.js
│ │ │ ├── hello.js
│ │ │ ├── looper.js
│ │ │ ├── combinators
│ │ │ ├── empty.js
│ │ │ ├── function.js
│ │ │ ├── composition.js
│ │ │ ├── dowhile.js
│ │ │ ├── action.js
│ │ │ ├── literal.js
│ │ │ ├── merge.js
│ │ │ ├── async.js
│ │ │ ├── map.js
│ │ │ ├── sleep.js
│ │ │ ├── while.js
│ │ │ ├── finally.js
│ │ │ ├── let.js
│ │ │ └── mask.js
│ │ │ ├── try.js
│ │ │ ├── let.js
│ │ │ ├── par.js
│ │ │ ├── seq.js
│ │ │ ├── if.js
│ │ │ ├── retain.js
│ │ │ ├── authenticate.js
│ │ │ ├── login.js
│ │ │ ├── welcome.js
│ │ │ ├── hello.py
│ │ │ ├── try-retain.js
│ │ │ └── validate.js
│ ├── src
│ │ ├── test
│ │ │ ├── composer1
│ │ │ │ ├── README.md
│ │ │ │ └── composer-compose.ts
│ │ │ └── composer2
│ │ │ │ └── composer-config.ts
│ │ ├── lib
│ │ │ ├── utility
│ │ │ │ ├── badges.ts
│ │ │ │ ├── messages.ts
│ │ │ │ ├── parse.ts
│ │ │ │ └── sample-inputs.ts
│ │ │ └── controller
│ │ │ │ └── cmd
│ │ │ │ ├── preview-options.ts
│ │ │ │ ├── app-delete.ts
│ │ │ │ ├── app-get.ts
│ │ │ │ └── app-invoke.ts
│ │ ├── index.ts
│ │ ├── modes
│ │ │ ├── json.ts
│ │ │ ├── code.ts
│ │ │ ├── json-from-preview.ts
│ │ │ ├── flow.ts
│ │ │ └── visualize.ts
│ │ └── initRequirePath.ts
│ ├── tsconfig.json
│ ├── CHANGELOG.md
│ └── package.json
├── plugin-openwhisk-editor-extensions
│ ├── .gitignore
│ ├── .npmignore
│ ├── tsconfig-es6.json
│ ├── tsconfig.json
│ ├── CHANGELOG.md
│ ├── src
│ │ ├── index.ts
│ │ ├── plugin.ts
│ │ ├── lib
│ │ │ ├── i18n
│ │ │ │ └── strings.ts
│ │ │ └── placeholders.ts
│ │ └── preload.ts
│ └── package.json
└── plugin-oui-client
│ ├── icons
│ ├── icns
│ │ ├── README.md
│ │ ├── kui.icns
│ │ └── oui.icns
│ ├── ico
│ │ ├── README.md
│ │ ├── kui.ico
│ │ ├── oui.ico
│ │ └── favicon.ico
│ ├── png
│ │ ├── oui.png
│ │ └── oui-128.png
│ └── svg
│ │ └── oui.svg
│ ├── config.d
│ ├── exec.json
│ ├── limits.json
│ ├── openwhisk.json
│ ├── version.json
│ ├── name.json
│ ├── style.json
│ ├── about.json
│ ├── proxy.json
│ ├── icons.json
│ ├── client.json
│ └── opengraph.json
│ ├── images
│ └── ogImage.jpg
│ ├── i18n
│ └── about_en_US.json
│ ├── package.json
│ └── index.js
├── docs
├── oui-flow.png
└── action-list.png
├── lerna.json
├── .gitignore
├── .prettierignore
├── .eslintignore
├── bin
├── oui
└── oui-ascii
├── tsconfig.json
├── .prettierrc.json
├── tsconfig-es6.json
├── tools
└── travis
│ └── openwhisk
│ ├── openwhisk-runtimes.json
│ ├── openwhisk-runtimes-with-nodejs8.json
│ └── openwhisk-runtimes-with-java8.json
└── .eslintrc.json
/plugins/plugin-grid/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | build
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | build
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | build
--------------------------------------------------------------------------------
/plugins/plugin-grid/README.md:
--------------------------------------------------------------------------------
1 | # wskng-activation-viz-plugins
2 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | build
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/icons/icns/README.md:
--------------------------------------------------------------------------------
1 | Icons for MacOS
2 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/icons/ico/README.md:
--------------------------------------------------------------------------------
1 | Icons for Windows
2 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/zip/data.txt:
--------------------------------------------------------------------------------
1 | hello world
2 |
--------------------------------------------------------------------------------
/docs/oui-flow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/docs/oui-flow.png
--------------------------------------------------------------------------------
/lerna.json:
--------------------------------------------------------------------------------
1 | {
2 | "packages": ["plugins/*"],
3 | "version": "0.0.0"
4 | }
5 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/params.json:
--------------------------------------------------------------------------------
1 | { "name": "nick" }
2 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/file with spaces.yaml:
--------------------------------------------------------------------------------
1 | hello: world
2 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/exec.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultContext": ["wsk"]
3 | }
4 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/limits.json:
--------------------------------------------------------------------------------
1 | {
2 | "maxWatchersPerTab": 6
3 | }
4 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/openwhisk.json:
--------------------------------------------------------------------------------
1 | {
2 | "electron-host": ""
3 | }
4 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/version.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.0.2"
3 | }
4 |
--------------------------------------------------------------------------------
/docs/action-list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/docs/action-list.png
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | color: green;
3 | }
4 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/.npmignore:
--------------------------------------------------------------------------------
1 | build
2 | src
3 | tests
4 | dist/test
5 | tsconfig*
6 | /*.tgz
7 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/i18n/resources_en_US.json:
--------------------------------------------------------------------------------
1 | {
2 | "Grid": "Grid",
3 | "Summary": "Summary"
4 | }
5 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/i18n/resources_en_US.json:
--------------------------------------------------------------------------------
1 | {
2 | "Flow": "Flow",
3 | "JSON": "JSON"
4 | }
5 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/echo.js:
--------------------------------------------------------------------------------
1 | module.exports = n => `echo${n}`
2 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/author-map.json:
--------------------------------------------------------------------------------
1 | {
2 | "hello": "world"
3 | }
4 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/.npmignore:
--------------------------------------------------------------------------------
1 | build
2 | src
3 | tests
4 | dist/test
5 | tsconfig*
6 | /*.tgz
7 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/hello-with-script.js:
--------------------------------------------------------------------------------
1 | document.querySelector('#hello').innerText = 'hello'
2 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/hello.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | hello world
4 |
5 |
6 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/not-really-png.png:
--------------------------------------------------------------------------------
1 | this is to test base64 encoding of binary invocation parameters
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/path-rel-require/actions/options/index.js:
--------------------------------------------------------------------------------
1 | exports.main = () => true
2 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/icons/ico/kui.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/plugins/plugin-oui-client/icons/ico/kui.ico
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/icons/ico/oui.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/plugins/plugin-oui-client/icons/ico/oui.ico
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/icons/png/oui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/plugins/plugin-oui-client/icons/png/oui.png
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/images/ogImage.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/plugins/plugin-oui-client/images/ogImage.jpg
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/echo.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | const main = x => x
3 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/icons/icns/kui.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/plugins/plugin-oui-client/icons/icns/kui.icns
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/icons/icns/oui.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/plugins/plugin-oui-client/icons/icns/oui.icns
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/icons/ico/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/plugins/plugin-oui-client/icons/ico/favicon.ico
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/icons/png/oui-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/plugins/plugin-oui-client/icons/png/oui-128.png
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/path-rel-require/actions/authentication/index.js:
--------------------------------------------------------------------------------
1 | exports.main = () => true
2 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/path-rel-require/actions/configuration/index.js:
--------------------------------------------------------------------------------
1 | exports.main = () => true
2 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/path-rel-require/actions/post_processing/index.js:
--------------------------------------------------------------------------------
1 | exports.main = () => true
2 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/path-rel-require/actions/start_session/index.js:
--------------------------------------------------------------------------------
1 | exports.main = () => true
2 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/echo.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | const main = x => x
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | dist
3 | mdist
4 | node_modules
5 | packages/app/build
6 | *.tsbuildinfo
7 | *~
8 | flycheck*
9 | .keys
10 | kui-webpack-tmp
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/headless/echo.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | const main = x => x
3 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/dir with spaces/foo.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | const main = x => x
3 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/error.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | const main = params => ({ error: 'oops' })
3 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/jar/echo.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/plugins/plugin-openwhisk/tests/data/openwhisk/jar/echo.jar
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | *.d.ts
3 | *.min.css
4 | package-lock.json
5 | plugins/plugin-apache-composer/tests/data/composer/composer-source-expect-errors/if-bad.js
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/zip/sendmail.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kui-shell/oui/HEAD/plugins/plugin-openwhisk/tests/data/openwhisk/zip/sendmail.zip
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/name.json:
--------------------------------------------------------------------------------
1 | {
2 | "productName": "Oui",
3 | "productTitle": "Oui",
4 | "productSubName": "Oui",
5 | "shellName": "Shell"
6 | }
7 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/tsconfig-es6.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "mdist",
5 | "module": "esnext"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/foo2.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | const main = params => ({ name: 'Step2 ' + params.name })
3 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tsconfig-es6.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "mdist",
5 | "module": "esnext"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/.npmignore:
--------------------------------------------------------------------------------
1 | build
2 | src
3 | tests/data
4 | dist/test/*
5 | dist/test/composer2/*
6 | !dist/test/composer2/composer-headless.js
7 | tsconfig*
8 | /*.tgz
9 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tsconfig-es6.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "mdist",
5 | "module": "esnext"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/seq.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.sequence('seq1', 'seq2', 'seq3')
4 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/echo-sequence2.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.sequence('echo', 'echo')
4 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/tsconfig-es6.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "mdist",
5 | "module": "esnext"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/zip-action/src/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-action",
3 | "main": "index.js",
4 | "dependencies": {
5 | "left-pad": "1.1.3"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/headless/foo.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | function main(params) {
3 | return { name: 'Step1 ' + params.name }
4 | }
5 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/echo-sequence.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.sequence(
4 | x => x,
5 | x => x
6 | )
7 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/hello-with-script.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/wookie/report-empty.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | function main(params) {
3 | return { results: 'No results from SWAPI or STAPI' }
4 | }
5 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/wookie/report-stapi.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | function main(params) {
3 | const answer = params.result.body
4 | return answer
5 | }
6 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/error-sequence.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.sequence(
4 | x => x,
5 | x => ({ error: x })
6 | )
7 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/seq-with-comments2.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | // test comment
4 | module.exports = composer.sequence('seq1', 'seq2', 'seq3')
5 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/foo.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | function main(params) {
3 | console.log('logging')
4 | return { name: 'Step1 ' + params.name }
5 | }
6 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/seq-with-comments.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /* test comment */
4 | module.exports = composer.sequence('seq1', 'seq2', 'seq3')
5 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/zip-python/index.py:
--------------------------------------------------------------------------------
1 | def main(args):
2 | name = args.get("name", "stranger")
3 | greeting = "Hello " + name + "!"
4 | print(greeting)
5 | return {"greeting": greeting}
6 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/style.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTheme": "Dark",
3 | "bodyCss": ["kui"],
4 | "tableStyle": "Light",
5 | "promptPlaceholder": "",
6 | "topTabs": {
7 | "names": "command"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/wookie/report-swapi.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | function main(params) {
3 | const answer = JSON.parse(params.result.body)
4 | return answer
5 | }
6 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/try.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.try('RandomError', /* catch */ args => ({ message: args.error + ' is caught' }))
4 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/jar/echo.java:
--------------------------------------------------------------------------------
1 | import com.google.gson.JsonObject;
2 |
3 | public class echo {
4 | static public JsonObject main(JsonObject args) throws Exception {
5 | return args;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/hello.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | function hello({ name = 'world' }) {
4 | return { msg: `hello ${name}!` }
5 | }
6 |
7 | module.exports = composer.function(hello)
8 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | plugins/**/*/dist/
2 | plugins/*/lib/**/*.js
3 | plugins/*/i18n/**/*.js
4 | plugins/*/*.js
5 | **/*/node_modules/
6 | **/*.d.ts
7 | *flycheck*.js
8 | plugins/plugin-apache-composer/tests/data/composer/composer-source-expect-errors/if-bad.js
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/.npmignore:
--------------------------------------------------------------------------------
1 | build
2 | src
3 | tests/data/*
4 | tests/data/openwhisk/*
5 | !tests/data/openwhisk/headless/*
6 | dist/test/*
7 | dist/test/openwhisk1/*
8 | !dist/test/openwhisk1/headless.js
9 | tsconfig*
10 | /*.tgz
11 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source-expect-errors/openwhisk-composer-throw-err.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.sequence(composer.action('A', { filename: 'doesnotexist.js' }))
4 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/about.json:
--------------------------------------------------------------------------------
1 | {
2 | "modes": [
3 | {
4 | "mode": "about",
5 | "content": "about:content",
6 | "contentType": "text/markdown"
7 | },
8 | { "mode": "theme", "contentFrom": "themes" }
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../node_modules/@kui-shell/builder/tsconfig-base.json",
3 | "include": ["src/**/*"],
4 | "compilerOptions": {
5 | "composite": true,
6 | "outDir": "dist",
7 | "rootDir": "src"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/test/composer1/README.md:
--------------------------------------------------------------------------------
1 | composer function tests
2 |
3 | zzz-bottom-bar-back-button.js is so named as to place it at the end of
4 | the test list; it needs some activations to have been performed and
5 | have flowed through to the couch/cloudant store.
6 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/proxy.json:
--------------------------------------------------------------------------------
1 | {
2 | "millisBeforeProxyConnectionWarning": 250,
3 | "proxyServer": {
4 | "enabled": false,
5 | "url": "http://localhost:8081/exec",
6 | "needleOptions": {
7 | "rejectUnauthorized": false
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/looper.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.sequence(
4 | composer.while(composer.sequence('cond1', 'cond2'), composer.sequence('seq1', 'seq2', 'seq3')),
5 | composer.while('cond3', 'action4')
6 | )
7 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../node_modules/@kui-shell/builder/tsconfig-base.json",
3 | "include": ["src/**/*"],
4 | "compilerOptions": {
5 | "composite": true,
6 | "outDir": "dist",
7 | "rootDir": "src"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/long.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | const main = params =>
3 | new Promise(resolve => {
4 | setTimeout(() => {
5 | console.log('all done')
6 | resolve({ message: 'done' })
7 | }, 3000)
8 | })
9 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/zip-action/src/index.js:
--------------------------------------------------------------------------------
1 | function myAction(args) {
2 | const leftPad = require('left-pad')
3 | const lines = args.lines || []
4 | console.log(lines)
5 | return { padded: lines.map(l => leftPad(l, 30, '.')) }
6 | }
7 |
8 | exports.main = myAction
9 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source-expect-errors/if-bad.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.if(
4 | /* cond */ 'authenticate',, /* double comma, expect parse error */
5 | /* then */ 'welcome',
6 | /* else */ 'login')
7 |
--------------------------------------------------------------------------------
/bin/oui:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | // get node off the argv
4 | process.argv.shift()
5 |
6 | process.argv.push('--command-context=["wsk"]')
7 | // process.argv.push('--ui')
8 | process.env.KUI_HEADLESS = true
9 |
10 | // process.env.DEFAULT_TO_UI = true
11 |
12 | require('@kui-shell/core').main(process.argv)
13 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/while-seq.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.sequence(
4 | composer.while(composer.sequence('cond1', 'cond2'), composer.sequence('seq1', 'seq2', 'seq3')),
5 | composer.while('cond3', 'action4')
6 | )
7 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source-expect-errors/nofsm.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | const composer = require('openwhisk-composer')
3 |
4 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
5 | function main() {
6 | return { error: 'oops' }
7 | }
8 |
--------------------------------------------------------------------------------
/bin/oui-ascii:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | // get node off the argv
4 | process.argv.shift()
5 |
6 | if (process.env.TRAVIS_JOB_ID) {
7 | process.argv.push('--no-colors')
8 | }
9 |
10 | process.argv.push('--command-context=["wsk"]')
11 | process.env.KUI_HEADLESS = true
12 |
13 | require('@kui-shell/core').main(process.argv)
14 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@kui-shell/builder/tsconfig-base.json",
3 | "references": [
4 | { "path": "./plugins/plugin-openwhisk" },
5 | { "path": "./plugins/plugin-apache-composer" },
6 | { "path": "./plugins/plugin-grid" },
7 | { "path": "./plugins/plugin-openwhisk-editor-extensions" }
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/icons.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "icons/png/oui.png",
3 | "large": "icons/svg/oui.svg",
4 | "wide": "icons/svg/oui-wide.svg",
5 | "favicon": "icons/ico/oui.ico",
6 | "filesystem": {
7 | "darwin": "icons/icns/oui.icns",
8 | "win32": "icons/ico/oui.ico",
9 | "linux": "icons/png/oui.png"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/fsm.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "sequence",
3 | "components": [
4 | {
5 | "type": "action",
6 | "name": "/_/foo1"
7 | },
8 | {
9 | "type": "action",
10 | "name": "/_/foo2"
11 | },
12 | {
13 | "type": "action",
14 | "name": "/_/foo3"
15 | }
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/client.json:
--------------------------------------------------------------------------------
1 | {
2 | "userAgent": "Kui-Shell",
3 | "cssHome": "css/",
4 | "imageHome": "",
5 | "contextRoot": "",
6 | "contentSecurityPolicy": "default-src * 'nonce-kuiDefaultNonce' 'unsafe-eval' 'unsafe-inline'; img-src * data:; style-src * 'unsafe-inline'; connect-src 'self' http://localhost:8081 https://localhost:8081"
7 | }
8 |
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "semi": false,
3 | "printWidth": 120,
4 | "singleQuote": true,
5 | "overrides": [
6 | {
7 | "files": "*.html",
8 | "options": {
9 | "printWidth": 300
10 | }
11 | },
12 | {
13 | "files": "*.css",
14 | "options": {
15 | "singleQuote": false
16 | }
17 | }
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/empty.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * Sometimes it is helpful, for clarity's sake,
5 | * to note that a certain call back is expected
6 | * not to be taken. Use EMPTY for these cases.
7 | */
8 | module.exports = composer.if(() => true, '/whisk.system/utils/date', composer.empty())
9 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../node_modules/@kui-shell/builder/tsconfig-base.json",
3 | "include": ["src/**/*"],
4 | "compilerOptions": {
5 | "composite": true,
6 | "outDir": "dist",
7 | "rootDir": "src",
8 | "baseUrl": ".",
9 | "paths": {
10 | "@kui-shell/plugin-grid/web/*": ["web/*"]
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tests",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "directories": {
7 | "lib": "lib"
8 | },
9 | "scripts": {
10 | "test": "echo \"Error: no test specified\" && exit 1"
11 | },
12 | "keywords": [],
13 | "author": "",
14 | "license": "Apache-2.0"
15 | }
16 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tests",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "directories": {
7 | "lib": "lib"
8 | },
9 | "scripts": {
10 | "test": "echo \"Error: no test specified\" && exit 1"
11 | },
12 | "keywords": [],
13 | "author": "",
14 | "license": "Apache-2.0"
15 | }
16 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/wookie/app.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.sequence(
4 | composer.retain('swapi'),
5 | composer.if(
6 | 'validate-swapi',
7 | 'report-swapi',
8 | composer.sequence(composer.retain('stapi'), composer.if('validate-stapi', 'report-stapi', 'report-empty'))
9 | )
10 | )
11 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/wookie/validate-stapi.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | function main(params) {
3 | // return {status: 'Good', myResult: params}
4 |
5 | const answer = params.result.body.page
6 | if (answer.totalElements > 0) {
7 | return { value: true }
8 | } else {
9 | return { value: false }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/wookie/validate-swapi.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
2 | function main(params) {
3 | // return {status: 'Good', myResult: params.result.body}
4 |
5 | const answer = JSON.parse(params.result.body)
6 | if (answer.count > 0) {
7 | return { value: true }
8 | } else {
9 | return { value: false }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/zip-action/src/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-action",
3 | "requires": true,
4 | "lockfileVersion": 1,
5 | "dependencies": {
6 | "left-pad": {
7 | "version": "1.1.3",
8 | "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.1.3.tgz",
9 | "integrity": "sha1-YS9hwDPzqeCOk58crr7qQbbzGZo="
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/tsconfig-es6.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@kui-shell/builder/tsconfig-base.json",
3 | "references": [
4 | { "path": "./plugins/plugin-openwhisk/tsconfig-es6.json" },
5 | { "path": "./plugins/plugin-apache-composer/tsconfig-es6.json" },
6 | { "path": "./plugins/plugin-grid/tsconfig-es6.json" },
7 | { "path": "./plugins/plugin-openwhisk-editor-extensions/tsconfig-es6.json" }
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/try.js:
--------------------------------------------------------------------------------
1 | const { try: Try } = require('openwhisk-composer')
2 |
3 | /**
4 | * This code illustrates a try/catch pattern. Previously
5 | * deployed Cloud Functions can be referenced by name.
6 | */
7 | module.exports = Try(
8 | // execute this Cloud Function
9 | 'validate',
10 |
11 | // if that fails, execute this inline function
12 | () => ({
13 | ok: false
14 | })
15 | )
16 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/function.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * If your composition is a single inline function,
5 | * you must use the FUNCTION operation. In all
6 | * other cases, its use is optional: i.e. if your
7 | * inline function appears as a part of a larger
8 | * composition, you may simple use the function
9 | * code directly.
10 | */
11 | module.exports = composer.function(x => x)
12 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/zip/index.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs')
2 | const path = require('path')
3 |
4 | exports.main = params =>
5 | new Promise((resolve, reject) => {
6 | fs.readFile(path.join(__dirname, 'data.txt'), (err, data) => {
7 | if (err) {
8 | reject(err)
9 | } else {
10 | resolve(
11 | Object.assign(params, {
12 | data: data.toString()
13 | })
14 | )
15 | }
16 | })
17 | })
18 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/let.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | const state = { secret: 42 }
4 |
5 | /**
6 | * Here, we execute a simple function in a stateful (Let)
7 | * context. Second, we verify that the "secret" variable hasn't
8 | * escaped beyond the scope of the Let.
9 | *
10 | */
11 | module.exports = composer.sequence(
12 | composer.let(state, () => ({ ok: secret === 42 })),
13 | () => ({
14 | ok: typeof secret === 'undefined'
15 | })
16 | )
17 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/par.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * This code executes three tasks in parallel. The input is
5 | * passed to each of the tasks, and the output is an array
6 | * of their results.
7 | */
8 | module.exports = composer.par('/whisk.system/utils/date', x => x, '/whisk.system/utils/echo')
9 |
10 | /**
11 | * Notes: Previously deployed Cloud Functions can be referenced by
12 | * 'name'. You may also use inline NodeJS functions.
13 | */
14 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../node_modules/@kui-shell/builder/tsconfig-base.json",
3 | "include": ["src/**/*"],
4 | "compilerOptions": {
5 | "composite": true,
6 | "outDir": "dist",
7 | "rootDir": "src",
8 | "baseUrl": ".",
9 | "paths": {
10 | "@kui-shell/plugin-apache-composer/tests/*": ["plugins/plugin-apache-composer/tests/*"],
11 | "@kui-shell/plugin-apache-composer/*": ["plugins/plugin-apache-composer/src/*"]
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file.
4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5 |
6 | # [5.1.0](https://github.com/IBM/kui/compare/v4.5.0...v5.1.0) (2019-10-11)
7 |
8 | **Note:** Version bump only for package @kui-shell/plugin-grid
9 |
10 | # [5.0.0](https://github.com/IBM/kui/compare/v4.5.0...v5.0.0) (2019-10-03)
11 |
12 | **Note:** Version bump only for package @kui-shell/plugin-grid
13 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/seq.js:
--------------------------------------------------------------------------------
1 | const { seq: Seq } = require('openwhisk-composer')
2 |
3 | /**
4 | * This code forms a three-element sequence. As with UNIX pipes,
5 | * the output of one is input to the next.
6 | */
7 | module.exports = Seq(
8 | '/whisk.system/utils/date', // deployed Function
9 | x => x, // inline function
10 | '/whisk.system/utils/echo' // deployed Function
11 | )
12 |
13 | /**
14 | * Notes: Previously deployed Cloud Functions can be referenced by
15 | * 'name'. You may also use inline NodeJS functions.
16 | */
17 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/i18n/about_en_US.json:
--------------------------------------------------------------------------------
1 | {
2 | "about": "About",
3 | "about:content": "[](https://github.com/kui-shell/oui)\n\n**Oui** is a tool that enhances the OpenWhisk terminal experience with visualizations. It provides users a modern alternative to ASCII terminals and web-based consoles.\n\n---\n\n[GitHub](https://github.com/kui-shell/oui \"Oui's GitHub page\")\n\n[Bugs](https://github.com/kui-shell/oui/issues/new \"Oui's bug reporting page\")",
4 | "theme": "Themes",
5 | "contexts": "Contexts"
6 | }
7 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file.
4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5 |
6 | # [5.1.0](https://github.com/IBM/kui/compare/v4.5.0...v5.1.0) (2019-10-11)
7 |
8 | **Note:** Version bump only for package @kui-shell/plugin-openwhisk-editor-extensions
9 |
10 | # [5.0.0](https://github.com/IBM/kui/compare/v4.5.0...v5.0.0) (2019-10-03)
11 |
12 | **Note:** Version bump only for package @kui-shell/plugin-openwhisk-editor-extensions
13 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/commandFile.wsk:
--------------------------------------------------------------------------------
1 | # test a comment
2 | let api/demo.json = x => ({forecast: `sunny in ${x.address}`})
3 | # test another comment
4 | let public/icon.svg = https://ibm.box.com/shared/static/gnttk3ehi44l6jsos670i7wcn3nzz247.svg
5 |
6 |
7 | # this better not be executed:
8 | #let foo = x=>x
9 |
10 | # this better not be executed, either:
11 | # let foo = x=>x
12 |
13 | #####
14 | #
15 | #########
16 |
17 | let public/hello.html = https://ibm.box.com/shared/static/zsye0mwai0kce2p6wssltpsi5bfj9dy0.html
18 |
19 | #
20 | #
21 | #
22 |
23 |
24 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/if.js:
--------------------------------------------------------------------------------
1 | const { if: If } = require('openwhisk-composer')
2 |
3 | /**
4 | * Creates an if-then-else composition. The input is passed to the
5 | * condition, and again to the "then" or "else" code.
6 | */
7 | module.exports = If(
8 | 'authenticate', // returns { value: true|false }
9 | 'welcome', // execute this Function is value is true
10 | 'login' // otherwise execute this Function
11 | )
12 |
13 | /**
14 | * Notes: Previously deployed Cloud Functions can be referenced by
15 | * 'name'. You may also use inline NodeJS functions.
16 | */
17 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/wookie/README.md:
--------------------------------------------------------------------------------
1 | # Composer Wookiechat
2 |
3 | This demo queries SWAPI for character information. This project
4 | intercepts the SWAPI results and forwards to STAPI using a Composer
5 | flow that adds a retain and an if-then-else statement.
6 |
7 | The actions are:
8 |
9 | ```
10 | swapi.js: query SWAPI
11 | stapi.js: query STAPI
12 | validate.js: check results from SWAPI
13 | forward.js: forward SWAPI results to user
14 | ```
15 |
16 | The composition is:
17 |
18 | ```
19 | app.js : query SWAPI and if result set is empty, query STAPI
20 | ```
21 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/i18n/resources_en_US.json:
--------------------------------------------------------------------------------
1 | {
2 | "Annotations": "Annotations",
3 | "Code": "Code",
4 | "Delete": "Delete",
5 | "Edit": "Edit",
6 | "Invoke": "Invoke",
7 | "Limits": "Limits",
8 | "Logs": "Logs",
9 | "Show Action": "Show Action",
10 | "Show Actions": "Show Actions",
11 | "Show Binding": "Show Binding",
12 | "Show Feeds": "Show Feeds",
13 | "Show Rules": "Show Rules",
14 | "Show Packages": "Show Packages",
15 | "Show Triggers": "Show Triggers",
16 | "Parameters": "Parameters",
17 | "Raw": "Raw",
18 | "Result": "Result",
19 | "Zip Main": "Zip Main"
20 | }
21 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/flip.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # install jq if it does not exist
4 | if [ ! -f /usr/bin/jq ]; then
5 | apk update && apk add jq
6 | fi
7 |
8 | # determine number of flips
9 | N=`echo "$@" | jq '."n"'`
10 |
11 | # total count of heads and tails
12 | HEADS=0
13 | TAILS=0
14 |
15 | for i in `seq 1 $N`; do
16 | echo -n "flipping coin..."
17 | if [ $(( RANDOM % 2 )) == 0 ]; then
18 | echo "HEADS"; HEADS=$(( HEADS + 1 ))
19 | else
20 | echo "TAILS"; TAILS=$(( TAILS + 1 ))
21 | fi
22 | done
23 |
24 | echo "{\"trials\": $N, \"heads\": $HEADS, \"tails\": $TAILS}"
25 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/jar/README.md:
--------------------------------------------------------------------------------
1 | The jar file is included in the repo to facilitate the tests, so that
2 | we don't depend on gradle or some such in the test rig. If you need to
3 | rebuild the jar, do the following:
4 |
5 | ```sh
6 | curl -O https://repo1.maven.org/maven2/com/google/code/gson/gson/2.6.2/gson-2.6.2.jar
7 | javac -target 8 -source 8 echo.java -cp gson-2.6.2.jar
8 | jar cf echo.jar echo.class
9 | ```
10 |
11 | Note that, as of this writing (20180521), the source and target
12 | versions are important; the currently OpenWhisk does not support any
13 | more recent bytecode target than 8.
14 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/composition.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * If you would like to invoke previously deployed
5 | * composition, you must use the COMPOSITION operation.
6 | * All other cases of nested compositions, where
7 | * the source for the composition is available,
8 | * you are encouraged to use it directly.
9 | */
10 | module.exports = composer.composition('myComposition')
11 |
12 | /**
13 | * Related: see the documentation of the sleep
14 | * operation for an example of using a composition
15 | * by directly including its source.
16 | */
17 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/t2s.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const prefix = 'travis2slack'
4 |
5 | const composer = require('openwhisk-composer')
6 |
7 | module.exports = composer.sequence(
8 | `/whisk.system/utils/echo`,
9 | args => {
10 | return JSON.parse(args.payload)
11 | },
12 | `${prefix}/extract`,
13 | `${prefix}/fetch.job.id`,
14 | composer.retain(composer.sequence(composer.retry(3, `${prefix}/fetch.log.url`), `${prefix}/analyze.log`)),
15 | ({ result, params }) => Object.assign({}, result, params),
16 | `${prefix}/format.for.slack`,
17 | `${prefix}.slack/post`
18 | )
19 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/dowhile.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * This code shows the construction of a standard
5 | * DOWHILE pattern. The body is executed at least once,
6 | * and the condition always receives as input the output
7 | * of the body.
8 | */
9 | module.exports = composer.dowhile(
10 | params => params.n % 2 === 0, // condition
11 | params => {
12 | params.n /= 2
13 | } // body
14 | )
15 |
16 | /**
17 | * Related: DOWHILE_NOSAVE which behaves similarly to DOWHILE,
18 | * except that the condition always receives the initial input.
19 | */
20 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@kui-shell/plugin-oui-client",
3 | "version": "5.1.0",
4 | "description": "Kui plugin that offers client defintion",
5 | "license": "Apache-2.0",
6 | "author": "Mengting Yan",
7 | "dependencies": {
8 | "@kui-shell/plugin-client-default": "^6.0.5"
9 | },
10 | "homepage": "https://github.com/IBM/kui#readme",
11 | "private": true,
12 | "bugs": {
13 | "url": "https://github.com/IBM/kui/issues/new"
14 | },
15 | "repository": {
16 | "type": "git",
17 | "url": "git+https://github.com/IBM/kui.git"
18 | },
19 | "keywords": [
20 | "kui",
21 | "plugin"
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/config.d/opengraph.json:
--------------------------------------------------------------------------------
1 | {
2 | "ogSiteName": "Oui",
3 | "ogTitle": "Oui: The CLI with a GUI twist",
4 | "ogUrl": "http://github.com/kui-shell/oui",
5 | "ogDescription": "Oui is a platform for enhancing the terminal experience with visualizations. It provides users a modern alternative to ASCII terminals and web-based consoles. It provides tool developers an opportunity to unify these experiences.",
6 | "ogImage": "http://content.kui-shell.org/images/ogImage.jpg",
7 | "ogLabel1": "Clone on GitHub",
8 | "ogData1": "https://github.com/IBM/kui",
9 | "ogLabel2": "Clone on GitHub",
10 | "ogData2": "https://github.com/kui-shell/oui"
11 | }
12 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/action.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * The ACTION operation is useful in two circumstances.
5 | * First, if your composition is a single Cloud Function,
6 | * you must use the action operation, as shown in this code.
7 | *
8 | * Second, if you would like to deploy an inline function
9 | * as a Cloud Function, you may do so with action(name, code).
10 | */
11 | module.exports = composer.action('/whisk.system/utils/date')
12 |
13 | /**
14 | * Related: LITERAL, which shows an example of using the action
15 | * operation to deploy an inline function as a named Cloud Function.
16 | */
17 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/literal.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * An inline function that we will turn into
5 | * a named Cloud Function below
6 | */
7 | const log = params => ({ message: 'Composition time: ' + params.value })
8 |
9 | /**
10 | * This code uses the LITERAL operation to inject
11 | * a value into a composition. You may also use
12 | * the synonymous "value" in place of "literal".
13 | *
14 | * Note the use of the ACTION operation to make
15 | * a named Cloud Function out of an inline function.
16 | */
17 | module.exports = composer.sequence(composer.literal(Date()), composer.action('log', { action: log }))
18 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/merge.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * MERGE is equivalent to RETAIN, except that
5 | * it merges the input parameters and the output
6 | * of the given sequence.
7 | *
8 | * This code shows how easy it is to extend the
9 | * built-in primitives: merge is a simple macro
10 | * on top of seq and retain.
11 | */
12 | function merge(...components) {
13 | return composer.seq(composer.retain(...components), _ => Object.assign(_.params, _.result))
14 | }
15 |
16 | /**
17 | * A simple example use of our new MERGE macro
18 | */
19 | module.exports = merge('/whisk.system/utils/date', '/whisk.system/utils/echo')
20 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/retain.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * This code uses RETAIN to alter the flow of data so that
5 | * the input is forwarded around a given sequence. The input
6 | * params are passed to sequence, then combined with the
7 | * result of the sequence into a pair {params,result}.
8 | */
9 | module.exports = composer.retain(
10 | _ => ({ x: _.x + 1 }),
11 | _ => ({ x: _.x + 2 })
12 | )
13 |
14 | /**
15 | * e.g. input: { x: 0 }
16 | * output: { params: { x: 0 }, result: { x : 3 } }
17 | */
18 |
19 | /**
20 | * Related: RETAIN_CATCH, which always returns {params,result}
21 | * even if the body fails.
22 | */
23 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | // this file defines the external API
18 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/lib/apiVersion.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | export default 'kui-shell.org/grid/v1'
18 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | require('@kui-shell/plugin-client-default')
18 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/async.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /** the database to use */
4 | const dbname = 'testDB'
5 |
6 | /** the insert key to use */
7 | const id = 'testId'
8 |
9 | /** a mock format function */
10 | const formatDocument = document => ({ timestamp: new Date(), document })
11 |
12 | /**
13 | * This code executes uses ASYNC to execute a
14 | * task in a fire-and-forget fashion. In this
15 | * case, the goal is to format and upload
16 | * a document to Cloudant; note the use of the
17 | * GET operation provided by the cloudant plugin.
18 | */
19 | module.exports = composer.async(formatDocument, doc => ({ dbname, id, doc }), '/whisk.system/cloudant/write')
20 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source-expect-errors/t2s.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const composer = require('openwhisk-composer')
4 |
5 | const prefix = 'travis2slack'
6 |
7 | module.exports = composer.sequence(
8 | `/whisk.system/utils/echo`,
9 | args => {
10 | return JSON.parse(args.payload)
11 | },
12 | `${prefix}/extract`,
13 | `${prefix}/fetch.job.id`,
14 | composer.retain(composer.sequence(composer.retry(3, `${prefix}/fetch.log.url`), `${prefix}/analyze.log`)),
15 | ({ result, params }) => Object.assign({}, result, params),
16 | `${prefix}/format.for.slack`,
17 | composer.retain(slackConfig),
18 | ({ result, params }) => Object.assign({}, result, params),
19 | `${prefix}.slack/post`
20 | )
21 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/src/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | // this file defines the external API
18 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/defaults.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-18 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | export default {
18 | batchSize: 200,
19 | N: 2,
20 | maxN: 32
21 | }
22 |
--------------------------------------------------------------------------------
/plugins/plugin-oui-client/icons/svg/oui.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file.
4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5 |
6 | # [5.1.0](https://github.com/IBM/kui/compare/v4.5.0...v5.1.0) (2019-10-11)
7 |
8 | ### Bug Fixes
9 |
10 | - **plugins/plugin-apache-composer:** let.js demo versus safari ([dea7610](https://github.com/IBM/kui/commit/dea7610)), closes [#2820](https://github.com/IBM/kui/issues/2820)
11 |
12 | # [5.0.0](https://github.com/IBM/kui/compare/v4.5.0...v5.0.0) (2019-10-03)
13 |
14 | ### Bug Fixes
15 |
16 | - **plugins/plugin-apache-composer:** let.js demo versus safari ([dea7610](https://github.com/IBM/kui/commit/dea7610)), closes [#2820](https://github.com/IBM/kui/issues/2820)
17 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/empty.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | module.exports = composer.sequence()
20 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/map.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * This code MAP to apply a task, in parallel,
5 | * to each element of an array. The simple task
6 | * is to multiply each element by a given factor.
7 | *
8 | * The array is injected via the LITERAL
9 | * operator, and the multiplication factor is
10 | * passed in as an input to the composition.
11 | *
12 | * Since LITERAL replaces the entire input payload,
13 | * we use MERGE to combine the {value} literal with
14 | * the input {factor} payload, so that we have both
15 | * available to the body of our map.
16 | */
17 | module.exports = composer.sequence(
18 | composer.merge(composer.literal({ value: [1, 2, 3] })),
19 | composer.map(({ value, factor }) => ({ value: value * factor }))
20 | )
21 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/authenticate.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
18 | const main = args => ({ value: args.token === 'secret' })
19 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/wookie/swapi.js:
--------------------------------------------------------------------------------
1 | const request = require('request')
2 |
3 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
4 | function main(params) {
5 | // Language Translation Service Credentials
6 | const search = params.search
7 |
8 | const url = 'https://swapi.co/api/people/?search=' + search
9 |
10 | return new Promise(function(resolve) {
11 | request.get(
12 | {
13 | url: url
14 | },
15 | // eslint-disable-next-line handle-callback-err
16 | function(error, response, body) {
17 | resolve({
18 | // need to return this so that HTTP Response body is parsed correctly
19 | headers: {
20 | 'content-type': 'application/json'
21 | },
22 | body: body
23 | })
24 | }
25 | )
26 | })
27 | }
28 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/lib/utility/badges.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | export const app = 'composition'
18 | export const ast = 'AST'
19 | export const composerLib = 'Composer'
20 | export const sequence = 'sequence'
21 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/mask.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | module.exports = composer.mask(composer.sequence('echo1', 'echo2'))
20 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | // this file defines the external API
18 |
19 | export { loadComposition } from './lib/utility/compile'
20 | export { extractActionsFromAst } from './lib/utility/ast'
21 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/sleep.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /** swap the first field into the second */
4 | const swap = (f1, f2) => obj => {
5 | obj[f2] = obj[f1]
6 | delete obj[f1]
7 | return obj
8 | }
9 |
10 | /** use a built-in Cloud Function to find the current time */
11 | const now = field => composer.sequence('/whisk.system/utils/date', swap('date', field))
12 |
13 | /**
14 | * This code uses SLEEP and MERGE operations to produce,
15 | * with the help of an inline function "swap" and the
16 | * "now" composition, to produce a pair { start, end }.
17 | */
18 | module.exports = composer.sequence(
19 | now('start'), // places the current time into {start}
20 |
21 | // sleep for 1s, produce {end}, then merges {start} and {end}
22 | composer.merge(composer.sleep(1000), now('end'))
23 | )
24 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/login.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
18 | const main = () => ({
19 | html: `please say the magic word.`
20 | })
21 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/welcome.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
18 | const main = args => ({
19 | html: `welcome ${args.name}!`
20 | })
21 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/wookie/stapi.js:
--------------------------------------------------------------------------------
1 | const request = require('request')
2 |
3 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
4 | function main(params) {
5 | // return {status: "stapi got", stapiResult: params}
6 |
7 | const search = params.params.search
8 |
9 | const url = 'http://stapi.co/api/v1/rest/character/search'
10 |
11 | const promise = new Promise(function(resolve) {
12 | // eslint-disable-next-line handle-callback-err
13 | request.post(url, { form: { name: search, title: search } }, function(error, response, body) {
14 | resolve({
15 | // need to return this so that HTTP Response body is parsed correctly
16 | headers: {
17 | 'content-type': 'application/json'
18 | },
19 | body: JSON.parse(body)
20 | })
21 | })
22 | })
23 | return promise
24 | }
25 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/require-absolute.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | require('fs')
20 |
21 | module.exports = composer.sequence('echo1', 'echo2')
22 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/require-relative.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | module.exports = composer.sequence(require('./echo')(1), require('./echo')(2))
20 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/demo-retain.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | module.exports = composer.retain(composer.sequence('TripleAndIncrement', 'DivideByTwo'))
20 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/if.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const { sequence: Seq, if: If } = require('openwhisk-composer')
18 |
19 | module.exports = If('isTrue', Seq('seq1', 'seq2', 'seq3'), Seq('seq4', 'seq5'))
20 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/while.js:
--------------------------------------------------------------------------------
1 | const { while: While } = require('openwhisk-composer')
2 |
3 | /**
4 | * This code uses two inline functions to implement
5 | * a simple loop. While the condition returns a truthy
6 | * value or { value: true }, the body will be executed.
7 | *
8 | * The input to the WHILE body is the output of the
9 | * previous iteration or, for the first iteration, the
10 | * initial input to the invocation.
11 | */
12 | module.exports = While(
13 | params => params.n % 2 === 0,
14 | params => {
15 | params.n /= 2
16 | }
17 | )
18 |
19 | /** e.g. given { n: 28 }, yield { n: 7 } */
20 |
21 | /**
22 | * Related:
23 | * - WHILE_NOSAVE, which passes the output of the
24 | * condition to each iteration of the body
25 | * - DOWHILE, which invokes the given body at least once,
26 | * and then while the condition is true
27 | */
28 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/composer1.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | module.exports = composer.try('RandomError', /* catch */ args => ({ message: args.error + ' is caught' }))
20 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/dict.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Dict, KeyVal } from 'openwhisk'
18 |
19 | export default function toDict(A: KeyVal[]): Dict {
20 | return A.reduce((M, kv) => {
21 | M[kv.key] = kv.value
22 | return M
23 | }, {})
24 | }
25 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/hello.py:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2018 IBM Corporation
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | # not yet supported:
18 | #def hello(args):
19 | # return {
20 | # "msg": f"hello {args['name']}"
21 | # }
22 | # composer.sequence(hello)
23 |
24 | composer.sequence(lambda env, args: { "msg": "hello " + args['name'] })
25 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/if-with-weird-semicolons.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | module.exports = composer.if('isTrue', composer.sequence('seq1', 'seq2', 'seq3'), composer.sequence('seq4', 'seq5'))
20 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@kui-shell/plugin-grid",
3 | "version": "5.1.0",
4 | "description": "Kui plugin that offers a grid visualization of OpenWhisk function invocations",
5 | "license": "Apache-2.0",
6 | "author": "Nick Mitchell",
7 | "homepage": "https://github.com/IBM/kui#readme",
8 | "bugs": {
9 | "url": "https://github.com/IBM/kui/issues/new"
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "git+https://github.com/IBM/kui.git"
14 | },
15 | "keywords": [
16 | "kui",
17 | "plugin"
18 | ],
19 | "main": "dist/index.js",
20 | "module": "mdist/index.js",
21 | "dependencies": {
22 | "pretty-ms": "5.1.0",
23 | "uuid": "3.4.0"
24 | },
25 | "kui": {
26 | "headless": false,
27 | "proxy": false
28 | },
29 | "publishConfig": {
30 | "access": "public"
31 | },
32 | "gitHead": "89de9f78e8a1a2bdd29d2e17d7c608ab006c6d32"
33 | }
34 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/demo.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | module.exports = composer.while(
20 | 'isNotOne',
21 | composer.if('isEven', /* then */ 'DivideByTwo', /* else */ 'TripleAndIncrement')
22 | )
23 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/web-exported.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { isWebExported } from '../models/resource'
18 |
19 | /**
20 | * Displays a web exported badge
21 | *
22 | */
23 | export default {
24 | when: isWebExported,
25 | badge: () => ({
26 | title: 'web'
27 | })
28 | }
29 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/finally.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /** since the result has an 'error' field, an error is triggered */
4 | const fail = () => ({ error: 'intentional failure' })
5 |
6 | /**
7 | * This code uses FINALLY to ensure that cleanup logic is
8 | * always executed. The input to the finalizer is the output
9 | * of the body, whether it succeeds or fails.
10 | */
11 | module.exports = composer.finally(
12 | composer.sequence('mainLogic', fail), // body
13 | composer.async('cleanup')
14 | ) // finalizer
15 |
16 | /**
17 | * Notes: Previously deployed Cloud Functions can be referenced by
18 | * 'name'. You may also use inline NodeJS functions.
19 | */
20 |
21 | /**
22 | * Related: ASYNC, which implements a "fire and forget"
23 | * invocation scheme. This can be useful for pulling
24 | * cleanup or logging functions off the main latency path.
25 | */
26 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/let.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * This program uses LET to inject a parameter binding
5 | * for the variable "idx". Note how the body of the LET
6 | * leverages the initial value of idx.
7 | */
8 | module.exports = composer.let(
9 | // parameter bindings
10 | { idx: 100 },
11 |
12 | // body of let
13 | composer.while(
14 | () => idx-- > 0, // condition
15 | '/whisk.system/utils/echo'
16 | )
17 | ) // body of while
18 |
19 | /**
20 | * Notes: the parameter bindings by default only visible to
21 | * inline functions. To make them available to Cloud Functions,
22 | * you must explicitly inject them, e.g. via an inline function
23 | * such as () => ({idx}), which would inject that variable.
24 | */
25 |
26 | /**
27 | * Related: LITERAL, which is akin to let, except that it only
28 | * injects a parameter binding.
29 | */
30 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/if-session.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | module.exports = composer.if(
20 | p => p.condition,
21 | composer.sequence(() => ({ path: true })),
22 | composer.sequence(() => ({ path: false }))
23 | )
24 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/retry-5-times.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | module.exports = composer.retry(
20 | 5,
21 | composer.if('isTrue', composer.sequence('seq1', 'seq2', 'seq3'), composer.sequence('seq4', 'seq5'))
22 | )
23 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/preload.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { isHeadless, PreloadRegistrar } from '@kui-shell/core'
18 |
19 | export default async (registrar: PreloadRegistrar) => {
20 | if (!isHeadless()) {
21 | const preloader = (await import('./non-headless-preload')).default
22 | await preloader(registrar)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/lib/controller/cmd/preview-options.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { ParsedOptions } from '@kui-shell/core'
18 |
19 | interface Options extends ParsedOptions {
20 | env: string[]
21 | e: string[]
22 | c: boolean
23 | functions: boolean
24 | ast: boolean
25 | }
26 |
27 | export default Options
28 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/views/traffic-light.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { WithStatus } from '../models/resource'
18 |
19 | export function bg(resource: WithStatus) {
20 | return resource.status === 'active'
21 | ? 'green-background'
22 | : status === 'inactive'
23 | ? 'red-background'
24 | : 'yellow-background'
25 | }
26 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/src/plugin.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Registrar } from '@kui-shell/core'
18 |
19 | import newCmd from './lib/cmds/new'
20 | import composeCmd from './lib/cmds/compose'
21 |
22 | export default async (commandTree: Registrar) => {
23 | return Promise.all([newCmd(commandTree), composeCmd(commandTree)])
24 | }
25 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/version.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { hasVersion, WithVersion } from '../models/resource'
18 |
19 | /**
20 | * Display resource version as a badge
21 | *
22 | */
23 | export default {
24 | when: hasVersion,
25 | badge: (resource: WithVersion) => ({
26 | title: resource.version,
27 | css: 'version'
28 | })
29 | }
30 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/lib/drilldown.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-19 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Tab } from '@kui-shell/core'
18 |
19 | export const drilldownWith = (tab: Tab, command: string | (() => Promise), callThese: (() => void)[] = []) => (
20 | event: MouseEvent
21 | ) => {
22 | // invoke any precursor functions
23 | callThese.forEach(_ => _())
24 |
25 | tab.REPL.click(command, event)
26 | }
27 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/src/lib/i18n/strings.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Translations
19 | *
20 | */
21 | export default {
22 | editor: {
23 | save: 'Deploy',
24 | actionAlreadyExists: 'The given action name is already in use',
25 |
26 | // commands
27 | docs: {
28 | new: 'Open the code editor to create a new action'
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@kui-shell/plugin-openwhisk-editor-extensions",
3 | "version": "5.1.0",
4 | "description": "Kui plugin for OpenWhisk that extends plugin-editor",
5 | "license": "Apache-2.0",
6 | "author": "Nick Mitchell",
7 | "homepage": "https://github.com/IBM/kui#readme",
8 | "bugs": {
9 | "url": "https://github.com/IBM/kui/issues/new"
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "git+https://github.com/IBM/kui.git"
14 | },
15 | "keywords": [
16 | "kui",
17 | "plugin",
18 | "openwhisk"
19 | ],
20 | "main": "dist/index.js",
21 | "module": "mdist/index.js",
22 | "kui": {
23 | "headless": false,
24 | "proxy": false
25 | },
26 | "publishConfig": {
27 | "access": "public"
28 | },
29 | "gitHead": "89de9f78e8a1a2bdd29d2e17d7c608ab006c6d32",
30 | "dependencies": {
31 | "@kui-shell/plugin-editor": "^6.0.5",
32 | "@kui-shell/plugin-wskflow": "^6.0.5",
33 | "debug": "4.1.1"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source-expect-errors/error1.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const composer = require('openwhisk-composer')
4 |
5 | const slackConfig = {
6 | token: process.env['SLACK_TOKEN'],
7 | username: 'whiskbot',
8 | url: 'https://slack.com/api/chat.postMessage'
9 | }
10 |
11 | if (slackConfig.token === undefined) {
12 | console.error('SLACK_TOKEN required in environment.')
13 | process.exit(1)
14 | }
15 |
16 | const prefix = 'travis2slack'
17 |
18 | module.exports = composer.sequence(
19 | args => {
20 | return JSON.parse(args.payload)
21 | },
22 | `/whisk.system/utils/echo`,
23 | `${prefix}/extract``${prefix}/fetch.job.id`,
24 | composer.retain(composer.sequence(composer.retry(3, `${prefix}/fetch.log.url`), `${prefix}/analyze.log`)),
25 | ({ result, params }) => Object.assign({}, result, params),
26 | `${prefix}/format.for.slack`,
27 | app.retain(slackConfig),
28 | ({ result, params }) => Object.assign({}, result, params),
29 | `/whisk.system/slack/post`
30 | )
31 |
--------------------------------------------------------------------------------
/tools/travis/openwhisk/openwhisk-runtimes.json:
--------------------------------------------------------------------------------
1 | {
2 | "runtimes": {
3 | "nodejs": [
4 | {
5 | "kind": "nodejs",
6 | "image": {
7 | "prefix": "openwhisk",
8 | "name": "nodejsaction",
9 | "tag": "latest"
10 | },
11 | "deprecated": true
12 | },
13 | {
14 | "kind": "nodejs:6",
15 | "default": true,
16 | "image": {
17 | "prefix": "openwhisk",
18 | "name": "nodejs6action",
19 | "tag": "latest"
20 | },
21 | "deprecated": false,
22 | "stemCells": [
23 | {
24 | "count": 2,
25 | "memory": "256 MB"
26 | }
27 | ]
28 | }
29 | ],
30 | "python": [
31 | {
32 | "kind": "python",
33 | "image": {
34 | "prefix": "openwhisk",
35 | "name": "nodejs6action",
36 | "tag": "latest"
37 | },
38 | "deprecated": false
39 | }
40 | ]
41 | },
42 | "blackboxes": []
43 | }
44 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/try-retain.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const { sequence: Seq, try: Try, retain: Retain } = require('openwhisk-composer')
18 |
19 | /**
20 | *
21 | *
22 | */
23 | const base64ify = args => ({
24 | text: Buffer.from(args.params.str, 'base64').toString()
25 | })
26 |
27 | module.exports = Try(/* try */ Seq(Retain('validate'), base64ify), /* catch */ () => ({ ok: false }))
28 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/fs-read-v2.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | function foo() {
20 | const authorMap = require('./author-map.json')
21 | return composer.let({ am: authorMap }, p => {
22 | return am[p.author] === undefined ? {} : am[p.author]
23 | })
24 | }
25 |
26 | module.exports = composer.sequence(foo())
27 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/namespace/current.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Registrar } from '@kui-shell/core'
18 |
19 | import { current } from '../../models/namespace'
20 |
21 | export default (commandTree: Registrar) => {
22 | commandTree.listen(`/wsk/namespace/current`, ({ tab }) => current(tab), {
23 | usage: {
24 | command: 'current',
25 | docs: 'Print the currently selected namespace'
26 | }
27 | })
28 | }
29 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/client/agent.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { type as osType } from 'os'
18 |
19 | export default () => {
20 | const isLinux = osType() === 'Linux'
21 |
22 | if (isLinux) {
23 | return new (require(process.env.LOCAL_OPENWHISK ? 'http' : 'https').Agent)({
24 | keepAlive: true,
25 | keepAliveMsecs: process.env.RUNNING_SHELL_TEST ? 20000 : 1000
26 | })
27 | } else {
28 | return undefined
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/comments.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 |
19 | /*
20 | composer.if("isTrue", composer.sequence("seq1", "seq2", "seq3"), composer.sequence("seq4", "seq5"));
21 | */
22 |
23 | module.exports = /* bar */ composer.if(
24 | 'isTrue',
25 | composer.sequence('seq1', 'seq2', 'seq3'),
26 | composer.sequence('seq4', 'seq5')
27 | ) /* goof */
28 |
29 | /* hello */
30 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/src/lib/placeholders.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | export const javascript = `function main(params) {
18 | return params
19 | }`
20 |
21 | export const python = `def main(params):
22 | return { "python": "fun" }`
23 |
24 | export const php = ` $greeting];
31 | }`
32 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/sms-translate-demo.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = composer.sequence(
4 | p => ({ payload: p.Body, number: p.From }),
5 |
6 | composer.retain(
7 | composer.sequence(
8 | args => ({ payload: args.payload }),
9 | composer.try(
10 | composer.sequence(
11 | composer.retain('watsonLanguage/languageId'),
12 | composer.if(
13 | p => p.result.language !== 'en',
14 |
15 | composer.sequence(
16 | p => ({
17 | translateFrom: p.result.language,
18 | translateTo: 'en',
19 | payload: p.params.payload
20 | }),
21 | 'watsonLanguage/translator'
22 | ),
23 |
24 | 'sms-translate/en2shakespeare'
25 | )
26 | ),
27 |
28 | () => ({ payload: 'Sorry, we cannot translate your text' })
29 | )
30 | )
31 | ),
32 |
33 | ({ params, result }) => ({ Body: result.payload, number: params.number }),
34 | 'sms-translate/sendsms'
35 | )
36 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/validate.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
18 | const main = args => {
19 | const re = new RegExp('^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$')
20 | const ok = typeof args.str === 'string' && args.str.length > 0 && args.str.length % 4 === 0 && args.str.match(re)
21 | if (ok) return { ok: true }
22 | else throw new Error('argument is not a base64 encoded string.')
23 | }
24 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/status.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { WithStatus, hasStatus } from '../models/resource'
18 | import { bg as trafficLightColor } from '../views/traffic-light'
19 |
20 | /**
21 | * Display the status of status-bearing resources
22 | *
23 | */
24 | export default {
25 | when: hasStatus,
26 | badge: (resource: WithStatus) => ({
27 | title: resource.status.charAt(0).toUpperCase() + resource.status.slice(1),
28 | css: trafficLightColor(resource)
29 | })
30 | }
31 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/fs-read.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const composer = require('openwhisk-composer')
18 | const path = require('path')
19 |
20 | function foo() {
21 | const fs = require('fs')
22 | const authorMap = JSON.parse(fs.readFileSync(path.join(__dirname, 'author-map.json'), 'utf8'))
23 | return composer.let({ am: authorMap }, p => {
24 | return am[p.author] === undefined ? {} : am[p.author]
25 | })
26 | }
27 |
28 | module.exports = composer.sequence(foo())
29 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/modes/grid-legend.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Tab } from '@kui-shell/core'
18 |
19 | import { ActivationData, isActivationData } from '../models/activation-data'
20 | import { GridOptions } from '../lib/options'
21 | import { formatLegend } from '../lib/legend'
22 |
23 | /**
24 | * Display grid legend
25 | *
26 | */
27 | export default {
28 | when: isActivationData,
29 | badge: (resource: ActivationData, tab: Tab) => formatLegend(tab, 'Grid', resource.content.stats)
30 | }
31 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/modes/json.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Composition, isComposition } from '../models/resource'
18 |
19 | /**
20 | * Flow view
21 | *
22 | */
23 | export default {
24 | when: isComposition,
25 | mode: {
26 | mode: 'ast',
27 | label: 'JSON',
28 | order: -9,
29 |
30 | content: (_, composition: Composition) => ({
31 | content: JSON.stringify(composition.annotations.find(_ => _.key === 'conductor').value, undefined, 2),
32 | contentType: 'json'
33 | })
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/preload.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { PreloadRegistrar, isHeadless } from '@kui-shell/core'
18 |
19 | export default async (registrar: PreloadRegistrar) => {
20 | if (!isHeadless()) {
21 | const preloader = (await import('./non-headless-preload')).default
22 | await preloader(registrar)
23 |
24 | // register meter widgets
25 | Promise.all([import('./views/status-stripe/grid-widget')]).then(widgets =>
26 | widgets.map(_ => registrar.registerMeter(_.default()))
27 | )
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@kui-shell/plugin-apache-composer",
3 | "version": "5.1.0",
4 | "description": "Kui plugin for the Apache OpenWhisk Composer",
5 | "license": "Apache-2.0",
6 | "author": "Nick Mitchell",
7 | "homepage": "https://github.com/IBM/kui#readme",
8 | "bugs": {
9 | "url": "https://github.com/IBM/kui/issues/new"
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "git+https://github.com/IBM/kui.git"
14 | },
15 | "keywords": [
16 | "kui",
17 | "plugin"
18 | ],
19 | "contributors": [
20 | "Mengting Yan"
21 | ],
22 | "main": "dist/index.js",
23 | "dependencies": {
24 | "@kui-shell/core": "^6.0.5",
25 | "@kui-shell/plugin-wskflow": "^6.0.5",
26 | "@kui-shell/test": "^6.0.5",
27 | "app-module-path": "2.2.0",
28 | "debug": "4.1.1",
29 | "openwhisk-composer": "0.12.0"
30 | },
31 | "kui": {
32 | "webpack": {
33 | "externals": [
34 | "redis",
35 | "redis-commands"
36 | ]
37 | }
38 | },
39 | "publishConfig": {
40 | "access": "public"
41 | },
42 | "gitHead": "89de9f78e8a1a2bdd29d2e17d7c608ab006c6d32"
43 | }
44 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/duration.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import * as prettyPrintDuration from 'pretty-ms'
18 | import { WithDuration, hasDuration, hasResponse } from '../models/resource'
19 |
20 | /**
21 | * Display wall clock time as a badge
22 | *
23 | */
24 | export default {
25 | when: hasDuration,
26 | badge: (resource: WithDuration) => ({
27 | title: prettyPrintDuration(resource.duration),
28 | css: !hasResponse(resource) ? undefined : resource.response.success ? 'green-background' : 'red-background'
29 | })
30 | }
31 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/test/openwhisk3/error-handling.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Common, ReplExpect, CLI } from '@kui-shell/test'
18 | import * as openwhisk from '@kui-shell/plugin-openwhisk/tests/lib/openwhisk/openwhisk'
19 |
20 | describe('Error handling', function(this: Common.ISuite) {
21 | before(openwhisk.before(this))
22 | after(Common.after(this))
23 |
24 | it('bind with no args', () =>
25 | CLI.command('wsk package bind', this.app)
26 | .then(ReplExpect.error(497))
27 | .catch(Common.oops(this)))
28 | })
29 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/samples/@demos/combinators/mask.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * A helper composition. Note how one can modularize compositions!
5 | * This function implements a looping subroutine. In order not to
6 | * pollute the parameter bindings of the given composition, this
7 | * helper uses the MASK combinator to "mask out" the n variable.
8 | */
9 | function loop(n, composition) {
10 | return composer.let(
11 | { n },
12 | composer.while(() => n-- > 0, composer.mask(composition))
13 | )
14 | }
15 |
16 | /**
17 | * The exported composition uses the loop helper. Thanks to MASK,
18 | * this composition returns the expected { value: 12 }. With MASK,
19 | * the two scopes of the "n" variable (one used by loop, and the
20 | * other by this main composition) do not collide.
21 | */
22 | module.exports = composer.let(
23 | // the parameter bindings of the let
24 | { n: 0 },
25 |
26 | // the body of the let; the n referenced here should
27 | // be "our" n, not the n declared by the loop helper.
28 | // With mask, we achieve the desired scoping.
29 | loop(
30 | 3,
31 | loop(4, () => ++n)
32 | )
33 | )
34 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/modes/code.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n } from '@kui-shell/core'
18 | import { WithSource, hasSource } from '../models/resource'
19 |
20 | const strings = i18n('plugin-openwhisk')
21 |
22 | /**
23 | * Flow view
24 | *
25 | */
26 | export default {
27 | when: hasSource,
28 | mode: {
29 | mode: 'code',
30 | label: strings('Code'),
31 | order: -8,
32 |
33 | content: (_, preview: WithSource) => ({
34 | content: preview.source,
35 | contentType: 'javascript'
36 | })
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/plugin.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Registrar } from '@kui-shell/core'
18 |
19 | import { toplevel as usage } from './usage'
20 | import grid from './lib/cmds/grid'
21 | import table from './lib/cmds/table'
22 |
23 | /**
24 | * This is the module
25 | *
26 | */
27 | export default (commandTree: Registrar) => {
28 | // register the top-level usage handler
29 | commandTree.subtree('/visualize', { usage })
30 |
31 | // register the command handlers
32 | return Promise.all([grid(commandTree), table(commandTree)])
33 | }
34 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/lib/utility/messages.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | export const invalidFSM = 'The app you provided does not appear to be a valid app program'
18 |
19 | export const slowInit = 'Your storage should be active in ~60 seconds. Meanwhile, use "fsh help" to get started.'
20 |
21 | export const unknownInput = 'Please provide either a .json/.ast file, or a .js file that uses the composer library'
22 |
23 | export const errors = {
24 | lastAndLastFailed: 'You specified both --last and --last-failed. Please choose one or the other.'
25 | }
26 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/models/selection.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Tab, currentSelection as coreCurrentSelection } from '@kui-shell/core'
18 |
19 | import { OpenWhiskResource } from './resource'
20 |
21 | export function currentSelection(tab: Tab, mustBeKind?: string): T {
22 | const selection = coreCurrentSelection(tab) as T
23 |
24 | if (selection && mustBeKind && mustBeKind !== selection.kind) {
25 | throw new Error('The current entity is not of the expected kind')
26 | }
27 |
28 | return selection
29 | }
30 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/lib/utility/parse.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /* use wsk utility to parse parameters from a command */
18 | export const parseParams = (argv, wsk) => {
19 | const { kvOptions: { action: { parameters = [] } = {} } = {} } = wsk.parseOptions(argv, 'action') // eslint-disable-line
20 | return parameters.reduce(function(params, ele) {
21 | params[ele.key] = ele.value
22 | return params
23 | }, {})
24 | }
25 |
26 | /* parse the composition name from a command */
27 | export const parseName = (args, cmd) => args[args.indexOf(cmd) + 1]
28 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/blackbox.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n } from '@kui-shell/core'
18 | import { BlackboxAction, isBlackbox } from '../models/resource'
19 |
20 | const strings = i18n('plugin-openwhisk')
21 |
22 | /**
23 | * Alternative to Code mode for blackbox actions
24 | *
25 | */
26 | export default {
27 | when: isBlackbox,
28 | mode: {
29 | mode: 'code',
30 | label: strings('Code'),
31 |
32 | content: (_, resource: BlackboxAction) => ({
33 | content: `dockerhub image: ${resource.exec.image}`
34 | })
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/code.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n } from '@kui-shell/core'
18 | import { Action, hasTextualCode } from '../models/resource'
19 |
20 | const strings = i18n('plugin-openwhisk')
21 |
22 | /**
23 | * The Code mode applies to all Action resources.
24 | *
25 | */
26 | export default {
27 | when: hasTextualCode,
28 | mode: {
29 | mode: 'code',
30 | label: strings('Code'),
31 |
32 | content: (_, resource: Action) => ({
33 | content: resource.exec.code,
34 | contentType: resource.exec.kind
35 | })
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/modes/json-from-preview.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n } from '@kui-shell/core'
18 | import { Preview, isPreview } from '../models/resource'
19 |
20 | const strings = i18n('plugin-apache-composer')
21 |
22 | /**
23 | * Flow view
24 | *
25 | */
26 | export default {
27 | when: isPreview,
28 | mode: {
29 | mode: 'ast',
30 | label: strings('JSON'),
31 | order: -9,
32 |
33 | content: (_, preview: Preview) => ({
34 | content: JSON.stringify(preview.ast, undefined, 2),
35 | contentType: 'json'
36 | })
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/edit.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n , encodeComponent } from '@kui-shell/core'
18 |
19 |
20 | import { fqn } from '../controller/fqn'
21 | import { Action, hasCode } from '../models/resource'
22 |
23 | const strings = i18n('plugin-openwhisk')
24 |
25 | /**
26 | * An Edit button
27 | *
28 | */
29 | export default {
30 | when: hasCode,
31 | mode: {
32 | mode: 'edit',
33 | label: strings('Edit'),
34 | kind: 'drilldown' as const,
35 |
36 | command: (_, resource: Action) => `edit ${encodeComponent(fqn(resource))}`
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/modes/flow.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n, Tab } from '@kui-shell/core'
18 |
19 | import { Session, isSession } from '../models/resource'
20 | import { doFlow } from '../lib/controller/cmd/flowCommand'
21 |
22 | const strings = i18n('plugin-apache-composer')
23 |
24 | /**
25 | * Flow view
26 | *
27 | */
28 | export default {
29 | when: isSession,
30 | mode: {
31 | mode: 'visualization',
32 | label: strings('Flow'),
33 | order: 1,
34 |
35 | content: (tab: Tab, session: Session) => doFlow(tab, session.activationId)
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/client/get.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Client } from 'openwhisk'
18 | import { ExecOptions } from '@kui-shell/core'
19 |
20 | import { initOW, initOWFromConfig } from '../models/auth'
21 |
22 | export { default as clientOptions } from './options'
23 |
24 | export const getClient = (execOptions: ExecOptions): Client => {
25 | if (execOptions && execOptions.credentials && execOptions.credentials.openwhisk) {
26 | return initOWFromConfig(execOptions.credentials.openwhisk)
27 | } else {
28 | return initOW()
29 | }
30 | }
31 |
32 | export default getClient
33 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/non-headless-preload.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { PreloadRegistrar } from '@kui-shell/core'
18 |
19 | // modes
20 | import grid from './modes/grid'
21 | import table from './modes/table'
22 |
23 | // badges
24 | import gridLegend from './modes/grid-legend'
25 |
26 | /**
27 | * Notes: buttons and modes and badges will be presented in the order
28 | * they are registered, unless they specify an `order` attribute.
29 | *
30 | */
31 | export default async (registrar: PreloadRegistrar) => {
32 | registrar.registerModes(table, grid)
33 |
34 | registrar.registerBadge(gridLegend)
35 | }
36 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/namespace/list.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Arguments, Registrar } from '@kui-shell/core'
18 |
19 | import standardOptions from '../aliases'
20 | import { synonyms } from '../../models/synonyms'
21 | import { getClient } from '../../client/get'
22 |
23 | async function doList({ execOptions }: Arguments) {
24 | const raw = await getClient(execOptions).namespaces.list()
25 | return raw[0]
26 | }
27 |
28 | export default (registrar: Registrar) => {
29 | synonyms('namespaces').forEach(syn => {
30 | registrar.listen(`/wsk/${syn}/list`, doList, standardOptions)
31 | })
32 | }
33 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/namespace/rules.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { encodeComponent, i18n } from '@kui-shell/core'
18 |
19 | import { fqn } from '../../controller/fqn'
20 | import { WithRules, hasRules } from '../../models/resource'
21 |
22 | const strings = i18n('plugin-openwhisk')
23 |
24 | /**
25 | * Namespace rules drilldown
26 | *
27 | */
28 | export default {
29 | when: hasRules,
30 | mode: {
31 | mode: 'rules',
32 | label: strings('Show Rules'),
33 | kind: 'drilldown' as const,
34 |
35 | command: (_, resource: WithRules) => `wsk namespace list-rules ${encodeComponent(fqn(resource))}`
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "standard",
4 | "plugin:@typescript-eslint/recommended",
5 | "prettier",
6 | "prettier/standard",
7 | "prettier/@typescript-eslint"
8 | ],
9 | "parser": "@typescript-eslint/parser",
10 | "parserOptions": {
11 | "ecmaVersion": 2018,
12 | "sourceType": "module"
13 | },
14 | "plugins": ["@typescript-eslint"],
15 | "rules": {
16 | "dot-notation": "off",
17 | "no-undef": "off",
18 | "import/first": "off",
19 | "@typescript-eslint/camelcase": [
20 | "error",
21 | {
22 | "allow": [
23 | "wrap_line_length",
24 | "indent_size",
25 | "api_key",
26 | "ignore_certs",
27 | "__cloudshell_decorations",
28 | "follow_max",
29 | "open_timeout"
30 | ]
31 | }
32 | ],
33 | "@typescript-eslint/no-unused-vars": "error",
34 | "@typescript-eslint/explicit-function-return-type": "off",
35 | "@typescript-eslint/explicit-member-accessibility": "error",
36 | "@typescript-eslint/no-var-requires": "off"
37 | },
38 | "overrides": [
39 | {
40 | "files": ["*.js"],
41 | "rules": {
42 | "@typescript-eslint/explicit-member-accessibility": "off"
43 | }
44 | }
45 | ]
46 | }
47 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/lib/controller/cmd/app-delete.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-19 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Registrar } from '@kui-shell/core'
18 | import { Action } from '@kui-shell/plugin-openwhisk'
19 |
20 | import { appDelete } from '../../utility/usage'
21 | import * as view from '../../view/entity-view'
22 |
23 | export default async (commandTree: Registrar) => {
24 | /* command handler for app delete */
25 | commandTree.listen(
26 | `/wsk/app/delete`,
27 | ({ command, REPL }) => {
28 | return REPL.qexec(command.replace('app', 'action')).then(result => view.formatDeleteResult(result))
29 | },
30 | { usage: appDelete }
31 | )
32 | }
33 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/package-feeds.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { encodeComponent, i18n } from '@kui-shell/core'
18 |
19 | import { fqn } from '../controller/fqn'
20 | import { WithFeeds, hasFeeds } from '../models/resource'
21 |
22 | const strings = i18n('plugin-openwhisk')
23 |
24 | /**
25 | * The Annotations mode applies to all Action resources.
26 | *
27 | */
28 | export default {
29 | when: hasFeeds,
30 | mode: {
31 | mode: 'feeds',
32 | label: strings('Show Feeds'),
33 | kind: 'drilldown' as const,
34 |
35 | command: (_, resource: WithFeeds) => `wsk package list-feeds ${encodeComponent(fqn(resource))}`
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/show-action.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { encodeComponent, i18n } from '@kui-shell/core'
18 |
19 | import { fqnOfPath } from '../controller/fqn'
20 | import { WithAction, hasAction } from '../models/resource'
21 |
22 | const strings = i18n('plugin-openwhisk')
23 |
24 | /**
25 | * Show the related action, e.g. for Rules.
26 | *
27 | */
28 | export default {
29 | when: hasAction,
30 | mode: {
31 | mode: 'action',
32 | label: strings('Show Action'),
33 | kind: 'drilldown' as const,
34 |
35 | command: (_, resource: WithAction) => `wsk action get ${encodeComponent(fqnOfPath(resource.action))}`
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/tests/data/openwhisk/icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
30 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/limits.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n } from '@kui-shell/core'
18 | import { WithLimits, hasLimits } from '../models/resource'
19 |
20 | const strings = i18n('plugin-openwhisk')
21 |
22 | /**
23 | * The Code mode applies to all Action resources.
24 | *
25 | */
26 | export default {
27 | when: hasLimits,
28 | mode: {
29 | mode: 'limits',
30 | label: strings('Limits'),
31 |
32 | content: async (_, resource: WithLimits) => {
33 | const { safeDump } = await import('js-yaml')
34 | return {
35 | content: safeDump(resource.limits),
36 | contentType: 'yaml'
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/namespace/packages.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { encodeComponent, i18n } from '@kui-shell/core'
18 |
19 | import { fqn } from '../../controller/fqn'
20 | import { WithPackages, hasPackages } from '../../models/resource'
21 |
22 | const strings = i18n('plugin-openwhisk')
23 |
24 | /**
25 | * Namespace packages drilldown
26 | *
27 | */
28 | export default {
29 | when: hasPackages,
30 | mode: {
31 | mode: 'packages',
32 | label: strings('Show Packages'),
33 | kind: 'drilldown' as const,
34 |
35 | command: (_, resource: WithPackages) => `wsk namespace list-packages ${encodeComponent(fqn(resource))}`
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/namespace/triggers.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { encodeComponent, i18n } from '@kui-shell/core'
18 |
19 | import { fqn } from '../../controller/fqn'
20 | import { WithTriggers, hasTriggers } from '../../models/resource'
21 |
22 | const strings = i18n('plugin-openwhisk')
23 |
24 | /**
25 | * Namespace triggers drilldown
26 | *
27 | */
28 | export default {
29 | when: hasTriggers,
30 | mode: {
31 | mode: 'triggers',
32 | label: strings('Show Triggers'),
33 | kind: 'drilldown' as const,
34 |
35 | command: (_, resource: WithTriggers) => `wsk namespace list-triggers ${encodeComponent(fqn(resource))}`
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/show-trigger.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { encodeComponent, i18n } from '@kui-shell/core'
18 |
19 | import { fqnOfPath } from '../controller/fqn'
20 | import { WithTrigger, hasTrigger } from '../models/resource'
21 |
22 | const strings = i18n('plugin-openwhisk')
23 |
24 | /**
25 | * Show the related trigger, e.g. for Rules.
26 | *
27 | */
28 | export default {
29 | when: hasTrigger,
30 | mode: {
31 | mode: 'trigger',
32 | label: strings('Show Trigger'),
33 | kind: 'drilldown' as const,
34 |
35 | command: (_, resource: WithTrigger) => `wsk trigger get ${encodeComponent(fqnOfPath(resource.trigger))}`
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/sms-translate-demo-with-comments.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | module.exports = /** COMMENT */ composer.sequence(
4 | // COMMENT
5 | p => ({ payload: p.Body, number: p.From /* goofy */ }),
6 | /* goof */
7 | composer.retain(
8 | composer.sequence(
9 | args => ({ payload: args.payload }),
10 | composer.try(
11 | /* COMMENT */
12 | composer.sequence(
13 | composer.retain('watsonLanguage/languageId'),
14 | composer.if(
15 | p => p.result.language !== 'en',
16 |
17 | composer.sequence(
18 | p => ({
19 | translateFrom: p.result.language,
20 | translateTo: 'en',
21 | payload: p.params.payload
22 | }),
23 | 'watsonLanguage/translator'
24 | ),
25 |
26 | 'sms-translate/en2shakespeare'
27 | )
28 | ),
29 |
30 | () => ({ payload: 'Sorry, we cannot translate your text' })
31 | )
32 | )
33 | ),
34 |
35 | ({ params, result }) => ({ Body: result.payload, number: params.number }),
36 | 'sms-translate/sendsms'
37 | ) /* COMMENT */
38 | /* COMMENT */
39 |
40 | /* COMMENT */ // COMMENT
41 | // COMMENT
42 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/test/grid/timeline.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Common } from '@kui-shell/test'
18 | import * as openwhisk from '@kui-shell/plugin-openwhisk/tests/lib/openwhisk/openwhisk'
19 |
20 | describe('timeline visualization', function(this: Common.ISuite) {
21 | before(openwhisk.before(this))
22 | after(Common.after(this))
23 |
24 | // disabled for now shell issue #794
25 | /* const icon = `${Selectors.SIDECAR} .sidecar-header-icon-wrapper .sidecar-header-icon`
26 | it('should open timeline', () => CLI.command('timeline', this.app)
27 | .then(() => this.app.client.waitForText(icon, 'timeline'))
28 | .catch(Common.oops(this))) */
29 | })
30 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/namespace/actions.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { encodeComponent, i18n } from '@kui-shell/core'
18 |
19 | import { fqn } from '../../controller/fqn'
20 | import { WithActionDescs, hasActionDescs } from '../../models/resource'
21 |
22 | const strings = i18n('plugin-openwhisk')
23 |
24 | /**
25 | * Namespace actions drilldown
26 | *
27 | */
28 | export default {
29 | when: hasActionDescs,
30 | mode: {
31 | mode: 'actions',
32 | label: strings('Show Actions'),
33 | kind: 'drilldown' as const,
34 |
35 | command: (_, resource: WithActionDescs) => `wsk namespace list-actions ${encodeComponent(fqn(resource))}`
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/package-actions.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { encodeComponent, i18n } from '@kui-shell/core'
18 |
19 | import { fqn } from '../controller/fqn'
20 | import { WithActions, hasActions } from '../models/resource'
21 |
22 | const strings = i18n('plugin-openwhisk')
23 |
24 | /**
25 | * The Annotations mode applies to all Action resources.
26 | *
27 | */
28 | export default {
29 | when: hasActions,
30 | mode: {
31 | mode: 'actions',
32 | label: strings('Show Actions'),
33 | kind: 'drilldown' as const,
34 |
35 | command: (_, resource: WithActions) => `wsk package list-actions ${encodeComponent(fqn(resource))}`
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/show-binding.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { encodeComponent, i18n } from '@kui-shell/core'
18 |
19 | import { fqn } from '../controller/fqn'
20 | import { WithBinding, hasBinding } from '../models/resource'
21 |
22 | const strings = i18n('plugin-openwhisk')
23 |
24 | /**
25 | * The Annotations mode applies to all Action resources.
26 | *
27 | */
28 | export default {
29 | when: hasBinding,
30 | mode: {
31 | mode: 'binding',
32 | label: strings('Show Binding'),
33 | kind: 'drilldown' as const,
34 |
35 | command: (_, resource: WithBinding) => `wsk package get ${encodeComponent(fqn({ metadata: resource.binding }))}`
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk-editor-extensions/src/preload.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import Debug from 'debug'
18 | const debug = Debug('plugins/openwhisk-editor-extensions/preload')
19 | debug('loading')
20 |
21 | import { isHeadless } from '@kui-shell/core'
22 | import { registerFetcher } from '@kui-shell/plugin-editor'
23 |
24 | debug('done loading prereqs')
25 |
26 | /**
27 | * A preloaded plugin that enhances the view modes for actions
28 | *
29 | */
30 | export default async () => {
31 | debug('initializing')
32 |
33 | if (!isHeadless()) {
34 | const { fetchAction } = await import('./lib/cmds/new')
35 | registerFetcher(fetchAction())
36 | }
37 | }
38 |
39 | debug('finished loading')
40 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/delete.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n , encodeComponent } from '@kui-shell/core'
18 |
19 |
20 | const strings = i18n('plugin-openwhisk')
21 |
22 | import { fqn } from '../controller/fqn'
23 | import { Deleteable, isDeleteable } from '../models/resource'
24 |
25 | /**
26 | * The Annotations mode applies to all Action resources.
27 | *
28 | */
29 | export default {
30 | when: isDeleteable,
31 | mode: {
32 | mode: 'delete',
33 | label: strings('Delete'),
34 | kind: 'drilldown' as const,
35 |
36 | command: (_, resource: Deleteable) =>
37 | `confirm 'wsk ${resource.kind.toLowerCase()} delete ${encodeComponent(fqn(resource))}'`
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/parameters.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n } from '@kui-shell/core'
18 | import { WithParameters, hasParameters } from '../models/resource'
19 |
20 | const strings = i18n('plugin-openwhisk')
21 |
22 | /**
23 | * The Parameters mode applies to all WithParameters.
24 | *
25 | */
26 | export default {
27 | when: hasParameters,
28 | mode: {
29 | mode: 'parameters',
30 | label: strings('Parameters'),
31 |
32 | content: async (_, resource: WithParameters) => {
33 | const { safeDump } = await import('js-yaml')
34 | return {
35 | content: safeDump(resource.parameters),
36 | contentType: 'yaml'
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/annotations.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n } from '@kui-shell/core'
18 | import { WithAnnotations, hasAnnotations } from '../models/resource'
19 |
20 | const strings = i18n('plugin-openwhisk')
21 |
22 | /**
23 | * The Annotations mode applies to all Action resources.
24 | *
25 | */
26 | export default {
27 | when: hasAnnotations,
28 | mode: {
29 | mode: 'annotations',
30 | label: strings('Annotations'),
31 |
32 | content: async (_, resource: WithAnnotations) => {
33 | const { safeDump } = await import('js-yaml')
34 | return {
35 | content: safeDump(resource.annotations),
36 | contentType: 'yaml'
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/sms-translate.js:
--------------------------------------------------------------------------------
1 | const composer = require('openwhisk-composer')
2 |
3 | /**
4 | * @param { payload: string to translate }
5 | * @return { payload: string after translation }
6 | */
7 | function translate() {
8 | return composer.sequence(
9 | composer.retain('watsonLanguage/languageId'),
10 |
11 | composer.if(
12 | p => p.result.language !== 'en',
13 |
14 | /* then */ composer.sequence(
15 | p => ({
16 | translateFrom: p.result.language,
17 | translateTo: 'en',
18 | payload: p.params.payload
19 | }),
20 | 'watsonLanguage/translator'
21 | ),
22 |
23 | /* else */ 'sms-translate/en2shakespeare'
24 | )
25 | )
26 | }
27 |
28 | /**
29 | * @param { Body: SMS message, From: phone number to text back }
30 | * @return { html: OK message }
31 | */
32 | module.exports = composer.sequence(
33 | p => ({ payload: p.Body, number: p.From }),
34 |
35 | composer.retain(
36 | composer.sequence(
37 | args => ({ payload: args.payload }),
38 | composer.try(translate(), () => ({
39 | payload: 'Sorry, we cannot translate your text'
40 | }))
41 | )
42 | ),
43 |
44 | ({ params, result }) => ({ Body: result.payload, number: params.number }),
45 | 'sms-translate/sendsms'
46 | )
47 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/lib/options.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { ParsedOptions } from '@kui-shell/core'
18 |
19 | export interface Options extends ParsedOptions {
20 | name?: string
21 | live?: boolean
22 | batches?: number
23 |
24 | groupBySuccess?: boolean
25 | buckets?: number
26 | nBuckets?: number
27 | full?: boolean
28 | outliers?: true | number
29 | split?: string | true
30 | }
31 |
32 | export interface TableOptions extends Options {
33 | w?: boolean
34 | ww?: boolean
35 | ticks?: number
36 | }
37 |
38 | export interface GridOptions extends Options {
39 | zoom?: number
40 | full?: boolean
41 | appName?: string
42 | fixedHeader?: boolean
43 | timeline?: boolean | 'latency' | 'time'
44 | }
45 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/aliases.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { CommandOptions } from '@kui-shell/core'
18 |
19 | export const alias = {
20 | /* memory: ['m'],
21 | timeout: ['t'],
22 | param: ['p'],
23 | annotation: ['a'],
24 | feed: ['f'],
25 | blocking: ['b'],
26 | result: ['r'],
27 | limit: ['l'],
28 | skip: ['s'] */
29 | }
30 |
31 | export const configuration = {
32 | 'camel-case-expansion': false,
33 | 'duplicate-arguments-array': false
34 | }
35 |
36 | export const standardOptions: CommandOptions = {
37 | usage: {
38 | configuration
39 | },
40 | flags: {
41 | boolean: ['sequence', 'native', 'copy', 'web'],
42 | alias
43 | }
44 | }
45 |
46 | export default standardOptions
47 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/ok.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { isHeadless } from '@kui-shell/core'
18 |
19 | export default async function(suffix: string | HTMLElement): Promise {
20 | const ok = document.createElement('span')
21 | ok.classList.add('green-text')
22 |
23 | if (isHeadless()) {
24 | const colors = await import('colors')
25 | ok.innerText = colors.green('ok: ')
26 | } else {
27 | ok.innerText = 'ok: '
28 | }
29 |
30 | const all = document.createElement('div')
31 | all.appendChild(ok)
32 |
33 | if (typeof suffix === 'string') {
34 | all.appendChild(document.createTextNode(suffix))
35 | } else {
36 | all.appendChild(suffix)
37 | }
38 |
39 | return all
40 | }
41 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/result.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Dict } from 'openwhisk'
18 | import { i18n } from '@kui-shell/core'
19 | import { WithResponse, hasResponse } from '../models/resource'
20 |
21 | const strings = i18n('plugin-openwhisk')
22 |
23 | /**
24 | * The Response mode for activations
25 | *
26 | */
27 | export default {
28 | when: hasResponse,
29 | mode: {
30 | mode: 'result',
31 | label: strings('Result'),
32 |
33 | content: async (_, resource: WithResponse) => {
34 | const { safeDump } = await import('js-yaml')
35 | return {
36 | content: safeDump(resource.response.result),
37 | contentType: 'yaml'
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/test/openwhisk1/list/namespace.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * read-only tests against the CLI's list APIs
19 | *
20 | */
21 |
22 | import { Common, CLI, ReplExpect } from '@kui-shell/test'
23 |
24 | import * as openwhisk from '@kui-shell/plugin-openwhisk/tests/lib/openwhisk/openwhisk'
25 |
26 | describe('Namespaces list', function(this: Common.ISuite) {
27 | before(openwhisk.before(this))
28 | after(Common.after(this))
29 |
30 | // implicit entity type
31 | openwhisk.aliases.list.forEach(cmd => {
32 | it(`should list namespaces with "namespaces ${cmd}"`, () =>
33 | CLI.command(`wsk namespaces ${cmd}`, this.app).then(ReplExpect.okWithString(openwhisk.expectedNamespace())))
34 | })
35 | })
36 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/raw.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n } from '@kui-shell/core'
18 | import { RawDataBearing, hasRawData } from '../models/resource'
19 |
20 | const strings = i18n('plugin-openwhisk')
21 |
22 | /**
23 | * The Raw mode applies to all OpenWhiskResources, and simply extracts
24 | * the raw `data` field from the resource.
25 | *
26 | */
27 | export default {
28 | when: hasRawData,
29 | mode: {
30 | mode: 'raw',
31 | label: strings('Raw'),
32 |
33 | content: async (_, resource: RawDataBearing) => {
34 | const { safeDump } = await import('js-yaml')
35 | return {
36 | content: safeDump(JSON.parse(resource.data)),
37 | contentType: 'yaml'
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@kui-shell/plugin-openwhisk",
3 | "version": "5.1.0",
4 | "description": "Kui plugin for OpenWhisk",
5 | "license": "Apache-2.0",
6 | "author": "Nick Mitchell",
7 | "homepage": "https://github.com/kui-shell/oui#readme",
8 | "bugs": {
9 | "url": "https://github.com/kui-shell/oui/issues/new"
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "git+https://github.com/kui-shell/oui.git"
14 | },
15 | "keywords": [
16 | "kui",
17 | "plugin",
18 | "openwhisk"
19 | ],
20 | "contributors": [
21 | "Mengting Yan"
22 | ],
23 | "main": "dist/index.js",
24 | "module": "mdist/index.js",
25 | "dependencies": {
26 | "@kui-shell/core": "^6.0.5",
27 | "@kui-shell/plugin-core-support": "^6.0.5",
28 | "@kui-shell/plugin-wskflow": "^6.0.5",
29 | "@kui-shell/test": "^6.0.5",
30 | "adm-zip": "0.4.13",
31 | "debug": "4.1.1",
32 | "htmlparser2": "4.0.0",
33 | "indefinite": "^2.3.1",
34 | "js-yaml": "^3.13.1",
35 | "needle": "2.4.0",
36 | "openwhisk": "3.20.0",
37 | "parse-duration": "0.1.2",
38 | "pretty-ms": "5.1.0",
39 | "promise-retry": "1.1.1",
40 | "tmp": "0.1.0",
41 | "yargs-parser": "16.1.0"
42 | },
43 | "publishConfig": {
44 | "access": "public"
45 | },
46 | "gitHead": "89de9f78e8a1a2bdd29d2e17d7c608ab006c6d32"
47 | }
48 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/test/composer2/composer-config.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Common, CLI, ReplExpect } from '@kui-shell/test'
18 | import * as openwhisk from '@kui-shell/plugin-openwhisk/tests/lib/openwhisk/openwhisk'
19 |
20 | describe('composer config', function(this: Common.ISuite) {
21 | before(openwhisk.before(this))
22 | after(Common.after(this))
23 |
24 | /** app config */
25 | const getConfig = cmd =>
26 | it(`should show app configuration via "${cmd}"`, () =>
27 | CLI.command(cmd, this.app)
28 | .then(ReplExpect.okWithCustom({ expect: 'Composer version' }))
29 | .catch(Common.oops(this)))
30 |
31 | getConfig('wsk app properties')
32 | getConfig('wsk app props')
33 | getConfig('wsk app config')
34 | })
35 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/test/composer1/composer-compose.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Common, CLI, ReplExpect } from '@kui-shell/test'
18 | import * as openwhisk from '@kui-shell/plugin-openwhisk/tests/lib/openwhisk/openwhisk'
19 |
20 | const expectedError = `Usage: This command is intended for use from the CLI, to launch this graphical Shell.
21 | You are already here. Welcome!`
22 |
23 | describe('try using "shell" to open the graphical shell, when already in the graphical shell', function(this: Common.ISuite) {
24 | before(openwhisk.before(this))
25 | after(Common.after(this))
26 |
27 | it('should fail when executing "shell"', () =>
28 | CLI.command('shell', this.app)
29 | .then(ReplExpect.error(0, expectedError))
30 | .catch(Common.oops(this)))
31 | })
32 |
--------------------------------------------------------------------------------
/tools/travis/openwhisk/openwhisk-runtimes-with-nodejs8.json:
--------------------------------------------------------------------------------
1 | {
2 | "runtimes": {
3 | "nodejs": [
4 | {
5 | "kind": "nodejs",
6 | "image": {
7 | "prefix": "openwhisk",
8 | "name": "nodejsaction",
9 | "tag": "latest"
10 | },
11 | "deprecated": true
12 | },
13 | {
14 | "kind": "nodejs:8",
15 | "default": false,
16 | "image": {
17 | "prefix": "openwhisk",
18 | "name": "action-nodejs-v8",
19 | "tag": "latest"
20 | },
21 | "deprecated": false,
22 | "attached": {
23 | "attachmentName": "codefile",
24 | "attachmentType": "text/plain"
25 | }
26 | },
27 | {
28 | "kind": "nodejs:6",
29 | "default": true,
30 | "image": {
31 | "prefix": "openwhisk",
32 | "name": "nodejs6action",
33 | "tag": "latest"
34 | },
35 | "deprecated": false,
36 | "stemCells": [
37 | {
38 | "count": 2,
39 | "memory": "256 MB"
40 | }
41 | ]
42 | }
43 | ],
44 | "python": [
45 | {
46 | "kind": "python",
47 | "image": {
48 | "prefix": "openwhisk",
49 | "name": "nodejs6action",
50 | "tag": "latest"
51 | },
52 | "deprecated": false
53 | }
54 | ]
55 | },
56 | "blackboxes": []
57 | }
58 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/activation/usage.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { skipAndLimit } from '../usage'
18 |
19 | export const list = {
20 | command: 'list',
21 | docs: 'list recent activations',
22 | strict: 'list',
23 | optional: [
24 | {
25 | name: 'name',
26 | positional: true,
27 | docs: 'filter by a given action name'
28 | },
29 | {
30 | name: '--name',
31 | docs: 'filter by a given action name'
32 | },
33 | {
34 | name: '--since',
35 | docs: 'return activations with timestamps later than SINCE; measured in milliseconds since epoch'
36 | },
37 | {
38 | name: '--upto',
39 | docs: 'return activations with timestamps earlier than UPTO; measured in milliseconds since epoch'
40 | }
41 | ].concat(skipAndLimit)
42 | }
43 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file.
4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5 |
6 | # [5.1.0](https://github.com/IBM/kui/compare/v4.5.0...v5.1.0) (2019-10-11)
7 |
8 | ### Bug Fixes
9 |
10 | - **plugins/plugin-openwhisk:** missing wsk prefix to auth switch ([9867189](https://github.com/IBM/kui/commit/9867189)), closes [#2872](https://github.com/IBM/kui/issues/2872)
11 | - drilldown bugs in openwhisk trace view ([9185585](https://github.com/IBM/kui/commit/9185585)), closes [#2874](https://github.com/IBM/kui/issues/2874)
12 | - user-installed plugins cannot always REPL.qexec other plugins ([c17c1e6](https://github.com/IBM/kui/commit/c17c1e6)), closes [#2963](https://github.com/IBM/kui/issues/2963)
13 |
14 | ### Features
15 |
16 | - enable plugin-manager for electron clients ([4814cb9](https://github.com/IBM/kui/commit/4814cb9)), closes [#2935](https://github.com/IBM/kui/issues/2935)
17 |
18 | # [5.0.0](https://github.com/IBM/kui/compare/v4.5.0...v5.0.0) (2019-10-03)
19 |
20 | ### Bug Fixes
21 |
22 | - **plugins/plugin-openwhisk:** missing wsk prefix to auth switch ([9867189](https://github.com/IBM/kui/commit/9867189)), closes [#2872](https://github.com/IBM/kui/issues/2872)
23 | - drilldown bugs in openwhisk trace view ([9185585](https://github.com/IBM/kui/commit/9185585)), closes [#2874](https://github.com/IBM/kui/issues/2874)
24 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/path-rel-require/srijith.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017 IBM Corp. All Right Reserved.
3 | * @author Watson Education
4 | *
5 | * Util class for Composer actions.
6 | *
7 | */
8 |
9 | const composer = require('openwhisk-composer')
10 | const composerUtils = require('./composer_utils')
11 |
12 | // Actions
13 | const authentication = require('./actions/authentication/index.js').main
14 | const configuration = require('./actions/configuration/index.js').main
15 | const options = require('./actions/options/index.js').main
16 | const postProcessing = require('./actions/post_processing/index.js').main
17 | const startSession = require('./actions/start_session/index.js').main
18 |
19 | const app = composer.if(composerUtils.isOptionsCall, options, function(args) {
20 | const metricsAggregator = composerUtils.MetricsAggregator()
21 | return composerUtils.TimeOutPromise(
22 | Promise.resolve(
23 | composer.sequence(
24 | composerUtils.addMetricAggregator(metricsAggregator, authentication),
25 | composerUtils.addMetricAggregator(metricsAggregator, configuration),
26 | composerUtils.addMetricAggregator(metricsAggregator, startSession),
27 | composerUtils.addMetricAggregator(metricsAggregator, postProcessing)
28 | ),
29 | args.origin,
30 | metricsAggregator,
31 | args.max_seconds * 1000
32 | )
33 | )
34 | })
35 |
36 | module.exports = app
37 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/modes/visualize.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n, Tab } from '@kui-shell/core'
18 | import { ASTNode } from '@kui-shell/plugin-wskflow'
19 |
20 | import { Composition, isComposition } from '../models/resource'
21 |
22 | const strings = i18n('plugin-apache-composer')
23 |
24 | /**
25 | * Flow view
26 | *
27 | */
28 | export default {
29 | when: isComposition,
30 | mode: {
31 | mode: 'visualization',
32 | label: strings('Flow'),
33 | order: -10,
34 |
35 | content: async (tab: Tab, composition: Composition) => {
36 | const ast = composition.annotations.find(_ => _.key === 'conductor').value as ASTNode
37 |
38 | const { visualize } = await import('@kui-shell/plugin-wskflow')
39 | const { view } = await visualize(tab, ast)
40 |
41 | return view
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/lib/controller/cmd/app-get.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-19 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Registrar } from '@kui-shell/core'
18 | import { Action } from '@kui-shell/plugin-openwhisk'
19 |
20 | import { appGet } from '../../utility/usage'
21 | import * as parseUtil from '../../utility/parse'
22 |
23 | export default async (commandTree: Registrar) => {
24 | /* command handler for app get */
25 | commandTree.listen(
26 | `/wsk/app/get`,
27 | ({ argvNoOptions, execOptions, parsedOptions, REPL }) =>
28 | REPL.qexec(
29 | `wsk action get "${parseUtil.parseName(argvNoOptions, 'get')}"`,
30 | undefined,
31 | undefined,
32 | Object.assign({}, execOptions, {
33 | override: true,
34 | originalOptions: parsedOptions
35 | })
36 | ),
37 | { usage: appGet('get') }
38 | )
39 | }
40 |
--------------------------------------------------------------------------------
/tools/travis/openwhisk/openwhisk-runtimes-with-java8.json:
--------------------------------------------------------------------------------
1 | {
2 | "runtimes": {
3 | "nodejs": [
4 | {
5 | "kind": "nodejs",
6 | "image": {
7 | "prefix": "openwhisk",
8 | "name": "nodejsaction",
9 | "tag": "latest"
10 | },
11 | "deprecated": true
12 | },
13 | {
14 | "kind": "nodejs:6",
15 | "default": true,
16 | "image": {
17 | "prefix": "openwhisk",
18 | "name": "nodejs6action",
19 | "tag": "latest"
20 | },
21 | "deprecated": false,
22 | "stemCells": [
23 | {
24 | "count": 2,
25 | "memory": "256 MB"
26 | }
27 | ]
28 | }
29 | ],
30 | "python": [
31 | {
32 | "kind": "python",
33 | "image": {
34 | "prefix": "openwhisk",
35 | "name": "nodejs6action",
36 | "tag": "latest"
37 | },
38 | "deprecated": false
39 | }
40 | ],
41 | "java": [
42 | {
43 | "kind": "java",
44 | "default": true,
45 | "image": {
46 | "prefix": "openwhisk",
47 | "name": "java8action",
48 | "tag": "latest"
49 | },
50 | "deprecated": false,
51 | "attached": {
52 | "attachmentName": "jarfile",
53 | "attachmentType": "application/java-archive"
54 | },
55 | "requireMain": true
56 | }
57 | ]
58 | },
59 | "blackboxes": []
60 | }
61 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/invoke.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { encodeComponent, i18n } from '@kui-shell/core'
18 |
19 | import { fqn } from '../controller/fqn'
20 | import { Invokeable, isInvokeable, isActivation } from '../models/resource'
21 |
22 | const strings = i18n('plugin-openwhisk')
23 |
24 | /**
25 | * Invoke an invokeable resource
26 | *
27 | */
28 | export default {
29 | when: isInvokeable,
30 | mode: {
31 | mode: 'invoke',
32 | label: strings('Invoke'),
33 | kind: 'drilldown' as const,
34 |
35 | command: (_, resource: Invokeable) => {
36 | if (isActivation(resource)) {
37 | const path = `/${resource.annotations.find(_ => _.key === 'path').value}`
38 | return `wsk action invoke ${encodeComponent(path)}`
39 | } else {
40 | return `wsk ${resource.kind.toLowerCase()} invoke ${encodeComponent(fqn(resource))}`
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/initRequirePath.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { dirname, join } from 'path'
18 | import { inBrowser } from '@kui-shell/core'
19 |
20 | declare let __non_webpack_require__ // eslint-disable-line @typescript-eslint/camelcase
21 | declare let __webpack_require__ // eslint-disable-line @typescript-eslint/camelcase
22 |
23 | // help compositions find our openwhisk-composer module
24 | export default async () => {
25 | if (!inBrowser()) {
26 | const appModulePath = await import('app-module-path')
27 |
28 | // eslint-disable-next-line @typescript-eslint/camelcase
29 | const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
30 |
31 | // add the directory that encloses `openwhisk-composer`
32 | // this is needed e.g. for `compose foo`
33 | const root = dirname(requireFunc.resolve('openwhisk-composer/package.json'))
34 | appModulePath.addPath(join(root, '..'))
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/test/openwhisk1/all-numeric-uuids.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Common, CLI, ReplExpect } from '@kui-shell/test'
18 |
19 | import * as openwhisk from '@kui-shell/plugin-openwhisk/tests/lib/openwhisk/openwhisk'
20 |
21 | // see https://github.com/ibm-functions/shell/issues/284
22 | describe('Confirm proper handling of all-numeric uuids', function(this: Common.ISuite) {
23 | before(openwhisk.before(this))
24 | after(Common.after(this))
25 |
26 | it('should present 404-type error with activation get on all-numeric uuid', () =>
27 | CLI.command(`activation get 00000000000000000000000000000000`, this.app)
28 | .then(ReplExpect.error(404))
29 | .catch(Common.oops(this)))
30 |
31 | it('should present 404-type error with activation get on a different all-numeric uuid', () =>
32 | CLI.command(`activation get 00000000000000000000000000000001`, this.app)
33 | .then(ReplExpect.error(404))
34 | .catch(Common.oops(this)))
35 | })
36 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/client/options.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { type as osType } from 'os'
18 | import { Agent as HttpAgent } from 'http'
19 | import { Agent as HttpsAgent } from 'https'
20 |
21 | import { inBrowser } from '@kui-shell/core'
22 |
23 | import { userAgent } from '@kui-shell/client/config.d/client.json'
24 |
25 | import agent from './agent'
26 |
27 | const isLinux = osType() === 'Linux'
28 |
29 | interface ClientOptions {
30 | timeout?: number
31 | agent?: HttpAgent | HttpsAgent
32 | 'User-Agent'?: string
33 | noUserAgent?: boolean
34 | }
35 |
36 | const options: ClientOptions = {}
37 |
38 | if (isLinux) {
39 | // options.forever = true
40 | options.timeout = 5000
41 | options.agent = agent()
42 | }
43 |
44 | if (userAgent && !process.env.TEST_SPACE && !process.env.TRAVIS) {
45 | // install a User-Agent header, except when running tests
46 | options['User-Agent'] = userAgent
47 | }
48 |
49 | if (inBrowser()) {
50 | options.noUserAgent = true
51 | }
52 |
53 | export default options
54 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/action/let/let-core.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Action } from '../../../models/resource'
18 |
19 | export const ANON_KEY = 'anonymous-function'
20 | export const ANON_KEY_FQN = 'anonymous-function-fqn'
21 | export const ANON_CODE = 'anonymous-code'
22 |
23 | /**
24 | * Is the given action entity an anonymous let
25 | *
26 | */
27 | export const isAnonymousLet = (action: Action) => {
28 | if (action.annotations && action.annotations.find(kv => kv.key === ANON_KEY)) {
29 | const code = action.annotations.find(kv => kv.key === ANON_CODE)
30 | return code && code.value
31 | }
32 | }
33 |
34 | export const isAnonymousLetFor = (action: Action, parent: string) => {
35 | const annotation = action.annotations && action.annotations.find(kv => kv.key === ANON_KEY)
36 | const annotationFQN = action.annotations && action.annotations.find(kv => kv.key === ANON_KEY_FQN)
37 | return (annotation && annotation.value === parent) || (annotationFQN && annotationFQN.value === parent)
38 | }
39 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/models/activation-data.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { EventEmitter } from 'events'
18 | import { ResourceWithMetadata } from '@kui-shell/core'
19 |
20 | import apiVersion from '../lib/apiVersion'
21 | import Activation from '../lib/activation'
22 | import { Options } from '../lib/options'
23 | import { StatData } from '../lib/grouping'
24 |
25 | // intentional double s, because the core removes one
26 | export const kind = 'Activationss'
27 |
28 | export interface State {
29 | stats: StatData
30 | parsedOptions: O
31 | eventBus: EventEmitter
32 | activations: Activation[]
33 | }
34 |
35 | export type ActivationData = ResourceWithMetadata> & {
36 | apiVersion
37 | kind
38 | }
39 |
40 | export function isActivationData(resource: ResourceWithMetadata): resource is ActivationData {
41 | const data = resource as ActivationData
42 | return data.apiVersion === apiVersion && data.kind === kind
43 | }
44 |
45 | export default ActivationData
46 |
--------------------------------------------------------------------------------
/plugins/plugin-grid/src/lib/activation.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | export type WaitTimeAnnotation = { key: 'waitTime'; value: number }
18 | export type InitTimeAnnotation = { key: 'initTime'; value: number }
19 | export type LimitAnnotation = { key: 'limit'; value: { memory: number } }
20 | type Annotation = WaitTimeAnnotation | InitTimeAnnotation | LimitAnnotation | { key: string; value: string }
21 |
22 | export interface Activation {
23 | name: string
24 | start: number
25 | end?: number
26 | activationId: string
27 | statusCode: number
28 | version: string
29 |
30 | _duration?: number
31 | executionTime: number
32 |
33 | annotations: Annotation[]
34 |
35 | metadata?: {
36 | name: string
37 | namespace: string
38 | }
39 |
40 | response: {
41 | success: boolean
42 | statusCode: number
43 | result: {
44 | message?: string
45 | error: string | { error?: string; message?: string; code?: number; statusCode?: number }
46 | statusCode?: number
47 | code?: number
48 | }
49 | }
50 | }
51 |
52 | export default Activation
53 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/lib/controller/cmd/app-invoke.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-19 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Registrar } from '@kui-shell/core'
18 | import { Activation } from '@kui-shell/plugin-openwhisk'
19 |
20 | import { invoke, async } from '../../utility/usage'
21 | import * as view from '../../view/entity-view'
22 |
23 | export default async (commandTree: Registrar) => {
24 | /* command handler for app invoke */
25 | commandTree.listen(
26 | `/wsk/app/invoke`,
27 | args => {
28 | const { command, parsedOptions: options, REPL } = args
29 | return REPL.qexec(command.replace('app', 'action')).then(result =>
30 | view.formatCompositionResult(args, result, options)
31 | )
32 | },
33 | { usage: invoke }
34 | )
35 |
36 | /* command handler for app async */
37 | commandTree.listen(
38 | `/wsk/app/async`,
39 | ({ command, REPL }) => {
40 | return REPL.qexec(command.replace('app', 'action')) // asynchronous composition invocation is the same with asynchronous action invocation
41 | },
42 | { usage: async }
43 | )
44 | }
45 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/tests/data/composer/composer-source/travis2slack.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | 'use strict'
18 |
19 | const composer = require('openwhisk-composer')
20 |
21 | const prefix = 'travis2slack'
22 |
23 | const slackConfig = {
24 | token:
25 | process.env['PATH'] /* for tests... just some env var that will be defined, it doesn't need to have any meaning */,
26 | username: 'whiskbot',
27 | url: 'https://slack.com/api/chat.postMessage'
28 | }
29 |
30 | if (slackConfig.token === undefined) {
31 | console.error('SLACK_TOKEN required in environment.')
32 | process.exit(-1)
33 | }
34 |
35 | module.exports = composer.sequence(
36 | `/whisk.system/utils/echo`,
37 | `${prefix}/extract`,
38 | `${prefix}/fetch.job.id`,
39 | composer.retain(composer.sequence(composer.retry(3, `${prefix}/fetch.log.url`), `${prefix}/analyze.log`)),
40 | ({ result, params }) => Object.assign(result, params),
41 | `${prefix}/format.for.slack`,
42 | composer.retain(composer.literal(slackConfig)),
43 | ({ result, params }) => Object.assign(result, params),
44 | `/whisk.system/slack/post`
45 | )
46 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/test/openwhisk1/list/entities.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * read-only tests against the CLI's list APIs
19 | *
20 | */
21 |
22 | import { Common, CLI, ReplExpect } from '@kui-shell/test'
23 |
24 | import * as openwhisk from '@kui-shell/plugin-openwhisk/tests/lib/openwhisk/openwhisk'
25 |
26 | describe('List entities with a clean slate', function(this: Common.ISuite) {
27 | before(openwhisk.before(this))
28 | after(Common.after(this))
29 |
30 | // implicit entity type
31 | it(`should list actions with "list"`, () => CLI.command(`wsk action list`, this.app).then(ReplExpect.justOK))
32 |
33 | // explicit entity type
34 | openwhisk.entities.forEach(entity => {
35 | it(`should list ${entity} with "list"`, () => CLI.command(`wsk ${entity} list`, this.app).then(ReplExpect.justOK))
36 | })
37 |
38 | // activations
39 | it(`should list actions with "$ list"`, () => CLI.command(`wsk $ list`, this.app).then(ReplExpect.okWithAny))
40 | it(`should list actions with "activation list"`, () =>
41 | CLI.command(`wsk activation list`, this.app).then(ReplExpect.okWithAny))
42 | })
43 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/models/synonyms.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Synonyms for OpenWhisk entities and verbs
19 | *
20 | */
21 | export const synonymsTable = {
22 | entities: {
23 | actions: ['action'],
24 | packages: ['package'],
25 | rules: ['rule'],
26 | triggers: ['trigger'],
27 | namespaces: ['namespace', 'ns'],
28 | activations: ['$', 'activation']
29 | },
30 | verbs: {
31 | invoke: ['call', 'exec'],
32 | fire: [],
33 | get: [],
34 | list: [],
35 | delete: [],
36 | create: [
37 | // these are synonyms from the openwhisk npm standpoint, but not from the openwhisk command experience standpoint
38 | { nickname: 'update', name: 'update', notSynonym: true },
39 | {
40 | nickname: 'bind',
41 | name: 'bind',
42 | notSynonym: true,
43 | limitTo: { packages: true }
44 | }
45 | ],
46 | update: ['up']
47 | }
48 | }
49 |
50 | export const synonyms = (type: string, T?: string): string[] => {
51 | // either T === entities or T === verbs
52 | return synonymsTable[T || 'entities'][type].concat([type])
53 | }
54 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/test/openwhisk1/help.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * read-only tests against the CLI's help APIs
19 | *
20 | */
21 |
22 | /* import { Common } from '@kui-shell/test'
23 | import * as openwhisk from '@kui-shell/plugin-openwhisk/tests/lib/openwhisk/openwhisk'
24 |
25 | import { doHelp, header, header2 } from '@kui-shell/plugin-core-support/tests/lib/core-support/help-util'
26 |
27 | // the header for action help
28 | const actionHelpHeader = header2('OpenWhisk', 'Action Operations')
29 |
30 | describe('Help command', function(this: Common.ISuite) {
31 | before(openwhisk.before(this))
32 | after(Common.after(this))
33 |
34 | //
35 | // and now here come the tests...
36 | //
37 | doHelp.call(this, 'wsk', { expect: header('OpenWhisk') })
38 | doHelp.call(this, 'wsk action', { expect: actionHelpHeader })
39 | doHelp.call(this, 'wsk action help', { expect: actionHelpHeader })
40 | doHelp.call(this, 'help wsk action', { expect: actionHelpHeader })
41 | doHelp.call(this, 'composer', { expect: header('Composer') })
42 | doHelp.call(this, 'wsk action create', { code: 497 }) // insufficient arguments
43 | }) */
44 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/activation/result.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Registrar } from '@kui-shell/core'
18 |
19 | import respondWith from './as-activation'
20 | import { withStandardOptions } from '../usage'
21 | import { synonyms } from '../../models/synonyms'
22 | import { clientOptions, getClient } from '../../client/get'
23 |
24 | const usage = {
25 | command: 'result',
26 | docs: 'get the result, i.e. return value, of an activation',
27 | partial: ''
28 | }
29 |
30 | export default (registrar: Registrar) => {
31 | synonyms('activations').forEach(syn => {
32 | registrar.listen(
33 | `/wsk/${syn}/result`,
34 | async ({ argvNoOptions, execOptions }) => {
35 | const name = argvNoOptions[argvNoOptions.indexOf('result') + 1]
36 |
37 | return respondWith(
38 | await getClient(execOptions).activations.get(
39 | Object.assign(
40 | {
41 | name
42 | },
43 | clientOptions
44 | )
45 | ),
46 | 'result'
47 | )
48 | },
49 | withStandardOptions(usage)
50 | )
51 | })
52 | }
53 |
--------------------------------------------------------------------------------
/plugins/plugin-apache-composer/src/lib/utility/sample-inputs.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * The sample compositions we want to offer users
19 | *
20 | */
21 | export const sampleInputs = (cmd, partial = false) => {
22 | // generator of the command string; if the caller passed in a function, use it
23 | const gen = typeof cmd === 'function' ? cmd : () => cmd
24 |
25 | return [
26 | {
27 | name: 'hello.js',
28 | docs: 'hello world',
29 | command: `${gen('hello-demo')} @demos/hello.js`,
30 | partial
31 | },
32 | {
33 | name: 'if.js',
34 | docs: 'conditional execution',
35 | command: `${gen('if-demo')} @demos/if.js`,
36 | partial
37 | },
38 | {
39 | name: 'let.js',
40 | docs: 'introduce a value',
41 | command: `${gen('let-demo')} @demos/let.js`,
42 | partial
43 | },
44 | {
45 | name: 'retain.js',
46 | docs: 'forward values around untrusted code',
47 | command: `${gen('retain-demo')} @demos/retain.js`,
48 | partial
49 | },
50 | {
51 | name: 'try.js',
52 | docs: 'try/catch',
53 | command: `${gen('try-demo')} @demos/try.js`,
54 | partial
55 | }
56 | ]
57 | }
58 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/action/list.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Arguments, Registrar } from '@kui-shell/core'
18 |
19 | import { standardListUsage } from '../usage'
20 | import { asActionTable } from './as-action'
21 | import { getClient } from '../../client/get'
22 | import { synonyms } from '../../models/synonyms'
23 | import { copy, nameForList, ListOptions } from '../options'
24 |
25 | export default (registrar: Registrar) => {
26 | synonyms('actions').forEach(syn => {
27 | registrar.listen(`/wsk/${syn}/count`, ({ REPL }) => REPL.qexec(`wsk action list --count`))
28 |
29 | registrar.listen(
30 | `/wsk/${syn}/list`,
31 | async ({ tab, argvNoOptions, parsedOptions, execOptions }: Arguments) => {
32 | const name = argvNoOptions[argvNoOptions.indexOf('list') + 1]
33 | const args = copy(parsedOptions, nameForList(name))
34 |
35 | const raw = await getClient(execOptions).actions.list(args)
36 | if (parsedOptions.count) {
37 | return ((raw as any) as { actions: number }).actions
38 | } else {
39 | return asActionTable(tab, raw)
40 | }
41 | },
42 | standardListUsage(syn)
43 | )
44 | })
45 | }
46 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/test/openwhisk2/jar.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Common, CLI, ReplExpect, SidecarExpect, Util } from '@kui-shell/test'
18 |
19 | import * as openwhisk from '@kui-shell/plugin-openwhisk/tests/lib/openwhisk/openwhisk'
20 |
21 | import { dirname } from 'path'
22 |
23 | const ROOT = dirname(require.resolve('@kui-shell/plugin-openwhisk/tests/package.json'))
24 |
25 | const actionName1 = 'foo1'
26 |
27 | describe('Create jar actions', function(this: Common.ISuite) {
28 | before(openwhisk.before(this))
29 | after(Common.after(this))
30 |
31 | it('should create a jar action', () =>
32 | CLI.command(`wsk action create ${actionName1} ${ROOT}/data/openwhisk/jar/echo.jar --main echo`, this.app)
33 | .then(ReplExpect.ok)
34 | .then(SidecarExpect.open)
35 | .then(SidecarExpect.showing(actionName1))
36 | .catch(Common.oops(this)))
37 |
38 | it('should invoke the jar action', () =>
39 | CLI.command(`wsk action invoke -p x 3`, this.app)
40 | .then(ReplExpect.ok)
41 | .then(SidecarExpect.open)
42 | .then(SidecarExpect.showing(actionName1))
43 | .then(Util.getValueFromMonaco)
44 | .then(Util.expectYAML({ x: 3 }))
45 | .catch(Common.oops(this)))
46 | })
47 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/namespace/as-namespace.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Namespace as RawNamespace } from 'openwhisk'
18 | import { encodeComponent, MultiModalResponse } from '@kui-shell/core'
19 |
20 | import { asMetadata } from '../fqn'
21 | import { apiVersion, Namespace } from '../../models/resource'
22 |
23 | export function asNamespace(name: string, raw: RawNamespace): Namespace {
24 | const metadata = asMetadata(name, '_')
25 |
26 | return {
27 | apiVersion,
28 | kind: 'Namespace',
29 | metadata,
30 | onclick: {
31 | namespace: `wsk list ${encodeComponent('/' + metadata.namespace)}`
32 | },
33 | actions: raw.actions,
34 | packages: raw.packages,
35 | rules: raw.rules,
36 | triggers: raw.triggers,
37 | data: JSON.stringify(raw, undefined, 2)
38 | }
39 | }
40 |
41 | /**
42 | * Default respondWith function. This creates a response that will
43 | * present as a multi-modal view.
44 | *
45 | */
46 | export default function aNamespaceResponse(
47 | name: string,
48 | raw: RawNamespace,
49 | defaultMode?: string
50 | ): MultiModalResponse {
51 | return Object.assign(asNamespace(name, raw), {
52 | modes: [],
53 | defaultMode
54 | })
55 | }
56 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/package/list.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Arguments, Registrar } from '@kui-shell/core'
18 |
19 | import { standardListUsage } from '../usage'
20 | import { asPackageTable } from './as-package'
21 | import { getClient } from '../../client/get'
22 | import { synonyms } from '../../models/synonyms'
23 | import { copy, nameForList, ListOptions } from '../options'
24 |
25 | export default (registrar: Registrar) => {
26 | synonyms('packages').forEach(syn => {
27 | registrar.listen(`/wsk/${syn}/count`, ({ REPL }) => REPL.qexec(`wsk package list --count`))
28 |
29 | registrar.listen(
30 | `/wsk/${syn}/list`,
31 | async ({ tab, argvNoOptions, parsedOptions, execOptions }: Arguments) => {
32 | const name = argvNoOptions[argvNoOptions.indexOf('list') + 1]
33 | const args = copy(parsedOptions, nameForList(name))
34 |
35 | const raw = await getClient(execOptions).packages.list(args)
36 | if (parsedOptions.count) {
37 | return ((raw as any) as { packages: number }).packages
38 | } else {
39 | return asPackageTable(tab, raw)
40 | }
41 | },
42 | standardListUsage(syn)
43 | )
44 | })
45 | }
46 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/trigger/list.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { Arguments, Registrar } from '@kui-shell/core'
18 |
19 | import { standardListUsage } from '../usage'
20 | import { getClient } from '../../client/get'
21 | import { asTriggerTable } from './as-trigger'
22 | import { synonyms } from '../../models/synonyms'
23 | import { copy, nameForList, ListOptions } from '../options'
24 |
25 | export default (registrar: Registrar) => {
26 | synonyms('triggers').forEach(syn => {
27 | registrar.listen(`/wsk/${syn}/count`, ({ REPL }) => REPL.qexec(`wsk trigger list --count`))
28 |
29 | registrar.listen(
30 | `/wsk/${syn}/list`,
31 | async ({ tab, argvNoOptions, parsedOptions, execOptions }: Arguments) => {
32 | const name = argvNoOptions[argvNoOptions.indexOf('list') + 1]
33 | const args = copy(parsedOptions, nameForList(name))
34 |
35 | const raw = await getClient(execOptions).triggers.list(args)
36 | if (parsedOptions.count) {
37 | return ((raw as any) as { triggers: number }).triggers
38 | } else {
39 | return asTriggerTable(tab, raw)
40 | }
41 | },
42 | standardListUsage(syn)
43 | )
44 | })
45 | }
46 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/controller/trigger/as-trigger.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { TriggerDesc, Trigger as RawTrigger } from 'openwhisk'
18 | import { Tab, Table, MultiModalResponse } from '@kui-shell/core'
19 |
20 | import asTable from '../as-table'
21 | import { apiVersion, Trigger } from '../../models/resource'
22 |
23 | export function asTrigger(raw: RawTrigger): Trigger {
24 | const { version, name, namespace } = raw
25 |
26 | return {
27 | apiVersion,
28 | kind: 'Trigger',
29 | metadata: {
30 | name,
31 | namespace
32 | },
33 |
34 | limits: raw.limits,
35 | parameters: raw.parameters,
36 | annotations: raw.annotations,
37 | version,
38 | data: JSON.stringify(raw, undefined, 2)
39 | }
40 | }
41 |
42 | export function asTriggerTable(tab: Tab, raw: TriggerDesc[]): Promise {
43 | return asTable(tab, raw.map(asTrigger))
44 | }
45 |
46 | /**
47 | * Default respondWith function. This creates a response that will
48 | * present as a multi-modal view.
49 | *
50 | */
51 | export default function asTriggerResponse(raw: RawTrigger, defaultMode?: string): MultiModalResponse {
52 | return Object.assign(asTrigger(raw), {
53 | modes: [],
54 | defaultMode
55 | })
56 | }
57 |
--------------------------------------------------------------------------------
/plugins/plugin-openwhisk/src/modes/zip-code.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 IBM Corporation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { i18n } from '@kui-shell/core'
18 | import { ActionWithCode, hasZipCode } from '../models/resource'
19 |
20 | const strings = i18n('plugin-openwhisk')
21 |
22 | function extractMain(b64: string): string {
23 | const code = Buffer.from(b64, 'base64')
24 |
25 | // eslint-disable-next-line @typescript-eslint/no-var-requires
26 | const Zip = require('adm-zip')
27 | const zip = Zip(code)
28 | const indexEntryJavascript = zip.getEntry('index.js')
29 | const indexEntry =
30 | indexEntryJavascript || zip.getEntry('index.py') || zip.getEntry('__main__.py') || zip.getEntry('index.php')
31 |
32 | if (indexEntry) {
33 | const indexContent = zip.readAsText(indexEntry)
34 | return indexContent.toString()
35 | } else {
36 | return 'Unable to locate the index.js file in the zip file'
37 | }
38 | }
39 |
40 | /**
41 | * The Code mode applies to all Action resources.
42 | *
43 | */
44 | export default {
45 | when: hasZipCode,
46 | mode: {
47 | mode: 'zip main',
48 | label: strings('Zip Main'),
49 |
50 | content: (_, resource: ActionWithCode) => ({
51 | content: extractMain(resource.exec.code),
52 | contentType: resource.exec.kind
53 | })
54 | }
55 | }
56 |
--------------------------------------------------------------------------------