Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
{
"env": {
"node": true,
"es6": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": 2018
},
"plugins": [
"jest"
],
"extends": [
"plugin:jest/recommended",
"standard"
],
"rules": {
"no-var": 2,
"node/no-extraneous-require": ["error", {
"allowModules": [],
"resolvePaths": [],
"tryExtensions": [".js"]
}],
"node/no-missing-require": ["error", {
"allowModules": [],
"resolvePaths": [],
"tryExtensions": [".js"]
}]
},
"extends": "@adobe/eslint-config-aio-lib-config",
"globals": {
"fixtureFile": true,
"fixtureFileWithTimeZoneAdjustment": true,
Expand Down
20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,37 @@
"dayjs": "^1.10.4",
"debug": "^4.1.1",
"inquirer": "^8.2.0",
"js-yaml": "^3.13.1",
"js-yaml": "^4",
"lodash.clonedeep": "^4.5.0",
"openwhisk": "^3.21.2",
"openwhisk-fqn": "^0.0.2",
"properties-reader": "2.2.0",
"sha1": "^1.1.1"
},
"devDependencies": {
"@adobe/eslint-config-aio-lib-config": "^2.0.0",
"@babel/core": "^7.16.12",
"@babel/preset-env": "^7.16.11",
"babel-jest": "^29.5.0",
"babel-runtime": "^6.26.0",
"dedent-js": "^1.0.1",
"eol": "^0.9.1",
"eslint": "^7.12.1",
"eslint": "^8.38.0",
"eslint-config-oclif": "^4.0.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^26.1.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^5.0.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-jsdoc": "^37.9.7",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"execa": "^4.0.0",
"jest": "^27.5.0",
"jest-junit": "^13.0.0",
"jest-plugin-fs": "^2.9.0",
"oclif": "^3.2.0",
"stdout-stderr": "^0.1.9"
"stdout-stderr": "^0.1.9",
"typescript": "^5.0.4"
},
"engines": {
"node": "^14.18 || ^16.13 || >=18"
Expand Down
1 change: 1 addition & 0 deletions src/commands/runtime/api/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ governing permissions and limitations under the License.
const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const { Flags, CliUx: cli } = require('@oclif/core')

/** @private */
function processApi (api) {
const data = []
const paths = api.value.apidoc.paths
Expand Down
19 changes: 12 additions & 7 deletions src/commands/runtime/deploy/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ class DeployExport extends RuntimeBaseCommand {
const fileDirectory = path.dirname(manifest)
const projectJSON = await createProjectJSON(projectEntities, flags.projectname, ow, fileDirectory)
const yamlObject = { project: projectJSON }
fs.writeFileSync(manifest, yaml.safeDump(yamlObject, {}))
fs.writeFileSync(manifest, yaml.dump(yamlObject, {}))
} catch (err) {
await this.handleError('Failed to export', err)
}
}
}

/** @private */
async function findProjectEntities (ow, projectName) {
const packages = []
const actions = []
Expand Down Expand Up @@ -80,21 +81,23 @@ async function findProjectEntities (ow, projectName) {
}

const entities = {
packages: packages,
actions: actions,
triggers: triggers,
rules: rules
packages,
actions,
triggers,
rules
}
return entities
}

/** @private */
async function createProjectJSON (entities, projectname, ow, fileDirectory) {
const project = { name: projectname, packages: {} }
for (const pkg of entities.packages) {
const annotations = returninputsfromKeyValue(pkg.annotations)
project.packages[pkg.name] = {
version: pkg.version,
namespace: pkg.namespace,
annotations: annotations,
annotations,
actions: {},
triggers: {},
sequences: {},
Expand Down Expand Up @@ -130,7 +133,7 @@ async function createProjectJSON (entities, projectname, ow, fileDirectory) {
function: functionValue,
runtime: getAction.exec.kind,
main: getAction.exec.main || '',
limits: limits
limits
}
const obj = { name: functionValue, code: getAction.exec.code }
filesObject.push(obj)
Expand Down Expand Up @@ -172,6 +175,7 @@ async function createProjectJSON (entities, projectname, ow, fileDirectory) {
return project
}

/** @private */
function writeFiles (fileObj, fileDirectory) {
for (const file of fileObj) {
const packageName = path.dirname(file.name)
Expand All @@ -189,6 +193,7 @@ function writeFiles (fileObj, fileDirectory) {
}
}

/** @private */
function returninputsfromKeyValue (inputs) {
const inputObj = {}
for (const input of inputs) {
Expand Down
2 changes: 2 additions & 0 deletions src/commands/runtime/namespace/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ governing permissions and limitations under the License.
const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const { Flags, CliUx: cli } = require('@oclif/core')

/** @private */
function createColumns (columnName) {
return {
firstColumn: {
Expand Down Expand Up @@ -48,6 +49,7 @@ function createColumns (columnName) {
}
}

/** @private */
async function getRulesWithStatus (ow, rules) {
// unfortunately for rules, we need to do a 'get' for each to get the status
// (this is done the same way in the Go CLI)
Expand Down
1 change: 1 addition & 0 deletions src/commands/runtime/package/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class PackageDelete extends RuntimeBaseCommand {
}
}

/** @private */
async function recursivelyDeletePackage (ow, pkg) {
const mapRulesToActionName = (rules) => {
let ruleMap = new Map()
Expand Down
1 change: 1 addition & 0 deletions src/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const PropertyDefault = {
CONFIG_FILE: path.join(require('os').homedir(), '.wskprops')
}

/** @private */
function propertiesFile () {
let properties = { get: () => null }
const wskConfigFile = process.env[PropertyEnv.CONFIG_FILE] || config.get('runtime.config_file') || PropertyDefault.CONFIG_FILE
Expand Down
1 change: 1 addition & 0 deletions test/__fixtures__/action/actionFile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @private */
function main (params) {
return { payload: 'Hello ' + params.name }
}
Expand Down
4 changes: 2 additions & 2 deletions test/__fixtures__/deploy/export_yaml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ project:
version: 0.0.9
namespace: 53444_51981/testSeq
annotations:
exec: 'nodejs:10'
exec: nodejs:10
inputs:
key1: val1
key2: val1
function: testSeq/helloAction1.js
runtime: 'nodejs:10'
runtime: nodejs:10
main: split
limits:
timeout: 60000
Expand Down
2 changes: 1 addition & 1 deletion test/__fixtures__/deploy/export_yaml_Sequence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project:
annotations: {}
sequences:
four:
actions: 'zero,one,two'
actions: zero,one,two
rules:
meetPersonRule:
action: three
Expand Down
4 changes: 2 additions & 2 deletions test/__fixtures__/deploy/export_yaml_feed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ project:
version: 0.0.9
namespace: 53444_51981/testSeq
annotations:
exec: 'nodejs:10'
exec: nodejs:10
inputs:
key1: val1
key2: val1
function: testSeq/helloAction1.js
runtime: 'nodejs:10'
runtime: nodejs:10
main: split
limits:
timeout: 60000
Expand Down
1 change: 1 addition & 0 deletions test/__fixtures__/deploy/hello.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

/** @private */
function main (params) {
const msg = 'Hello ' + params.name + ', ' + params.message + '.'
return { msg }
Expand Down
1 change: 1 addition & 0 deletions test/__fixtures__/deploy/hello_plus.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

/** @private */
function main (params) {
const msg = 'Hello, ' + params.name + ' , ' + params.place + '.'
const employees = 'You have ' + params.employees + ' employees '
Expand Down
6 changes: 4 additions & 2 deletions test/__fixtures__/deploy/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/* eslint-disable no-unused-vars */

/** @private */
function split (params) {
const text = params.text || ''
const words = text.split(' ')
return { words: words }
return { words }
}

/** @private */
function split1 (params) {
const text = params.text || 'Hello World'
const words = text.split(' ')
return { words: words }
return { words }
}
2 changes: 2 additions & 0 deletions test/commands/runtime/namespace/log-forwarding/set.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ test.each(dataFixtures)('failed to set log forwarding settings to %s (interactiv
await expect(command.run()).rejects.toThrow(`Failed to update log forwarding configuration: mocked error for ${destination}`)
})

/** @private */
function mockSelectedDestination (dstName, fnCallback) {
prompt.mockResolvedValueOnce({ type: dstName })
rtLib.logForwarding.setDestination = fnCallback
}

/** @private */
function mockDestinationConfig (config) {
prompt.mockResolvedValueOnce(config)
}
1 change: 1 addition & 0 deletions test/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ expect.extend({
})

// clean trailing whitespace which will vary with different terminal settings
/** @private */
function cleanWhite (input) {
return eol.split(input).map(line => { return line.trim() }).join(eol.auto)
}
Expand Down