Skip to content

Commit

Permalink
Dgraph 1.1 login support; typescript upgrade; removed nulls from code
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Korzhyk committed Jun 12, 2019
1 parent b93743c commit 2156353
Show file tree
Hide file tree
Showing 35 changed files with 6,913 additions and 6,790 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [v1.3.0-rc1] - 2019-06-12

### Added
- Support for ACL features in Dgraph v1.1 - login & jwt refresh
- Updated protobufs to latest version
- Upgraded all typescript dev libraries to latest version
- Removed support for null values where appropriate (because typescript barks at those)

### Added
- `upsert` and `lang` fields to proto message type SchemaNode
- Option for server-side sequencing
Expand All @@ -22,12 +30,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- **[BREAKING]** Optional `metadata` parameter of type `grpc.Metadata` to the
`DgraphClientStub` methods. `options` parameter moved to the third position
to conform to the `grpc` package API.

Methods affected - `DgraphClient#alter`, `Txn#query`, `Txn#queryWithVars`,
`Txn#mutate`, `Txn#commit` and `Txn#discard`.

To upgrade to this version, if using any of these methods with the `options`
parameter, simply add a `null` argument before the `options` argument. For
parameter, simply add a `null` argument before the `options` argument. For
example, `client.alter(options)` becomes `client.alter(null, options)`

## [v1.1.2] - 2018-03-07
Expand Down
13 changes: 13 additions & 0 deletions generate_proto.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

protoc \
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
--js_out=import_style=commonjs,binary:./generated/ \
--ts_out=service=true:./generated/ \
--proto_path=./protos/ api.proto

yarn grpc_tools_node_protoc \
--plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin \
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
--grpc_out=./generated/ \
--proto_path=./protos/ api.proto
7 changes: 7 additions & 0 deletions generated/api_grpc_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import * as grpc from "grpc";
import * as api_pb from "./api_pb";

export class DgraphClient extends grpc.Client {
public login(
request: api_pb.LoginRequest,
metadata: grpc.Metadata | null,
options: grpc.CallOptions | null,
callback: (err?: Error | null, res?: api_pb.Response) => void,
): void;

public alter(
operation: api_pb.Operation,
metadata: grpc.Metadata | null,
Expand Down
40 changes: 31 additions & 9 deletions generated/api_grpc_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function serialize_api_Assigned(arg) {
if (!(arg instanceof api_pb.Assigned)) {
throw new Error('Expected argument of type api.Assigned');
}
return new Buffer(arg.serializeBinary());
return Buffer.from(arg.serializeBinary());
}

function deserialize_api_Assigned(buffer_arg) {
Expand All @@ -35,18 +35,29 @@ function serialize_api_Check(arg) {
if (!(arg instanceof api_pb.Check)) {
throw new Error('Expected argument of type api.Check');
}
return new Buffer(arg.serializeBinary());
return Buffer.from(arg.serializeBinary());
}

function deserialize_api_Check(buffer_arg) {
return api_pb.Check.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_api_LoginRequest(arg) {
if (!(arg instanceof api_pb.LoginRequest)) {
throw new Error('Expected argument of type api.LoginRequest');
}
return Buffer.from(arg.serializeBinary());
}

function deserialize_api_LoginRequest(buffer_arg) {
return api_pb.LoginRequest.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_api_Mutation(arg) {
if (!(arg instanceof api_pb.Mutation)) {
throw new Error('Expected argument of type api.Mutation');
}
return new Buffer(arg.serializeBinary());
return Buffer.from(arg.serializeBinary());
}

function deserialize_api_Mutation(buffer_arg) {
Expand All @@ -57,7 +68,7 @@ function serialize_api_Operation(arg) {
if (!(arg instanceof api_pb.Operation)) {
throw new Error('Expected argument of type api.Operation');
}
return new Buffer(arg.serializeBinary());
return Buffer.from(arg.serializeBinary());
}

function deserialize_api_Operation(buffer_arg) {
Expand All @@ -68,7 +79,7 @@ function serialize_api_Payload(arg) {
if (!(arg instanceof api_pb.Payload)) {
throw new Error('Expected argument of type api.Payload');
}
return new Buffer(arg.serializeBinary());
return Buffer.from(arg.serializeBinary());
}

function deserialize_api_Payload(buffer_arg) {
Expand All @@ -79,7 +90,7 @@ function serialize_api_Request(arg) {
if (!(arg instanceof api_pb.Request)) {
throw new Error('Expected argument of type api.Request');
}
return new Buffer(arg.serializeBinary());
return Buffer.from(arg.serializeBinary());
}

function deserialize_api_Request(buffer_arg) {
Expand All @@ -90,7 +101,7 @@ function serialize_api_Response(arg) {
if (!(arg instanceof api_pb.Response)) {
throw new Error('Expected argument of type api.Response');
}
return new Buffer(arg.serializeBinary());
return Buffer.from(arg.serializeBinary());
}

function deserialize_api_Response(buffer_arg) {
Expand All @@ -101,7 +112,7 @@ function serialize_api_TxnContext(arg) {
if (!(arg instanceof api_pb.TxnContext)) {
throw new Error('Expected argument of type api.TxnContext');
}
return new Buffer(arg.serializeBinary());
return Buffer.from(arg.serializeBinary());
}

function deserialize_api_TxnContext(buffer_arg) {
Expand All @@ -112,7 +123,7 @@ function serialize_api_Version(arg) {
if (!(arg instanceof api_pb.Version)) {
throw new Error('Expected argument of type api.Version');
}
return new Buffer(arg.serializeBinary());
return Buffer.from(arg.serializeBinary());
}

function deserialize_api_Version(buffer_arg) {
Expand All @@ -122,6 +133,17 @@ function deserialize_api_Version(buffer_arg) {

// Graph response.
var DgraphService = exports.DgraphService = {
login: {
path: '/api.Dgraph/Login',
requestStream: false,
responseStream: false,
requestType: api_pb.LoginRequest,
responseType: api_pb.Response,
requestSerialize: serialize_api_LoginRequest,
requestDeserialize: deserialize_api_LoginRequest,
responseSerialize: serialize_api_Response,
responseDeserialize: deserialize_api_Response,
},
query: {
path: '/api.Dgraph/Query',
requestStream: false,
Expand Down
Loading

0 comments on commit 2156353

Please sign in to comment.