Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default ({ config, logger }: { config: GcloudConfig; logger: Logger }): Gstore => {
logger.info(`Instantiating Datastore instance`);
logger.info(`Google Cloud project: ${config.projectId}`);
logger.info(`Datastore namespace: ${config.datastore.namespace}`);
/**
* Create Datastore client instance
*/
const datastore = new Datastore({
projectId: config.projectId,
namespace: config.datastore.namespace,
});
/**
* Create gstore instance
*/
const gstore = GstoreNode({ cache: true });
/**
* Connect gstore to the Google Datastore instance
*/
logger.info('Connecting gstore-node to Datastore');
gstore.connect(datastore);
return gstore;
* @property {string} projectId Google Cloud Platform project id.
*/
this.datastoreOpts || (this.datastoreOpts = {});
utils.fillIn(this.datastoreOpts, DATASTORE_DEFAULTS);
/**
* Override the default predicate functions for the specified operators.
*
* @name CloudDatastoreAdapter#operators
* @type {object}
* @default {}
*/
this.operators || (this.operators = {});
utils.fillIn(this.operators, OPERATORS);
this.datastore || (this.datastore = Datastore(this.datastoreOpts));
}