Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/),
and this project adheres to [Calendar Versioning](https://calver.org/) starting v20.03.0.


## [24.1.0] - 2024-11-13

### Changed

* Bump the minor-and-patch group with 4 updates (#234 #232 #230 #229 #227 #228 #234 #226 #223 #225 #222 #221 #220 #218 #217)
* Remove `grpc` dependency (#233)
* fix euclidean spelling (#224)
* update examples (#219)


## [24.0.0] - 2024-08-22

### Added
Expand All @@ -25,7 +36,7 @@ Version bump.

### Added

- LoginIntoNamespace API
- LoginIntoNamespace API

### Removed

Expand Down
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# 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)
# 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)

Official Dgraph client implementation for JavaScript (Node.js v6 and above),
using [gRPC].

**Use [Discuss Issues](https://discuss.dgraph.io/c/issues/35/clients/46) for reporting issues about this repository.**

**Looking for browser support? Check out [dgraph-js-http].**

[grpc]: https://grpc.io/
Expand All @@ -14,18 +12,23 @@ This client follows the [Dgraph Go client][goclient] closely.

[goclient]: https://github.com/dgraph-io/dgo

Before using this client, we highly recommend that you go through [docs.dgraph.io],
Before using this client, we highly recommend that you go through [dgraph.io/docs],
and understand how to run and work with Dgraph.

[docs.dgraph.io]:https://docs.dgraph.io
[docs.dgraph.io]:https://dgraph.io/docs


## Table of contents

- [dgraph-js ](#dgraph-js--)
- [Table of contents](#table-of-contents)
- [Install](#install)
- [Supported Versions](#supported-versions)
- [Quickstart](#quickstart)
- [Using a Client](#using-a-client)
- [Creating a Client](#creating-a-client)
- [Multi-tenancy](#multi-tenancy)
- [Creating a Client for Dgraph Cloud Endpoint](#creating-a-client-for-dgraph-cloud-endpoint)
- [Altering the Database](#altering-the-database)
- [Creating a Transaction](#creating-a-transaction)
- [Running a Mutation](#running-a-mutation)
Expand Down Expand Up @@ -66,15 +69,11 @@ use a different version of this client.

| Dgraph version | dgraph-js version |
|:--------------:|:-----------------:|
| 1.0.X | *1.X.Y* |
| 1.1.X | *2.X.Y* |
| 20.03.0 | *20.03.0* |
| 21.03.0 | *21.03.0* |
| >=21.03.0 | >=*21.03.0* |
| >=21.03.0 | >=*21.03.0* |
| >=24.X.X | >=*24.X.X* |

Note: Only API breakage from *v1.X.Y* to *v2.X.Y* is in
the function `DgraphClient.newTxn().mutate()`. This function returns a `messages.Assigned`
type in *v1.X* but a `messages.Response` type in *v2.X*.

## Quickstart

Expand Down Expand Up @@ -116,7 +115,7 @@ In order to create a JavaScript client, and make the client login into namespace

```js
const dgraphClientStub = new dgraph.DgraphClientStub("localhost:9080");
await dgraphClientStub.loginIntoNamespace("groot", "password", 123); // where 123 is the namespaceId
await dgraphClientStub.loginIntoNamespace("groot", "password", 123); // where 123 is the namespaceId
```

In the example above, the client logs into namespace `123` using username `groot` and password `password`.
Expand Down Expand Up @@ -166,7 +165,7 @@ await dgraphClient.alter(op);
> NOTE: Many of the examples here use the `await` keyword which requires
> `async/await` support which is available on Node.js >= v7.6.0. For prior versions,
> the expressions following `await` can be used just like normal `Promise`:
>
>
> ```js
> dgraphClient.alter(op)
> .then(function(result) { ... }, function(err) { ... })
Expand Down Expand Up @@ -328,8 +327,8 @@ console.log(JSON.stringify(res.getJson()));

### Running an Upsert: Query + Mutation

The `txn.doRequest` function allows you to run upserts consisting of one query and one mutation.
Query variables could be defined and can then be used in the mutation. You can also use the
The `txn.doRequest` function allows you to run upserts consisting of one query and one mutation.
Query variables could be defined and can then be used in the mutation. You can also use the
`txn.doRequest` function to perform just a query or a mutation.

To know more about upsert, we highly recommend going through the docs at https://docs.dgraph.io/mutations/#upsert-block.
Expand Down
2 changes: 1 addition & 1 deletion examples/simple/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "simple",
"dependencies": {
"dgraph-js": "^24.0.0",
"dgraph-js": "^24.1.0",
"@grpc/grpc-js": "1.8.22"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dgraph-js",
"version": "24.0.0",
"version": "24.1.0",
"description": "Official javascript client for Dgraph",
"license": "Apache-2.0",
"repository": {
Expand Down