Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get(columns, options, callback?) {
if (!is.array(columns)) {
callback = options;
options = columns;
columns = [];
}
if (is.function(options)) {
callback = options;
options = {};
}
let filter;
columns = arrify(columns);
// if there is column filter
if (columns.length) {
const filters = columns.map(Mutation.parseColumnName).map(column => {
const colmFilters: any = [{family: column.family}];
if (column.qualifier) {
colmFilters.push({column: column.qualifier});
}
return colmFilters;
});
const validate = function validate(options) {
if (is.undef(options.validator)) {
throw new Error('validator option undefined')
}
if (!is.function(options.validator) && !is.string(options.validator)) {
throw new Error(
`validator must be of type function or string, received ${typeof options.validator}`
)
}
const validatorName = is.string(options.validator) ? options.validator : ''
const validatorFn = getValidatorFn(options.validator)
if (is.undef(validatorFn)) {
throw new Error(
`validator \`${validatorName}\` does not exist in validator.js or as a custom validator`
)
}
const passIfEmpty = !!options.passIfEmpty
const mongooseOpts = omit(
getTables(options, callback) {
if (is.function(options)) {
callback = options;
options = {};
}
const reqOpts = Object.assign({}, options, {
parent: this.name,
view: Table.VIEWS[options.view || 'unspecified'],
});
delete reqOpts.gaxOptions;
this.bigtable.request(
{
client: 'BigtableTableAdminClient',
method: 'listTables',
reqOpts,
export function koaRequestInformationExtractor(
req: koa.Request,
res: koa.Response
) {
const returnObject = new RequestInformationContainer();
if (
!is.object(req) ||
!is.object(res) ||
is.function(req) ||
is.function(res) ||
is.array(req) ||
is.array(res) ||
!is.object(req.headers)
) {
return returnObject;
}
returnObject
.setMethod(req.method)
.setUrl(req.url)
.setUserAgent(req.headers['user-agent'])
.setReferrer(req.headers.referrer)
.setStatusCode(res.status)
.setRemoteAddress(req.ip);
constructor(...args) {
if (is.function(args[0])) {
[this.class] = args;
this.alias = args[0].name;
} else if (is.object(args[0])) {
[this.object] = args;
this.alias = args[0].constructor.name;
} else {
throw new Error('Class Plugin constructor error ! ');
}
if (args[1]) {
[, this.options] = args;
}
if (args[2]) {
[, , this.alias] = args;
}
}
getEntries(options, callback) {
if (is.function(options)) {
callback = options;
options = {};
}
options = extend(
{
filter: 'logName="' + this.formattedName_ + '"',
},
options
);
return this.logging.getEntries(options, callback);
}
const expectsArgTypesChecked = (is.array(expectsArgTypes)
? expectsArgTypes
: [])!;
const typesToFuzzOnEach = this._generateTypesToFuzzWith(
expectsArgTypesChecked
) as string[][];
let returnValue = undefined;
for (let i = 0; i < typesToFuzzOnEach[0].length; i++) {
returnValue = fnToFuzz.apply(
withContext,
this._generateValuesForFuzzTyping(typesToFuzzOnEach, i)
);
if (is.function(cb)) {
cb!(returnValue);
}
}
return true;
}
}
getMetadata(options, callback?) {
if (is.function(options)) {
callback = options;
options = {};
}
const reqOpts = {
name: this.name,
view: (Table as any).VIEWS[options.view || 'unspecified'],
};
this.bigtable.request(
{
client: 'BigtableTableAdminClient',
method: 'getTable',
reqOpts,
gaxOpts: options.gaxOptions,
},
export function koaRequestInformationExtractor(
req: koa.Request,
res: koa.Response
) {
const returnObject = new RequestInformationContainer();
if (
!is.object(req) ||
!is.object(res) ||
is.function(req) ||
is.function(res) ||
is.array(req) ||
is.array(res) ||
!is.object(req.headers)
) {
return returnObject;
}
returnObject
.setMethod(req.method)
.setUrl(req.url)
.setUserAgent(req.headers['user-agent'])
.setReferrer(req.headers.referrer)
.setStatusCode(res.status)
.setRemoteAddress(req.ip);
return returnObject;