Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
),
userId: joiValidator.guid(), // used for validation is-self
email: Joi.string(), // to allow regex
dojoEmail: Joi.string(), // to allow regex
dojoName: Joi.string(),
stage: Joi.alternatives(Joi.number().integer(), Joi.object()),
completed: Joi.boolean(),
verified: Joi.number().integer(),
deleted: Joi.number().integer(),
alpha2: joiValidator
.alpha2()
.optional()
.description('two capital letters representing the country'),
skip$: Joi.alternatives(Joi.number(), Joi.object()),
limit$: Joi.alternatives(Joi.number(), Joi.object()),
sort$: Joi.alternatives(Joi.number(), Joi.object()),
},
}),
},
},
},
{
method: 'POST',
path: `${options.basePath}/dojos/leads`,
handler: handlers.actHandlerNeedsUser('search', null, null, {
ctrl: 'lead',
}),
config: {
auth: auth.apiUser,
description: 'Search dojo leads',
notes: 'Search dojo leads',
debug('insert failed for intents', ex)
}
}
},
description: 'Records user activity',
notes: 'The browser uses this to indicate <a href="https://github.com/brave/vault/wiki/Intents">user activity</a>, such as clicking on a link.',
tags: ['api'],
validate:
{ params: { userId: Joi.string().guid().required().description('the identity of the user entry') },
payload: Joi.alternatives(intentSchema, helper.add_header_schema(intentSchema)) // NB: alternatives is temporary
},
response: {
schema: Joi.alternatives(resultSchema, helper.add_nonce_schema(resultSchema)) // NB: alternatives is temporary
/*
status: {
400: Joi.object({
boomlet: Joi.string().required().description('payload is not cryptographically-signed')
}),
400: Joi.object({
boomlet: Joi.string().required().description('unknown user entry cryptography version')
}),
400: Joi.object({
boomlet: Joi.string().required().description('header.nonce is invalid')
}),
404: Joi.object({
boomlet: Joi.string().required().description('user entry does not exist')
}),
422: Joi.object({
certificates: Joi.object().keys({
wwdr: Joi.string().required(),
signerCert: Joi.string().required(),
signerKey: Joi.object().keys({
keyFile: Joi.string().required(),
passphrase: Joi.string().required(),
}).required()
}).required(),
overrides: Joi.object(),
shouldOverwrite: Joi.boolean()
});
const supportedOptions = Joi.object().keys({
serialNumber: Joi.string(),
description: Joi.string(),
userInfo: Joi.alternatives(Joi.object().unknown(), Joi.array()),
// parsing url as set of words and nums followed by dots, optional port and any possible path after
webServiceURL: Joi.string().regex(/https?:\/\/(?:(?:[a-z0-9]+\.?)+(?::\d)?(?:\/[\S]+)*)*/),
authenticationToken: Joi.string().token().min(16),
sharingProhibited: Joi.boolean(),
backgroundColor: Joi.string().min(10).max(16),
foregroundColor: Joi.string().min(10).max(16),
labelColor: Joi.string().min(10).max(16),
groupingIdentifier: Joi.string(),
suppressStripShine: Joi.boolean(),
logoText: Joi.string(),
}).with("webServiceURL", "authenticationToken");
/* For a correct usage of semantics, please refer to https://apple.co/2I66Phk */
const currencyAmount = Joi.object().keys({
enableGridY: Joi.boolean(),
lineWidth: Joi.number().min(0),
enableDots: Joi.boolean(),
dotSize: Joi.number().min(0),
dotColor: inheritedColor,
dotBorderWidth: Joi.number().min(0),
dotBorderColor: inheritedColor,
enableDotLabel: Joi.boolean(),
dotLabel: Joi.string(),
dotLabelYOffset: Joi.number(),
enableArea: Joi.boolean(),
areaBlendMode: common.blendMode,
areaBaselineValue: Joi.alternatives().try(Joi.string(), Joi.number()),
areaOpacity: Joi.number(),
markers: Joi.array().items(
Joi.object().keys({
axis: Joi.any()
.valid(['x', 'y'])
.required(),
value: Joi.alternatives()
.try(Joi.string(), Joi.number())
.required(),
style: Joi.object(),
})
),
colors: ordinalColors,
colorBy: Joi.string(),
var Joi = require('joi');
var regex = require('./regex/regex.js');
var fieldValidators = {
username: Joi.string().regex(regex.username).label('Username'),
uid: Joi.alternatives().try(
Joi.string().regex(regex.username).label('Username'),
Joi.string().regex(regex.email).label('Email')
),
password: Joi.string().regex(/^\S{8,128}$/).label('Password'),
email: Joi.string().regex(regex.email).label('Email'),
feedback: Joi.boolean().required().label('Feedback')
};
module.exports = {
getValidatorSet: function (fieldValues) {
var validators = {};
fieldValues.forEach(function(entry) {
var isDisabled = entry[Object.keys(entry)].disabled;
Object.keys(entry).forEach(function(name) {
if (!isDisabled && fieldValidators[name]) {
validators[name] = fieldValidators[name];
const Joi = require('joi')
module.exports = Joi.object({
autoAssign: Joi.alternatives(Joi.boolean(), Joi.array().items(Joi.string()), Joi.string()).default(true)
.description('Should **todo** automatically assign a user to the new issue? If `true`, it\'ll assign whoever pushed the code. If a string, it\'ll assign that user by username. You can also give it an array of usernames or `false` to not assign anyone.'),
keyword: Joi.array().items(Joi.string()).single().default(['@todo', 'TODO'])
.description('The keyword(s) to use to generate issue titles'),
bodyKeyword: Joi.array().items(Joi.string()).single().default(['@body', 'BODY'])
.description('If this is in the line right after the main keyword, it will become the generated issue body.'),
blobLines: Joi.alternatives(Joi.number(), Joi.boolean().valid(false)).default(5)
.description('The number of lines of code to show, starting from the keyword.'),
caseSensitive: Joi.boolean().default(false)
.description('Should the keyword be case sensitive?'),
label: Joi.alternatives(Joi.boolean(), Joi.array().items(Joi.string()).single()).default(true)
.description('Add a label to the new issue. If true, add the `todo` label. If false, don\'t add any label.You can also give it a label name or an array of label names.'),
reopenClosed: Joi.boolean().default(true)
.description('If an issue already exists and is closed, reopen it. Note: if set to false, no new issue will be created.'),
exclude: Joi.string().allow(null).default(null)
.description('Exclude certain files and/or directories. Should be a valid regular expression.')
})
exports.register = function (server, options, next) {
var bookshelf = null;
var schema = {
knex: Joi.object().required(),
plugins: Joi.array().items(Joi.string()).default([]),
models: Joi.array().items(Joi.string()).single().default([]),
collections: Joi.array().items(Joi.string()).single().default([]),
base: Joi.alternatives().try(Joi.func(), Joi.object({
model: Joi.func().optional(),
collection: Joi.func().optional()
})).optional(),
namespace: Joi.string().optional()
};
var result = Joi.validate(options, schema);
if (result.error) {
return next(result.error);
}
options = result.value;
try {
var knex = require('knex')(options.knex);
bookshelf = require('bookshelf');
bookshelf = bookshelf(knex);
value: Joi.string()
}).min(1).max(1);
const corsOriginSchema = Joi.object().keys({
allow: Joi.array().items(corsOriginConfigSchema.min(1)),
disableAll: Joi.boolean(),
enableAll: Joi.boolean(),
middleware: middlewareConfigValidatorSchema
}).min(1).max(1);
const methodValidator = Joi.string().valid('GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD');
export let corsConfigSchema = Joi.object().keys({
allowedHeaders: Joi.alternatives([Joi.array().items(Joi.string()), Joi.string()]),
credentials: Joi.boolean(),
exposedHeaders: Joi.alternatives([Joi.array().items(Joi.string()), Joi.string()]),
maxAge: Joi.string(),
methods: Joi.alternatives([Joi.array().items(methodValidator),methodValidator]),
origin: corsOriginSchema.required(),
preflightContinue: Joi.boolean()
});
export let apiCorsConfigSchema = corsConfigSchema.keys({
group: Joi.alternatives([Joi.array().items(Joi.string()), Joi.string()]),
origin: corsOriginSchema,
use: Joi.string()
}).xor('origin', 'use');
*/
middleware: MiddlewareConfig;
/**
* A list of groups that should be filtered by this filter. If not provided, everything
* will be filtered.
* Defaults to *.
*/
group?: Array;
/**
* Import a configuration from gateway config session
*/
use?: string;
}
export const apiFilterSchema = Joi.object().keys({
group: Joi.alternatives([Joi.array().items(Joi.string()), Joi.string()]),
middleware: middlewareConfigValidatorSchema,
use: Joi.string()
}).xor('middleware', 'use');
config: {
handler: handler,
validate: {
query: {
param1: t.object()
}
}
}
}, {
method: 'GET',
path: '/alternatives',
config: {
handler: handler,
validate: {
query: {
param1: t.alternatives(t.number().required(), t.string().valid('first', 'last'))
}
}
}
}, {
method: 'GET',
path: '/novalidation',
config: {
handler: handler
}
}, {
method: 'GET',
path: '/withresponse',
config: {
handler: handler,
response: {
schema: {