Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/*
generate id manually by hitting
https://rcn.io/admin/create-event-id
*/
const slugify = require('shared/utils/slugify')
const shortid = require('shortid')
// custom alphabet, since by default it includes "-" which we are using as a separator as well
// must include 64 distinct characters
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$')
//so we don't end-up with crazy long URLs, 100 is pessimistic for really long event names
const MAX_SLUG_LENGTH = 100
/**
* Creates just a prefix of the event id without unique id part
* @param {[type]} eventYear Yeah this even is taking place at
* @param {[type]} eventName Name of the event
* @param {[type]} shortSegmentName Typically used to improve event identificaiton
* by just looking at it id, for example for NCNCA it would be "ncnca"
* @returns {[type]} String
*/
const createEventIdPrefix = (eventYear, eventName, shortSegmentName) =>
shortSegmentName
? `evt-${shortSegmentName}-${eventYear}-${slugify(eventName, MAX_SLUG_LENGTH)}`
: `evt-${eventYear}-${slugify(eventName, MAX_SLUG_LENGTH)}`
// uploadImage
var co = require('co');
var shortid = require('shortid');
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$@');
var imageSize = require('image-size');
var Jimp = require("jimp");
var AWS = require('aws-sdk');
var docClient = new AWS.DynamoDB.DocumentClient();
var s3 = new AWS.S3({
signatureVersion: 'v4'
});
var auth = require('../../lib/auth.js');
var dynamoObjects = require('../../lib/dynamoObjects.js');
exports.handler = (event, context, callback) => {
// STAGE VARIABLES FROM API GATEWAY
var stage = event.stage;
const Vue = require('vue/dist/vue.common.js')
const Emitter = require('events').EventEmitter
const most = require('most')
const shortid = require('shortid')
const PROP_REGEX = /<([a-z]+)>/g
const _ = require('lodash')
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%^')
function updateInstanceData(db, schema, props, data, self, prop, val) {
// Unsubscribe all listeners for this prop
props.schema.subscribes[prop].forEach(y => y())
props.schema.subscribes[prop] = []
// For all the paths that are impacted by this prop
props.schema.tokens[prop].props.forEach(x => {
let path = getPath(schema, props, self, x)
let listener = createDataListener(db, path, data, x)
props.schema.subscribes[prop].push(listener)
})
"use strict";
var request = require("request");
var fs = require("fs");
var mkdirp = require("mkdirp");
var rimraf = require("rimraf");
var config = require("../../../../config.js");
var shortid = require("shortid");
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_');
var gitApihub = require("github");
var github = new gitApihub({
version: config.gitAccounts.github.apiVersion,
debug: false,
protocol: config.gitAccounts.github.protocol,
host: config.gitAccounts.github.domainName,
timeout: config.gitAccounts.github.timeout,
headers: {
'user-agent': config.gitAccounts.github.userAgent,
'Cache-Control': 'no-cache'
}
});
function checkIfError (error, options, cb, callback) {
if (error) {
'use strict';
const fs = require("fs");
const async = require("async");
const shortid = require('shortid');
let vmModule = require("../vm/index.js");
const utils = require("../../../utils/utils.js");
const soajsUtils = require("soajs.core.libs").utils;
const soajsLib = require("soajs.core.libs");
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_');
let dbModel = "mongo";
const colls = {
env: 'environment',
git: 'git_accounts',
services: 'services',
daemons: 'daemons',
staticContent: 'staticContent',
catalog: 'catalogs',
cicd: 'cicd',
infra: 'infra',
resources: 'resources'
};
const helpers = require("./helper.js");
let BL = {
if (settings.Items.length > 0) {
for (let i = 0; i < settings.Items.length; i++) {
let _mdata = null;
if (_body.metadata) {
_mdata = _.find(_body.metadata, function(val) {
return val.tag == settings.Items[i].setting.tag;
});
}
if (!_mdata && settings.Items[i].setting.governance === 'Required') {
return cb({code: 400, message: `The required metadata ${settings.Items[i].setting.tag} is missing`}, null);
}
}
}
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$@');
let _package = _body.package;
let _newpackage = {
package_id: shortid.generate(),
created_at: moment.utc().format(),
updated_at: moment.utc().format(),
owner: ticket.userid,
name: _package.name.substring(0, 100).trim(),
description: _package.description.substring(0, 1000).trim(),
deleted: false
};
if ('groups' in _package && _package.groups.length > 0) {
_newpackage.groups = _package.groups;
}
let _schemaCheck = v.validate(_newpackage, packageSchema);
'use strict';
const winston = require('winston');
const shortid = require('shortid');
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$ಠ');
/*
* 'npm' logging levels:
* { error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5 }
*
* RFC5424 'syslog' levels:
* { emerg: 0, alert: 1, crit: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7 }
*/
winston.setLevels(winston.config.npm.levels);
module.exports = {
logger: winston,
shortid: shortid,
fs: require('fs'),
path: require('path'),
generateRandomString: function(){
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_');
return shortid.generate();
},
"use strict";
var request = require("request");
var fs = require("fs");
var mkdirp = require("mkdirp");
var rimraf = require("rimraf");
var config = require("../../../../config.js");
var shortid = require("shortid");
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_');
var gitApihub = require("github");
var github = new gitApihub({
version: config.gitAccounts.github.apiVersion,
debug: false,
protocol: config.gitAccounts.github.protocol,
host: config.gitAccounts.github.domainName,
timeout: config.gitAccounts.github.timeout,
headers: {
'user-agent': config.gitAccounts.github.userAgent
}
});
function checkIfError (error, options, cb, callback) {
if (error) {
if (options && options.code) {
public async run() {
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-@')
/**
* example API usage
* {
* "command": " "
* }
*/
const { webServerPort, ownerID } = this.client.config
const { Log, generalConfig } = this.client
const checkApiKey = async (req, res) => {
const db = await generalConfig.findOne({ where: { id: ownerID } })
const config = JSON.parse(db.dataValues.config)
const { apiKey } = config.webUI
if (!req.body.apiKey) {
Log.info(