Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@finos/generator-symphony

Package Overview
Dependencies
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finos/generator-symphony - npm Package Compare versions

Comparing version 2.8.0 to 2.9.0

generators/_lib/util.js

39

generators/app/index.js

@@ -25,3 +25,3 @@ const Generator = require('yeoman-generator')

if (folderFiles.length > 0) {
this.log(`(!) Folder ${this.destinationRoot()} is not empty. Are you sure you want to continue?`.red)
console.log(`(!) Folder ${this.destinationRoot()} is not empty. Are you sure you want to continue?`.red)
}

@@ -42,8 +42,2 @@ } catch(e) {

{
type: 'input',
name: 'username',
message: 'Enter your bot username',
default: 'my-bot'
},
{
type: 'list',

@@ -58,8 +52,12 @@ name: 'application',

{
name: 'Extension App (BDK)',
name: 'Workflow (WDK)',
value: 'workflow'
},
{
name: 'Extension App (ADK)',
value: 'ext-app'
},
{
name: 'Workflow (WDK)',
value: 'workflow'
name: 'Extension App + Circle of Trust (ADK + BDK)',
value: 'ext-app-bdk'
},

@@ -69,2 +67,9 @@ ]

{
type: 'input',
name: 'username',
message: 'Enter your bot username',
default: 'my-bot',
when: answer => answer.application.indexOf('ext-app') === -1
},
{
type: 'list',

@@ -83,3 +88,3 @@ name: 'language',

],
when: answer => answer.application !== 'workflow'
when: answer => answer.application === 'bot-app'
},

@@ -107,14 +112,18 @@ {

default: 'app-id',
when: answer => answer.application === 'ext-app'
when: answer => answer.application === 'ext-app' || (answer.application === 'ext-app-bdk' && answer.host !== 'develop2.symphony.com')
}
])
if (this.answers.application === 'workflow') {
this.composeWith(require.resolve('../workflow'), this.answers)
} else if (this.answers.language === 'java') {
if (this.answers.language === 'java') {
this.composeWith(require.resolve('../java'), this.answers)
} else if (this.answers.language === 'python') {
this.composeWith(require.resolve('../python'), this.answers)
} else if (this.answers.application === 'workflow') {
this.composeWith(require.resolve('../workflow'), this.answers)
} else if (this.answers.application === 'ext-app') {
this.composeWith(require.resolve('../ext-app'), this.answers)
} else if (this.answers.application === 'ext-app-bdk') {
this.composeWith(require.resolve('../ext-app-bdk'), this.answers)
}
}
}
const Generator = require('yeoman-generator')
const path = require('path')
const fs = require('fs')
const axios = require('axios')
const keyPair = require('../_lib/rsa').keyPair
const COMMON_EXT_APP_TEMPLATES = '../../_common/circle-of-trust-ext-app'
const { keyPair, getJavaBdkVersion, getSpringVersion } = require('../_lib/util')
const BASE_JAVA = 'src/main/java'
const BASE_RESOURCES = 'src/main/resources'
const BDK_VERSION_DEFAULT = '2.14.1'
const SPRING_VERSION_DEFAULT = '2.7.12'
// Make it configurable for faster test execution
const KEY_PAIR_LENGTH = 'KEY_PAIR_LENGTH'
const _getVersion = () => {
const uri = 'https://search.maven.org/solrsearch/select?q=g:org.finos.symphony.bdk+AND+a:symphony-bdk-bom&core=gav'
return axios(uri, { timeout: 5000 }).then(res => res.data)
}
module.exports = class extends Generator {

@@ -58,17 +44,7 @@ async prompting() {

...this.answers,
bdkBomVersion: BDK_VERSION_DEFAULT,
springBootVersion: SPRING_VERSION_DEFAULT,
bdkVersion: await getJavaBdkVersion(),
springBootVersion: getSpringVersion(),
}
await _getVersion().then(response => {
if (response['response']['docs'].length === 0) {
console.log(`Failed to fetch latest Java BDK version from Maven Central, ${this.answers.bdkBomVersion} will be used.`)
} else {
this.answers.bdkBomVersion = response['response']['docs'].filter(d => !d.id.match(/(RC|alpha)/g))[0].v
}
}).catch(err => {
console.log(`Failed to fetch latest Java BDK version from Maven Central, ${this.answers.bdkBomVersion} will be used.`)
console.log(`The request failed because of: {errno: ${err.errno}, code: ${err.code}}`)
})
this.log(`BDK Version: ${this.answers.bdkBomVersion}`)
this.log(`Using BDK Version: ${this.answers.bdkVersion}`)

@@ -78,7 +54,7 @@ if (this.answers.host !== 'develop2.symphony.com') {

this.log('Generating RSA keys...'.green)
this.pair = keyPair(this.config.get(KEY_PAIR_LENGTH) || 4096)
this.pair = keyPair(this.config.get('KEY_PAIR_LENGTH'))
this.fs.write(this.destinationPath('rsa/publickey.pem'), this.pair.public, err => this.log.error(err))
this.fs.write(this.destinationPath('rsa/privatekey.pem'), this.pair.private, err => this.log.error(err))
} catch (e) {
this.log.error(`Oups, something went wrong when generating RSA key pair`, e)
this.log.error(`Oops, something went wrong when generating RSA key pair`, e)
}

@@ -113,16 +89,2 @@ }

} else if (this.answers.application === 'ext-app') { // Extension app application
// Process application.yaml.ejs file
this._copyTpl('ext-app/application.yaml', path.join(BASE_RESOURCES, 'application.yaml'));
// Process scripts files
[ 'app.js', 'controller.js' ].forEach(f => this._copyTpl(
path.join(COMMON_EXT_APP_TEMPLATES, 'scripts', f),
path.join(BASE_RESOURCES, 'static', 'scripts', f)
));
this._copy('ext-app/resources/', BASE_RESOURCES)
this._copy(path.join(COMMON_EXT_APP_TEMPLATES, 'static'), BASE_RESOURCES + '/static')
this._copyJavaTemplate('ext-app/java', basePackage)
this._copy('ext-app/README.md', 'README.md')
}

