Merge pull request '2842-npm_maintenance' (#574) from 2842-npm_maintenance into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #574 Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
commit
ef0b72c621
|
@ -1,5 +1,5 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [
|
presets: [
|
||||||
'@babel/preset-env',
|
'@babel/env',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
const request = require('request-promise-native');
|
const got = require('got');
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('send', {
|
Self.remoteMethodCtx('send', {
|
||||||
description: 'Send a RocketChat message',
|
description: 'Send a RocketChat message',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: [{
|
accepts: [{
|
||||||
arg: 'to',
|
arg: 'to',
|
||||||
type: 'String',
|
type: 'string',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'User (@) or channel (#) to send the message'
|
description: 'User (@) or channel (#) to send the message'
|
||||||
}, {
|
}, {
|
||||||
arg: 'message',
|
arg: 'message',
|
||||||
type: 'String',
|
type: 'string',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The message'
|
description: 'The message'
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: {
|
||||||
type: 'Object',
|
type: 'object',
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
|
@ -30,8 +30,15 @@ module.exports = Self => {
|
||||||
const sender = await models.Account.findById(accessToken.userId);
|
const sender = await models.Account.findById(accessToken.userId);
|
||||||
const recipient = to.replace('@', '');
|
const recipient = to.replace('@', '');
|
||||||
|
|
||||||
if (sender.name != recipient)
|
if (sender.name != recipient) {
|
||||||
return sendMessage(sender, to, message);
|
let {body} = await sendMessage(sender, to, message);
|
||||||
|
if (body)
|
||||||
|
body = JSON.parse(body);
|
||||||
|
else
|
||||||
|
body = false;
|
||||||
|
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
@ -65,12 +72,15 @@ module.exports = Self => {
|
||||||
if (!this.auth || this.auth && !this.auth.authToken) {
|
if (!this.auth || this.auth && !this.auth.authToken) {
|
||||||
const config = await getConfig();
|
const config = await getConfig();
|
||||||
const uri = `${config.api}/login`;
|
const uri = `${config.api}/login`;
|
||||||
const res = await send(uri, {
|
let {body} = await send(uri, {
|
||||||
user: config.user,
|
user: config.user,
|
||||||
password: config.password
|
password: config.password
|
||||||
});
|
});
|
||||||
|
|
||||||
this.auth = res.data;
|
if (body) {
|
||||||
|
body = JSON.parse(body);
|
||||||
|
this.auth = body.data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.auth;
|
return this.auth;
|
||||||
|
@ -93,29 +103,29 @@ module.exports = Self => {
|
||||||
/**
|
/**
|
||||||
* Send unauthenticated request
|
* Send unauthenticated request
|
||||||
* @param {*} uri - Request uri
|
* @param {*} uri - Request uri
|
||||||
* @param {*} body - Request params
|
* @param {*} params - Request params
|
||||||
* @param {*} options - Request options
|
* @param {*} options - Request options
|
||||||
*
|
*
|
||||||
* @return {Object} Request response
|
* @return {Object} Request response
|
||||||
*/
|
*/
|
||||||
async function send(uri, body, options) {
|
async function send(uri, params, options = {}) {
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
return resolve({statusCode: 200, message: 'Fake notification sent'});
|
return resolve({
|
||||||
|
body: JSON.stringify(
|
||||||
|
{statusCode: 200, message: 'Fake notification sent'}
|
||||||
|
)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
method: 'POST',
|
body: params
|
||||||
uri: uri,
|
|
||||||
body: body,
|
|
||||||
headers: {'content-type': 'application/json'},
|
|
||||||
json: true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (options) Object.assign(defaultOptions, options);
|
if (options) Object.assign(defaultOptions, options);
|
||||||
|
|
||||||
return request(defaultOptions);
|
return got.post(uri, defaultOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,7 +138,7 @@ module.exports = Self => {
|
||||||
async function sendAuth(uri, body) {
|
async function sendAuth(uri, body) {
|
||||||
const login = await getAuthToken();
|
const login = await getAuthToken();
|
||||||
const options = {
|
const options = {
|
||||||
headers: {'content-type': 'application/json'}
|
headers: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (login) {
|
if (login) {
|
||||||
|
|
|
@ -7,7 +7,8 @@ module.exports = Self => {
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The worker id of the destinatary'
|
description: 'The worker id of the destinatary'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
arg: 'message',
|
arg: 'message',
|
||||||
type: 'String',
|
type: 'String',
|
||||||
required: true,
|
required: true,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import selectors from '../../helpers/selectors';
|
import selectors from '../../helpers/selectors';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client Edit billing data path', () => {
|
fdescribe('Client Edit billing data path', () => {
|
||||||
let browser;
|
let browser;
|
||||||
let page;
|
let page;
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import '@babel/polyfill';
|
import 'core-js/stable';
|
||||||
|
import 'regenerator-runtime/runtime';
|
||||||
import * as ng from 'angular';
|
import * as ng from 'angular';
|
||||||
export {ng};
|
export {ng};
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,6 @@
|
||||||
"url": "https://gitea.verdnatura.es/verdnatura/salix"
|
"url": "https://gitea.verdnatura.es/verdnatura/salix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/polyfill": "^7.2.5",
|
|
||||||
"@uirouter/angularjs": "^1.0.20",
|
"@uirouter/angularjs": "^1.0.20",
|
||||||
"angular": "^1.7.5",
|
"angular": "^1.7.5",
|
||||||
"angular-animate": "^1.7.8",
|
"angular-animate": "^1.7.8",
|
||||||
|
@ -17,7 +16,6 @@
|
||||||
"angular-translate-loader-partial": "^2.18.1",
|
"angular-translate-loader-partial": "^2.18.1",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"mg-crud": "^1.1.2",
|
"mg-crud": "^1.1.2",
|
||||||
"npm": "^6.11.3",
|
|
||||||
"oclazyload": "^0.6.3",
|
"oclazyload": "^0.6.3",
|
||||||
"require-yaml": "0.0.1",
|
"require-yaml": "0.0.1",
|
||||||
"validator": "^6.3.0"
|
"validator": "^6.3.0"
|
||||||
|
|
24
gulpfile.js
24
gulpfile.js
|
@ -3,7 +3,7 @@ const gulp = require('gulp');
|
||||||
const PluginError = require('plugin-error');
|
const PluginError = require('plugin-error');
|
||||||
const argv = require('minimist')(process.argv.slice(2));
|
const argv = require('minimist')(process.argv.slice(2));
|
||||||
const log = require('fancy-log');
|
const log = require('fancy-log');
|
||||||
const request = require('request');
|
const got = require('got');
|
||||||
const e2eConfig = require('./e2e/helpers/config.js');
|
const e2eConfig = require('./e2e/helpers/config.js');
|
||||||
const Docker = require('./db/docker.js');
|
const Docker = require('./db/docker.js');
|
||||||
|
|
||||||
|
@ -143,8 +143,9 @@ backTest.description = `Watches for changes in modules to execute backTest task`
|
||||||
|
|
||||||
// End to end tests
|
// End to end tests
|
||||||
function e2eSingleRun() {
|
function e2eSingleRun() {
|
||||||
require('@babel/register')({presets: ['@babel/preset-env']});
|
require('@babel/register')({presets: ['@babel/env']});
|
||||||
require('@babel/polyfill');
|
require('core-js/stable');
|
||||||
|
require('regenerator-runtime/runtime');
|
||||||
|
|
||||||
const jasmine = require('gulp-jasmine');
|
const jasmine = require('gulp-jasmine');
|
||||||
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||||
|
@ -224,17 +225,20 @@ async function backendStatus() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let timer;
|
let timer;
|
||||||
let attempts = 1;
|
let attempts = 1;
|
||||||
timer = setInterval(() => {
|
timer = setInterval(async() => {
|
||||||
const url = `${e2eConfig.url}/api/Applications/status`;
|
try {
|
||||||
request.get(url, (err, res) => {
|
const url = `${e2eConfig.url}/api/Applications/status`;
|
||||||
if (err || attempts > 100) // 250ms * 100 => 25s timeout
|
const {body} = await got.get(url);
|
||||||
throw new Error('Could not connect to backend');
|
|
||||||
else if (res && res.body == 'true') {
|
if (body == 'true') {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
resolve(attempts);
|
resolve(attempts);
|
||||||
} else
|
} else
|
||||||
attempts++;
|
attempts++;
|
||||||
});
|
} catch (error) {
|
||||||
|
if (error || attempts > 100) // 250ms * 100 => 25s timeout
|
||||||
|
throw new Error('Could not connect to backend');
|
||||||
|
}
|
||||||
}, milliseconds);
|
}, milliseconds);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const request = require('request-promise-native');
|
const got = require('got');
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
const getFinalState = require('vn-loopback/util/hook').getFinalState;
|
const getFinalState = require('vn-loopback/util/hook').getFinalState;
|
||||||
const isMultiple = require('vn-loopback/util/hook').isMultiple;
|
const isMultiple = require('vn-loopback/util/hook').isMultiple;
|
||||||
|
@ -299,8 +299,8 @@ module.exports = Self => {
|
||||||
recipientId: instance.id,
|
recipientId: instance.id,
|
||||||
recipient: instance.email
|
recipient: instance.email
|
||||||
};
|
};
|
||||||
await request.get(`${origin}/api/email/payment-update`, {
|
await got.get(`${origin}/api/email/payment-update`, {
|
||||||
qs: params
|
query: params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
|
@ -15,15 +15,16 @@
|
||||||
"bmp-js": "^0.1.0",
|
"bmp-js": "^0.1.0",
|
||||||
"compression": "^1.7.3",
|
"compression": "^1.7.3",
|
||||||
"fs-extra": "^5.0.0",
|
"fs-extra": "^5.0.0",
|
||||||
|
"got": "^6.7.1",
|
||||||
"helmet": "^3.21.2",
|
"helmet": "^3.21.2",
|
||||||
"i18n": "^0.8.4",
|
"i18n": "^0.8.4",
|
||||||
"image-type": "^4.1.0",
|
"image-type": "^4.1.0",
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
"ldapjs": "^2.2.0",
|
"ldapjs": "^2.2.0",
|
||||||
"loopback": "^3.26.0",
|
"loopback": "^3.26.0",
|
||||||
"loopback-boot": "^2.27.1",
|
"loopback-boot": "3.3.1",
|
||||||
"loopback-component-explorer": "^6.5.0",
|
"loopback-component-explorer": "^6.5.0",
|
||||||
"loopback-component-storage": "^3.6.1",
|
"loopback-component-storage": "3.6.1",
|
||||||
"loopback-connector-mysql": "^5.4.3",
|
"loopback-connector-mysql": "^5.4.3",
|
||||||
"loopback-connector-remote": "^3.4.1",
|
"loopback-connector-remote": "^3.4.1",
|
||||||
"loopback-context": "^3.4.0",
|
"loopback-context": "^3.4.0",
|
||||||
|
@ -34,8 +35,6 @@
|
||||||
"object.pick": "^1.3.0",
|
"object.pick": "^1.3.0",
|
||||||
"puppeteer": "^7.1.0",
|
"puppeteer": "^7.1.0",
|
||||||
"read-chunk": "^3.2.0",
|
"read-chunk": "^3.2.0",
|
||||||
"request": "^2.88.0",
|
|
||||||
"request-promise-native": "^1.0.8",
|
|
||||||
"require-yaml": "0.0.1",
|
"require-yaml": "0.0.1",
|
||||||
"sharp": "^0.27.1",
|
"sharp": "^0.27.1",
|
||||||
"smbhash": "0.0.1",
|
"smbhash": "0.0.1",
|
||||||
|
@ -48,13 +47,12 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.7.7",
|
"@babel/core": "^7.7.7",
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
||||||
"@babel/polyfill": "^7.7.0",
|
|
||||||
"@babel/preset-env": "^7.11.0",
|
"@babel/preset-env": "^7.11.0",
|
||||||
"@babel/register": "^7.7.7",
|
"@babel/register": "^7.7.7",
|
||||||
"angular-mocks": "^1.7.9",
|
"angular-mocks": "^1.7.9",
|
||||||
"babel-jest": "^26.0.1",
|
"babel-jest": "^26.0.1",
|
||||||
"babel-loader": "^8.0.6",
|
"babel-loader": "^8.0.6",
|
||||||
"babel-preset-es2015": "^6.24.1",
|
"core-js": "^3.9.1",
|
||||||
"css-loader": "^2.1.0",
|
"css-loader": "^2.1.0",
|
||||||
"del": "^2.2.2",
|
"del": "^2.2.2",
|
||||||
"eslint": "^7.11.0",
|
"eslint": "^7.11.0",
|
||||||
|
@ -90,6 +88,7 @@
|
||||||
"nodemon": "^1.19.4",
|
"nodemon": "^1.19.4",
|
||||||
"plugin-error": "^1.0.1",
|
"plugin-error": "^1.0.1",
|
||||||
"raw-loader": "^1.0.0",
|
"raw-loader": "^1.0.0",
|
||||||
|
"regenerator-runtime": "^0.13.7",
|
||||||
"sass-loader": "^7.3.1",
|
"sass-loader": "^7.3.1",
|
||||||
"style-loader": "^0.23.1",
|
"style-loader": "^0.23.1",
|
||||||
"webpack": "^4.41.5",
|
"webpack": "^4.41.5",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,7 +14,6 @@
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs-extra": "^7.0.1",
|
"fs-extra": "^7.0.1",
|
||||||
"html-pdf": "^2.2.0",
|
|
||||||
"intl": "^1.2.5",
|
"intl": "^1.2.5",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"juice": "^5.2.0",
|
"juice": "^5.2.0",
|
||||||
|
|
Loading…
Reference in New Issue