Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const handler = (argv: ArgvType) => {
const jq = optional('node-jq');
if (!jq) {
throw new Error('Must install `node-jq` dependency to use `roarr filter`.');
}
// argv
process.stdin
.pipe(split())
.pipe(through((chunk, encoding, callback) => {
const line = chunk.toString();
filterLog(jq.run, argv, line, callback);
}))
.pipe(process.stdout);
};
import optional from 'optional';
import arrify from 'arrify';
import datastoreAdapterFactory from 'nsql-cache-datastore';
import { Datastore } from '@google-cloud/datastore';
import DataLoader from 'dataloader'; // eslint-disable-line import/no-extraneous-dependencies
import { EntityKey, EntityData } from './types';
const OptionalDataloader = optional('dataloader');
const dsAdapter = datastoreAdapterFactory();
const { keyToString } = dsAdapter;
/**
* Create a DataLoader instance
* @param {Datastore} ds @google-cloud Datastore instance
*/
export const createDataLoader = (
ds: Datastore,
options?: { maxBatchSize: number },
): DataLoader => {
if (!ds) {
throw new Error('A Datastore instance has to be passed');
}
import is from 'is';
import { QUERIES_FORMATS } from './constants';
import VirtualType from './virtualType';
import { ValidationError, ERROR_CODES } from './errors';
import {
FunctionType,
FuncReturningPromise,
CustomEntityFunction,
GenericObject,
EntityFormatType,
JSONFormatType,
} from './types';
import { QueryListOptions } from './query';
const Joi = optional('@hapi/joi') || optional('joi');
const IS_QUERY_METHOD: { [key: string]: boolean } = {
update: true,
delete: true,
findOne: true,
};
const DEFAULT_OPTIONS = {
validateBeforeSave: true,
explicitOnly: true,
excludeLargeProperties: false,
queries: {
readAll: false,
format: QUERIES_FORMATS.JSON,
},
};