Skip to content
This repository was archived by the owner on Oct 9, 2023. It is now read-only.

Commit 65e537a

Browse files
authored
Supply authentication credentials for keyspace operations (#52)
## What is the goal of this PR? Recent changes in protocol (typedb/typedb-protocol#7) allow keyspace operations to be authenticated. This PR adapts Grakn Client NodeJS to these recent changes. ## What are the changes implemented in this PR? - `KeyspaceService.retrieve` and `KeyspaceService.delete` now properly set credentials - Bump `@graknlabs_protocol` and `@graknlabs_grakn_core` to latest version
1 parent aa7610e commit 65e537a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

dependencies/graknlabs/dependencies.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ def graknlabs_grakn_core():
2929
git_repository(
3030
name = "graknlabs_grakn_core",
3131
remote = "https://github.com/graknlabs/grakn",
32-
commit = "e68b03e886986846346a260346bd6743ab967f2e" # sync-marker: do not remove this comment, this is used for sync-dependencies by @graknlabs_grakn_core
32+
commit = "c92c602ff4d299ce7ccf688affcf18c41f840cb9" # sync-marker: do not remove this comment, this is used for sync-dependencies by @graknlabs_grakn_core
3333
)
3434

3535
def graknlabs_protocol():
3636
git_repository(
3737
name = "graknlabs_protocol",
3838
remote = "https://github.com/graknlabs/protocol",
39-
commit = "dbbea5ae6870dc0624658091c221fe9fc292bad1" # sync-marker: do not remove this comment, this is used for sync-dependencies by @graknlabs_protocol
39+
commit = "887409713c38deeebbdae01fa00946097887d20c" # sync-marker: do not remove this comment, this is used for sync-dependencies by @graknlabs_protocol
4040
)

src/service/Keyspace/KeyspaceService.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ function KeyspaceService(grpcClient, credentials) {
2626

2727
KeyspaceService.prototype.retrieve = function () {
2828
const retrieveRequest = new messages.Keyspace.Retrieve.Req();
29+
if (this.credentials) {
30+
retrieveRequest.setUsername(this.credentials.username);
31+
retrieveRequest.setPassword(this.credentials.password);
32+
}
2933
return new Promise((resolve, reject) => {
3034
this.client.retrieve(retrieveRequest, (err, resp) => {
3135
if (err) reject(err);
@@ -37,6 +41,10 @@ KeyspaceService.prototype.retrieve = function () {
3741
KeyspaceService.prototype.delete = function (keyspace) {
3842
const deleteRequest = new messages.Keyspace.Delete.Req();
3943
deleteRequest.setName(keyspace);
44+
if (this.credentials) {
45+
deleteRequest.setUsername(this.credentials.username);
46+
deleteRequest.setPassword(this.credentials.password);
47+
}
4048
return new Promise((resolve, reject) => {
4149
this.client.delete(deleteRequest, (err) => {
4250
if (err) reject(err);

0 commit comments

Comments
 (0)