3737 */
3838
3939import * as arrify from 'arrify' ;
40- import { GrpcClient , GrpcClientOptions } from 'google-gax' ;
4140import { GoogleAuth } from 'google-auth-library' ;
41+ import { GrpcClient , GrpcClientOptions } from 'google-gax' ;
4242import * as is from 'is' ;
4343
44- import { DatastoreRequest } from './request' ;
4544import { entity } from './entity' ;
4645import { Query } from './query' ;
46+ import { DatastoreRequest } from './request' ;
4747import { Transaction } from './transaction' ;
4848
4949const { grpc} = new GrpcClient ( { } as GrpcClientOptions ) ;
@@ -88,7 +88,7 @@ const gapic = Object.freeze({
8888 *
8989 * Additionally, `DATASTORE_PROJECT_ID` is recognized. If you have this set,
9090 * you don't need to provide a `projectId`.
91- *-
91+ *
9292 *
9393 * @class
9494 * @extends {DatastoreRequest }
@@ -104,13 +104,14 @@ const gapic = Object.freeze({
104104 * @example <caption>Import the client library</caption>
105105 * const {Datastore} = require('@google-cloud/datastore');
106106 *
107- * @example <caption>Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:</caption>
108- * const datastore = new Datastore();
107+ * @example <caption>Create a client that uses <a
108+ * href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application
109+ * Default Credentials (ADC)</a>:</caption> const datastore = new Datastore();
109110 *
110- * @example <caption>Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit credentials</a>:</caption>
111- * const datastore = new Datastore({
112- * projectId: 'your-project-id',
113- * keyFilename: '/path/to/keyfile.json'
111+ * @example <caption>Create a client with <a
112+ * href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit
113+ * credentials</a>:</caption> const datastore = new Datastore({ projectId:
114+ * 'your-project-id', keyFilename: '/path/to/keyfile.json'
114115 * });
115116 *
116117 * @example <caption>Retrieving Records</caption>
@@ -312,9 +313,11 @@ const gapic = Object.freeze({
312313 * const customerId2 = 4993882;
313314 * const customerKey1 = datastore.key(['Customer', customerId1]);
314315 * const customerKey2 = datastore.key(['Customer', customerId2]);
315- * const cookieKey1 = datastore.key(['Customer', customerId1, 'Cookie', 'cookie28839']); // child entity
316- * const cookieKey2 = datastore.key(['Customer', customerId1, 'Cookie', 'cookie78984']); // child entity
317- * const cookieKey3 = datastore.key(['Customer', customerId2, 'Cookie', 'cookie93911']); // child entity
316+ * const cookieKey1 = datastore.key(['Customer', customerId1, 'Cookie',
317+ * 'cookie28839']); // child entity const cookieKey2 =
318+ * datastore.key(['Customer', customerId1, 'Cookie', 'cookie78984']); // child
319+ * entity const cookieKey3 = datastore.key(['Customer', customerId2, 'Cookie',
320+ * 'cookie93911']); // child entity
318321 *
319322 * const entities = [];
320323 *
@@ -400,7 +403,7 @@ class Datastore extends DatastoreRequest {
400403 this . namespace = options . namespace ;
401404
402405 const userProvidedProjectId =
403- options . projectId || process . env . DATASTORE_PROJECT_ID ;
406+ options . projectId || process . env . DATASTORE_PROJECT_ID ;
404407 const defaultProjectId = '{{projectId}}' ;
405408
406409 /**
@@ -413,16 +416,15 @@ class Datastore extends DatastoreRequest {
413416 this . determineBaseUrl_ ( options . apiEndpoint ) ;
414417
415418 this . options = Object . assign (
416- {
417- libName : 'gccl' ,
418- libVersion : require ( '../../package.json' ) . version ,
419- scopes : gapic . v1 . DatastoreClient . scopes ,
420- servicePath : this . baseUrl_ ,
421- port : is . number ( this . port_ ) ? this . port_ : 443 ,
422- projectId : userProvidedProjectId ,
423- } ,
424- options
425- ) ;
419+ {
420+ libName : 'gccl' ,
421+ libVersion : require ( '../../package.json' ) . version ,
422+ scopes : gapic . v1 . DatastoreClient . scopes ,
423+ servicePath : this . baseUrl_ ,
424+ port : is . number ( this . port_ ) ? this . port_ : 443 ,
425+ projectId : userProvidedProjectId ,
426+ } ,
427+ options ) ;
426428 if ( this . customEndpoint_ ) {
427429 this . options . sslCreds = grpc . credentials . createInsecure ( ) ;
428430 }
@@ -647,7 +649,8 @@ class Datastore extends DatastoreRequest {
647649 }
648650
649651 /**
650- * Helper to create a Key object, scoped to the instance's namespace by default.
652+ * Helper to create a Key object, scoped to the instance's namespace by
653+ * default.
651654 *
652655 * You may also specify a configuration object to define a namespace and path.
653656 *
@@ -664,15 +667,15 @@ class Datastore extends DatastoreRequest {
664667 * const key = datastore.key('Company');
665668 *
666669 * @example
667- * <caption>Create a complete key with a kind value of `Company` and id `123`.</caption>
668- * const {Datastore} = require('@google-cloud/datastore');
670+ * <caption>Create a complete key with a kind value of `Company` and id
671+ * `123`.</caption> const {Datastore} = require('@google-cloud/datastore');
669672 * const datastore = new Datastore();
670673 * const key = datastore.key(['Company', 123]);
671674 *
672675 * @example
673- * <caption>If the ID integer is outside the bounds of a JavaScript Number object, create an Int.</caption>
674- * const {Datastore} = require('@google-cloud/datastore');
675- * const datastore = new Datastore();
676+ * <caption>If the ID integer is outside the bounds of a JavaScript Number
677+ * object, create an Int.</caption> const {Datastore} =
678+ * require('@google-cloud/datastore'); const datastore = new Datastore();
676679 * const key = datastore.key([
677680 * 'Company',
678681 * datastore.int('100000000000001234')
@@ -686,21 +689,19 @@ class Datastore extends DatastoreRequest {
686689 * const key = datastore.key(['Company', 'Google']);
687690 *
688691 * @example
689- * <caption>Create a complete key from a provided namespace and path.</caption>
690- * const {Datastore} = require('@google-cloud/datastore');
692+ * <caption>Create a complete key from a provided namespace and
693+ * path.</caption> const {Datastore} = require('@google-cloud/datastore');
691694 * const datastore = new Datastore();
692695 * const key = datastore.key({
693696 * namespace: 'My-NS',
694697 * path: ['Company', 123]
695698 * });
696699 */
697700 key ( options ) {
698- options = is . object ( options )
699- ? options
700- : {
701- namespace : this . namespace ,
702- path : arrify ( options ) ,
703- } ;
701+ options = is . object ( options ) ? options : {
702+ namespace : this . namespace ,
703+ path : arrify ( options ) ,
704+ } ;
704705 return new entity . Key ( options ) ;
705706 }
706707
@@ -742,9 +743,9 @@ class Datastore extends DatastoreRequest {
742743 }
743744
744745 /**
745- * Determine the appropriate endpoint to use for API requests. If not explicitly
746- * defined, check for the "DATASTORE_EMULATOR_HOST" environment variable, used
747- * to connect to a local Datastore server.
746+ * Determine the appropriate endpoint to use for API requests. If not
747+ * explicitly defined, check for the "DATASTORE_EMULATOR_HOST" environment
748+ * variable, used to connect to a local Datastore server.
748749 *
749750 * @private
750751 *
@@ -768,10 +769,9 @@ class Datastore extends DatastoreRequest {
768769 this . port_ = Number ( baseUrl . match ( port ) ! [ 1 ] ) ;
769770 }
770771
771- this . baseUrl_ = baseUrl
772- . replace ( leadingProtocol , '' )
773- . replace ( port , '' )
774- . replace ( trailingSlashes , '' ) ;
772+ this . baseUrl_ = baseUrl . replace ( leadingProtocol , '' )
773+ . replace ( port , '' )
774+ . replace ( trailingSlashes , '' ) ;
775775 }
776776
777777 /**
@@ -813,19 +813,21 @@ export {Datastore};
813813 * @module {Datastore} @google -cloud/datastore
814814 * @alias nodejs-datastore
815815 *
816- * @example <caption>Install the client library with <a href="https://www.npmjs.com/">npm</a>:</caption>
817- * npm install --save @google-cloud/datastore
816+ * @example <caption>Install the client library with <a
817+ * href="https://www.npmjs.com/">npm</a>:</caption> npm install --save
818+ * @google -cloud/datastore
818819 *
819820 * @example <caption>Import the client library</caption>
820821 * const {Datastore} = require('@google-cloud/datastore');
821822 *
822- * @example <caption>Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:</caption>
823- * const datastore = new Datastore();
823+ * @example <caption>Create a client that uses <a
824+ * href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application
825+ * Default Credentials (ADC)</a>:</caption> const datastore = new Datastore();
824826 *
825- * @example <caption>Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit credentials</a>:</caption>
826- * const datastore = new Datastore({
827- * projectId: 'your-project-id',
828- * keyFilename: '/path/to/keyfile.json'
827+ * @example <caption>Create a client with <a
828+ * href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit
829+ * credentials</a>:</caption> const datastore = new Datastore({ projectId:
830+ * 'your-project-id', keyFilename: '/path/to/keyfile.json'
829831 * });
830832 *
831833 * @example <caption>include:samples/quickstart.js</caption>
0 commit comments