Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
produce(config, draft => {
draft.external.splice(draft.external.indexOf('shallowequal'), 1);
draft.output.format = 'umd';
draft.output.globals = {
debounce: 'debounce',
'is-plain-object': 'isPlainObject',
memoizerific: 'memoizerific',
'redux-thunk': 'ReduxThunk',
'immer-peasy': 'produce',
react: 'React',
redux: 'Redux',
};
draft.output.name = titleCase(packageJson.name.replace(/-/g, ' ')).replace(
/ /g,
'',
);
draft.plugins.push(fileSize(), resolve(), commonjs());
});
const expenseTypesOptions = Object.entries(expenseTypes).map(([key, value]) => {
return { [key]: titleCase(value) };
});
function resolveDescription(
schema: GraphQLSchema,
operation: OperationDefinitionNode
) {
const selection = operation.selectionSet.selections[0] as FieldNode;
const fieldName = selection.name.value;
const typeDefinition = schema.getType(titleCase(operation.operation));
if (!typeDefinition) {
return '';
}
const definitionNode =
typeDefinition.astNode || parse(printType(typeDefinition)).definitions[0];
if (!isObjectTypeDefinitionNode(definitionNode)) {
return '';
}
const fieldNode = definitionNode.fields!.find(
field => field.name.value === fieldName
);
const descriptionDefinition = fieldNode && fieldNode.description;
const renderKey = (k: string, titleize: boolean) =>
titleize ? titleCase(noCase(k)) : k
this.expenseTypes = Object.entries(expenseTypes).map(([key, value]) => {
return { [key]: titleCase(value) };
});
constructor(options) {
options = options || {}
const spec = options.spec
const dirname = options.__dirname
const pack = require(findUp('package.json', {
cwd: dirname || path.dirname(module.parent.filename)
}))
const it = {}
it.spec = extend(
{
swagger: '2.0',
info: {
title: titleCase(pack.name),
description: pack.description,
version: pack.version,
contact: {
name: pack.author && pack.author.name
},
license: {
name: pack.private === true ? 'Proprietary' : pack.license
}
},
produces: ['application/json', 'text/plain; charset=utf-8'],
schemes: ['https'],
securityDefinitions: {
internalApiKey: {
type: 'apiKey',
name: 'api_key',
in: 'header'
const renderKey = (k: string, titleize: boolean) =>
titleize ? titleCase(noCase(k)) : k
default: function (values) {
return titleCase(
(typeof name === 'undefined' ? values.name : name).replace(
figmaPrefixRegex,
''
)
)
},
validate,
constructor(spec, path, method, parent) {
const match = path.match(/^\/(\w*)\/?/)
let prefix
assert(
match && (prefix = match[1]),
`Path ${path} should be int format /path or /path/anything`
)
Object.assign(spec, {
tags: [prefix],
summary: titleCase(`${method} ${prefix}`),
description: '',
responses: Object.assign({}, onSuccess[0], onError[0]),
security: [{internalApiKey: []}]
})
methodsData.set(this, {spec, onSuccess, onError, parent})
}