Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cf.hasOrganizationRole(params.organizationGUID, ctx.token.userID, 'org_manager'),
cf.hasOrganizationRole(params.organizationGUID, ctx.token.userID, 'billing_manager'),
]);
/* istanbul ignore next */
if (!isAdmin && !isManager) {
throw new NotFoundError('not found');
}
const [organization, spaces, orgUsers] = await Promise.all([
cf.organization(params.organizationGUID),
cf.orgSpaces(params.organizationGUID),
cf.usersForOrganization(params.organizationGUID),
]);
const errors = [];
const values: IUserPostBody = merge({
org_roles: {[params.organizationGUID]: {}},
space_roles: {},
}, body);
const user = orgUsers.find((u: IOrganizationUserRoles) => u.metadata.guid === params.userGUID);
try {
if (Object.keys(values.org_roles[params.organizationGUID]).length === 0
&& Object.keys(values.space_roles).length === 0) {
errors.push({field: 'roles', message: 'at least one role should be selected'});
}
if (errors.length > 0) {
throw new ValidationError(errors);
}
async function mergeLocalConfig(configPath, defaultConfig) {
const configExists = await exists(configPath)
if (!configExists) {
return defaultConfig
}
// eslint-disable-next-line global-require, import/no-dynamic-require
const localConfig = babelRequire(configPath)
const config = merge(defaultConfig, localConfig)
if (localConfig.webpack) config.webpack = localConfig.webpack
if (localConfig.webpackDevMiddleware)
config.webpackDevMiddleware = localConfig.webpackDevMiddleware
return config
}
cy.request('/api/v4/config').then((response) => {
const oldSettings = response.body;
const settings = merge(oldSettings, newSettings);
// # Set the modified settings
cy.request({
url: '/api/v4/config',
headers: {'X-Requested-With': 'XMLHttpRequest'},
method: 'PUT',
body: settings,
});
});
export default function prettierPlugin(code, config, state) {
if (!config.prettier) return code
const filePath = state.filePath || process.cwd()
const prettierRcConfig = config.runtimeConfig
? prettier.resolveConfig.sync(filePath, { editorconfig: true })
: {}
return prettier.format(
code,
mergeDeep(
{ parser: 'babel' },
prettierRcConfig,
config.prettierConfig || {},
),
)
}
import fs from 'fs'
import path from 'path'
import { promisify } from 'util'
import cwd from 'cwd'
import merge from 'merge-deep'
const exists = promisify(fs.exists)
const DEFAULT_CONFIG = {
launch: {},
browser: 'chromium',
browserContext: 'default',
exitOnPageError: true,
}
const DEFAULT_CONFIG_CI = merge(DEFAULT_CONFIG, {
launch: {
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows',
'--disable-renderer-backgrounding',
],
},
})
export async function readConfig() {
const defaultConfig =
process.env.CI === 'true' ? DEFAULT_CONFIG_CI : DEFAULT_CONFIG
const hasCustomConfigPath = !!process.env.JEST_PUPPETEER_CONFIG
...cBabelrc,
}),
commonjs(),
],
};
const development = merge(
base,
{
output: {
sourcemap: true,
},
},
);
const production = merge(
base,
{
plugins: [
uglify({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
},
}),
],
},
);
function createSvgo(config, rcConfig) {
const mergedConfig = mergeDeep(
getBaseSvgoConfig(config),
rcConfig,
config.svgoConfig,
)
return new SVGO(mergedConfig)
}
async function inspectMap(map, stack, modelTypes) {
const [listOfLinks, listOfLink] = partition(values(map), isArray);
const linksInspections = await Promise.all(
listOfLinks.map(async links => inspectLinks(links, stack, modelTypes))
);
const linkInspections = await Promise.all(
listOfLink.map(async link => {
const inspection = await inspectLink(link, stack, modelTypes);
return { [`... on ${link.type}`]: inspection };
})
);
return {
_value_: mergeDeep({}, ...linkInspections),
_list_: mergeDeep({}, ...linksInspections)
};
}
async function inspectMap(map, stack, modelTypes) {
const [listOfLinks, listOfLink] = partition(values(map), isArray);
const linksInspections = await Promise.all(
listOfLinks.map(async links => inspectLinks(links, stack, modelTypes))
);
const linkInspections = await Promise.all(
listOfLink.map(async link => {
const inspection = await inspectLink(link, stack, modelTypes);
return { [`... on ${link.type}`]: inspection };
})
);
return {
_value_: mergeDeep({}, ...linkInspections),
_list_: mergeDeep({}, ...linksInspections)
};
}