1- # dgraph-js [ ![ npm version] ( https://img.shields.io/npm/v/dgraph-js.svg?style=flat )] ( https://www.npmjs.com/package/dgraph-js ) [ ![ Build Status ] ( https://teamcity.dgraph.io/guestAuth/app/rest/builds/buildType:(id:dgraphjs_Build)/statusIcon.svg )] ( https://teamcity.dgraph.io/viewLog.html?buildTypeId=dgraphjs_Build&buildId=lastFinished&guest=1 ) [ ![ Coverage Status] ( https://img.shields.io/coveralls/github/dgraph-io/dgraph-js/master.svg?style=flat )] ( https://coveralls.io/github/dgraph-io/dgraph-js?branch=master )
1+ # dgraph-js [ ![ npm version] ( https://img.shields.io/npm/v/dgraph-js.svg?style=flat )] ( https://www.npmjs.com/package/dgraph-js ) [ ![ Coverage Status] ( https://img.shields.io/coveralls/github/dgraph-io/dgraph-js/master.svg?style=flat )] ( https://coveralls.io/github/dgraph-io/dgraph-js?branch=master )
22
33Official Dgraph client implementation for JavaScript (Node.js v6 and above),
44using [ gRPC] .
55
6- ** Use [ Discuss Issues] ( https://discuss.dgraph.io/c/issues/35/clients/46 ) for reporting issues about this repository.**
7-
86** Looking for browser support? Check out [ dgraph-js-http] .**
97
108[ grpc ] : https://grpc.io/
@@ -14,18 +12,23 @@ This client follows the [Dgraph Go client][goclient] closely.
1412
1513[ goclient ] : https://github.com/dgraph-io/dgo
1614
17- Before using this client, we highly recommend that you go through [ docs. dgraph.io] ,
15+ Before using this client, we highly recommend that you go through [ dgraph.io/docs ] ,
1816and understand how to run and work with Dgraph.
1917
20- [ docs.dgraph.io ] :https://docs.dgraph.io
18+ [ docs.dgraph.io ] :https://dgraph.io/docs
19+
2120
2221## Table of contents
2322
23+ - [ dgraph-js ] ( #dgraph-js-- )
24+ - [ Table of contents] ( #table-of-contents )
2425 - [ Install] ( #install )
2526 - [ Supported Versions] ( #supported-versions )
2627 - [ Quickstart] ( #quickstart )
2728 - [ Using a Client] ( #using-a-client )
2829 - [ Creating a Client] ( #creating-a-client )
30+ - [ Multi-tenancy] ( #multi-tenancy )
31+ - [ Creating a Client for Dgraph Cloud Endpoint] ( #creating-a-client-for-dgraph-cloud-endpoint )
2932 - [ Altering the Database] ( #altering-the-database )
3033 - [ Creating a Transaction] ( #creating-a-transaction )
3134 - [ Running a Mutation] ( #running-a-mutation )
@@ -66,15 +69,11 @@ use a different version of this client.
6669
6770| Dgraph version | dgraph-js version |
6871| :--------------:| :-----------------:|
69- | 1.0.X | * 1.X.Y* |
70- | 1.1.X | * 2.X.Y* |
7172| 20.03.0 | * 20.03.0* |
7273| 21.03.0 | * 21.03.0* |
73- | >=21.03.0 | >=* 21.03.0* |
74+ | >=21.03.0 | >=* 21.03.0* |
75+ | >=24.X.X | >=* 24.X.X* |
7476
75- Note: Only API breakage from * v1.X.Y* to * v2.X.Y* is in
76- the function ` DgraphClient.newTxn().mutate() ` . This function returns a ` messages.Assigned `
77- type in * v1.X* but a ` messages.Response ` type in * v2.X* .
7877
7978## Quickstart
8079
@@ -116,7 +115,7 @@ In order to create a JavaScript client, and make the client login into namespace
116115
117116``` js
118117const dgraphClientStub = new dgraph.DgraphClientStub (" localhost:9080" );
119- await dgraphClientStub .loginIntoNamespace (" groot" , " password" , 123 ); // where 123 is the namespaceId
118+ await dgraphClientStub .loginIntoNamespace (" groot" , " password" , 123 ); // where 123 is the namespaceId
120119```
121120
122121In the example above, the client logs into namespace ` 123 ` using username ` groot ` and password ` password ` .
@@ -166,7 +165,7 @@ await dgraphClient.alter(op);
166165> NOTE: Many of the examples here use the ` await ` keyword which requires
167166> ` async/await ` support which is available on Node.js >= v7.6.0. For prior versions,
168167> the expressions following ` await ` can be used just like normal ` Promise ` :
169- >
168+ >
170169> ``` js
171170> dgraphClient .alter (op)
172171> .then (function (result ) { ... }, function (err ) { ... })
@@ -328,8 +327,8 @@ console.log(JSON.stringify(res.getJson()));
328327
329328### Running an Upsert: Query + Mutation
330329
331- The ` txn.doRequest ` function allows you to run upserts consisting of one query and one mutation.
332- Query variables could be defined and can then be used in the mutation. You can also use the
330+ The ` txn.doRequest ` function allows you to run upserts consisting of one query and one mutation.
331+ Query variables could be defined and can then be used in the mutation. You can also use the
333332` txn.doRequest ` function to perform just a query or a mutation.
334333
335334To know more about upsert, we highly recommend going through the docs at https://docs.dgraph.io/mutations/#upsert-block .
0 commit comments