@@ -156,5 +118,5 @@

this.spawnCommandSync(path.join(this.destinationPath(), proc), [ arg ])
} catch(e) {
} catch (e1) {
if (proc === 'gradle' || proc === 'mvn') {
this.log(`${e}`.red)
this.log('Unable to complete build process')
} else {

@@ -174,3 +136,4 @@ this._spawn(proc.indexOf('gradle') > -1 ? 'gradle' : 'mvn', arg)

} else {
this.log('\nYou can now place the private key you received in the '.yellow + 'rsa'.white + ' directory\n'.yellow)
this.log('\nYou can now place the private key you received in the '.yellow + 'rsa'.white + ' directory'.yellow)
this.log('If you do not have credentials, please register at https://developers.symphony.com\n')
}

@@ -177,0 +140,0 @@ this.log(`Your Java project has been successfully generated !`.cyan)

const Generator = require('yeoman-generator')
const keyPair = require('../_lib/rsa').keyPair
const { keyPair, getPythonBdkVersion }= require('../_lib/util')
const path = require('path')
const axios = require("axios")
const KEY_PAIR_LENGTH = 'KEY_PAIR_LENGTH'
const BDK_VERSION_DEFAULT = '2.6.1'
const COMMON_EXT_APP_TEMPLATES = '../../_common/circle-of-trust-ext-app'
const BOT_APP_FOLDER = 'bot-app' // source folder for bot resources
const EXT_APP_FOLDER = 'ext-app' // source folder for ext app resources
const RESOURCES_FOLDER = 'resources' // target resources folder
const PYTHON_FOLDER = 'src' // target folder containing python sources
const _getVersion = () => {
return axios('https://pypi.org/pypi/symphony-bdk-python/json', { timeout: 5000 })
.then(res => res.data)
}
module.exports = class extends Generator {

@@ -25,25 +13,8 @@ async writing() {

this.answers = this.options
this.answers.bdkVersion = BDK_VERSION_DEFAULT
this.answers.bdkVersion = await getPythonBdkVersion()
this.log(`Using BDK Version: ${this.answers.bdkVersion}`)
await _getVersion().then(response => {
if (response === undefined) {
console.log(`Failed to fetch latest Python BDK version from Pypi, ${this.answers.bdkVersion} will be used.`)
} else {
this.answers.bdkVersion = response['info']['version']
}
}).catch(err => {
console.log(`Failed to fetch latest Python BDK version from Pypi, ${this.answers.bdkVersion} will be used.`)
console.log(`The request failed because of: {errno: ${err.errno}, code: ${err.code}}`)
})
this.log(`BDK Version: ${this.answers.bdkVersion}`)
this._generateRsaKeys()
this._generateCommonFiles()
if (this.answers.application === 'bot-app') {
this._generateBotSpecificFiles()
} else if (this.answers.application === 'ext-app') {
this._generateExtAppSpecificFiles()
}
this._generateBotSpecificFiles()
}

@@ -76,3 +47,3 @@

this.log('Generating RSA keys...'.green)
this.pair = keyPair(this.config.get(KEY_PAIR_LENGTH) || 4096)
this.pair = keyPair(this.config.get('KEY_PAIR_LENGTH'))
this.fs.write(this.destinationPath('rsa/publickey.pem'), this.pair.public, err => this.log.error(err))

@@ -102,18 +73,2 @@ this.fs.write(this.destinationPath('rsa/privatekey.pem'), this.pair.private, err => this.log.error(err))

_generateExtAppSpecificFiles() {
[ '__main__.py', 'ext_app_be.py' ]
.forEach(f => this._copy(path.join(EXT_APP_FOLDER, f), path.join(PYTHON_FOLDER, f)));
[ 'srv.crt', 'srv.key' ]
.forEach(f => this._copy(path.join(EXT_APP_FOLDER, f), path.join(RESOURCES_FOLDER, f)));
this._copyTpl(path.join(EXT_APP_FOLDER, 'config.yaml'), path.join(RESOURCES_FOLDER, 'config.yaml'));
[ 'app.js', 'controller.js' ].forEach(f => this._copyTpl(
path.join(COMMON_EXT_APP_TEMPLATES, 'scripts', f),
path.join(RESOURCES_FOLDER, 'static', 'scripts', f)
));
this._copy(path.join(COMMON_EXT_APP_TEMPLATES, 'static'), path.join(RESOURCES_FOLDER, 'static'))
}
_copyTpl(fileName, destFileName) {

@@ -120,0 +75,0 @@ this.fs.copyTpl(

const Generator = require('yeoman-generator')
const fs = require('fs')
const keyPair = require('../_lib/rsa').keyPair
const { keyPair, getWdkVersion }= require('../_lib/util')
const path = require('path')
const axios = require('axios')
const crypto = require('crypto')

@@ -10,7 +9,2 @@ const { Readable } = require('stream')

// Make it configurable for faster test execution
const KEY_PAIR_LENGTH = 'KEY_PAIR_LENGTH'
const WDK_VERSION_DEFAULT = '1.6.3'
module.exports = class extends Generator {

@@ -38,2 +32,3 @@ async prompting() {

])
this.answers = { ...this.options, ...this.answers }
}

@@ -43,12 +38,4 @@

this.log()
this.options.wdkVersion = WDK_VERSION_DEFAULT
const uri = 'https://search.maven.org/solrsearch/select?q=g:org.finos.symphony.wdk+AND+a:workflow-bot-app&core=gav&rows=10'
await axios(uri, { timeout: 5000 })
.then(res => res.data)
.then(response => {
this.options.wdkVersion = response['response']['docs'].filter(d => !d.v.match(/-pre/g))[0].v
}).catch(err => {
this.log(`The request failed because of: {errno: ${err.errno}, code: ${err.code}}`)
})
this.log(`WDK Version: ${this.options.wdkVersion}`)
this.answers.wdkVersion = await getWdkVersion();
this.log(`Using WDK Version: ${this.answers.wdkVersion}`)
}

@@ -59,3 +46,3 @@

this.log('Downloading JAR..')
const url = `https://search.maven.org/remotecontent?filepath=org/finos/symphony/wdk/workflow-bot-app/${this.options.wdkVersion}/workflow-bot-app-${this.options.wdkVersion}-boot.jar`
const url = `https://search.maven.org/remotecontent?filepath=org/finos/symphony/wdk/workflow-bot-app/${this.answers.wdkVersion}/workflow-bot-app-${this.answers.wdkVersion}-boot.jar`
const res = await fetch(url)

@@ -69,6 +56,6 @@ const fileStream = fs.createWriteStream(this.destinationPath('workflow-bot-app.jar'), { flags: 'wx' })

async writing() {
if (this.options.host !== 'develop2.symphony.com') {
if (this.answers.host !== 'develop2.symphony.com') {
try {
this.log('Generating RSA keys...'.green)
this.pair = keyPair(this.config.get(KEY_PAIR_LENGTH) || 4096)
this.pair = keyPair(this.config.get('KEY_PAIR_LENGTH'))
const prefix = (this.answers.type === 'docker-core' ? 'symphony/' : '') + 'rsa'

@@ -81,4 +68,4 @@ this.fs.write(this.destinationPath(`${prefix}/publickey.pem`), this.pair.public, err => this.log.error(err))

}
this.options.privateKeyPath = 'rsa/privatekey.pem'
this.options.randomKey = crypto.randomBytes(16).toString('hex')
this.answers.privateKeyPath = 'rsa/privatekey.pem'
this.answers.randomKey = crypto.randomBytes(16).toString('hex')

@@ -95,3 +82,2 @@ if (this.answers.type === 'project') {

} else if (this.answers.type === 'docker-studio') {
this.options.appId = this.answers.appId
this._copyTpl('startup-studio.sh', 'startup.sh')

@@ -119,6 +105,6 @@ this._copyTpl('application-prod.yaml')

this.log('\nYou can now update the service account '.cyan +
`${this.options.username}`.white + ` with the following public key: `.cyan)
`${this.answers.username}`.white + ` with the following public key: `.cyan)
this.log('\n' + this.pair.public)
this.log(`Please submit these details to your pod administrator.`.yellow)
this.log(`If you are a pod administrator, visit https://${this.options.host}/admin-console\n`.yellow)
this.log(`If you are a pod administrator, visit https://${this.answers.host}/admin-console\n`.yellow)
} else {

@@ -140,5 +126,5 @@ this.log('\nYou can now place the private key you received in the '.yellow + 'rsa'.white + ' directory\n'.yellow)

this.destinationPath(destFileName || fileName),
this.options
this.answers
)
}
}
{
"name": "@finos/generator-symphony",
"version": "2.8.0",
"version": "2.9.0",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc