Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.leftJoin('user_profile AS up', 'up.user_id', 'u.id')
.leftJoin('auth_certificate AS ca', 'ca.user_id', 'u.id')
.leftJoin('auth_facebook AS fa', 'fa.user_id', 'u.id')
.leftJoin('auth_google AS ga', 'ga.user_id', 'u.id')
.leftJoin('auth_github AS gha', 'gha.user_id', 'u.id')
.leftJoin('auth_linkedin AS lna', 'lna.user_id', 'u.id');
// add order by
if (orderBy && orderBy.column) {
let column = orderBy.column;
let order = 'asc';
if (orderBy.order) {
order = orderBy.order;
}
queryBuilder.orderBy(decamelize(column), order);
}
// add filter conditions
if (filter) {
if (has(filter, 'role') && filter.role !== '') {
queryBuilder.where(function() {
this.where('u.role', filter.role);
});
}
if (has(filter, 'isActive') && filter.isActive !== null) {
queryBuilder.where(function() {
this.where('u.is_active', filter.isActive);
});
}
public selectBy = (schema: typeof Schema, fields: string[]) => {
const domainSchema = new DomainSchema(schema);
// form table name
const tableName = decamelize(domainSchema.__.name);
// select fields
const parentPath = [];
const selectItems = [];
const joinNames = [];
this._getSelectFields(fields, parentPath, domainSchema, selectItems, joinNames, []);
debug('Select items:', selectItems);
debug('Join on tables:', joinNames);
return query => {
// join table names
joinNames.map(joinName => {
query.leftJoin(joinName, `${joinName}.${tableName}_id`, `${tableName}.id`);
});
humps.camelizeKeys(someObject, function (key, convert) {
return /^[A-Z0-9_]+$/.test(key) ? key : convert(key);
});
humps.decamelizeKeys(someObject, function (key, convert, options) {
return /^[A-Z0-9_]+$/.test(key) ? key : convert(key, options);
});
humps.camelize('hello_world-foo bar');
humps.pascalize('hello_world-foo bar');
humps.decamelize('helloWorldFooBar');
humps.decamelize('helloWorldFooBar', someOptions);
humps.decamelize('helloWorld1', { split: /(?=[A-Z0-9])/ })
humps.depascalize('helloWorldFooBar');
humps.camelizeKeys(someObject);
humps.pascalizeKeys(someObject);
humps.decamelizeKeys(someObject);
humps.depascalizeKeys(someObject);
humps.camelizeKeys(someObject, someOptions);
humps.pascalizeKeys(someObject, someOptions);
humps.decamelizeKeys(someObject, someOptions);
humps.depascalizeKeys(someObject, someOptions);
humps.camelizeKeys(someObject, someOptions2);
humps.pascalizeKeys(someObject, someOptions2);
humps.camelizeKeys(someObject, function (key, convert) {
return /^[A-Z0-9_]+$/.test(key) ? key : convert(key);
});
humps.decamelizeKeys(someObject, function (key, convert, options) {
return /^[A-Z0-9_]+$/.test(key) ? key : convert(key, options);
});
humps.camelize('hello_world-foo bar');
humps.pascalize('hello_world-foo bar');
humps.decamelize('helloWorldFooBar');
humps.decamelize('helloWorldFooBar', someOptions);
humps.decamelize('helloWorld1', { split: /(?=[A-Z0-9])/ })
humps.depascalize('helloWorldFooBar');
humps.camelizeKeys(someObject);
humps.pascalizeKeys(someObject);
humps.decamelizeKeys(someObject);
humps.depascalizeKeys(someObject);
humps.camelizeKeys(someObject, someOptions);
humps.pascalizeKeys(someObject, someOptions);
humps.decamelizeKeys(someObject, someOptions);
humps.depascalizeKeys(someObject, someOptions);
humps.camelizeKeys(someObject, someOptions2);
humps.pascalizeKeys(someObject, someOptions2);
humps.decamelizeKeys(someObject, someOptions2);
labelize(prop) {
return humps.decamelize(prop, { separator: " " });
}
if (typeof otherAttributes[key] === 'function') {
const data = otherAttributes[key].call();
if (data) {
if (Array.isArray(data)) {
serializedResource.relationships[humps.decamelize(key)] = {
data: data.map((relationship) => serializeRelationship(relationship)),
};
} else {
serializedResource.relationships[humps.decamelize(key)] = {
data: serializeRelationship(data),
};
}
}
} else {
serializedResource.attributes[humps.decamelize(key)] = otherAttributes[key];
}
});
function kabob(string) {
return humps.decamelize(humps.camelize(string), { separator: "-" });
}
compileItem(itemTemplate, errorReporter) {
if (!itemTemplate.measures && !itemTemplate.dimensions) {
errorReporter.error(`Either measures or dimensions should be declared for valid query`);
return;
}
const { type, ...restVisualizationParams } = itemTemplate.visualization;
const config = {
visualizationType: humps.decamelize(type),
...restVisualizationParams,
name: itemTemplate.title,
pivotMarkup: itemTemplate.pivot,
description: itemTemplate.description
};
const layout = { ...itemTemplate.layout };
if (itemTemplate.measures) {
config.metrics = this.cubeEvaluator.evaluateReferences(null, itemTemplate.measures);
}
if (itemTemplate.dimensions) {
config.dimension = this.cubeEvaluator.evaluateReferences(null, itemTemplate.dimensions);
}
if (itemTemplate.segments) {
config.segments = this.cubeEvaluator.evaluateReferences(null, itemTemplate.segments);
}
if (itemTemplate.order) {
toSnakeCase(stringOrArray) {
if (Array.isArray(stringOrArray)) {
return stringOrArray.map(humps.decamelize);
}
return humps
.decamelize(util.replaceSpaces(stringOrArray))
.replace(/_+/g, '_');
},
function removeSymlink(packageName, modulePackageName) {
fs.unlinkSync(
`${BASE_PATH}/node_modules/@gqlapp/${decamelize(packageName, { separator: '-' })}-${modulePackageName}`
);
}