From 9362522bc648477bfe00e7697563c2bb19f70971 Mon Sep 17 00:00:00 2001 From: Chengxuan Xing Date: Thu, 5 Jan 2023 21:16:21 +0000 Subject: [PATCH 1/3] add back namespace APIs Signed-off-by: Chengxuan Xing --- lib/firefly.ts | 13 +++++++++++++ lib/interfaces.ts | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/lib/firefly.ts b/lib/firefly.ts index 130b009..eb94f2f 100644 --- a/lib/firefly.ts +++ b/lib/firefly.ts @@ -70,6 +70,8 @@ import { FireFlyVerifierResolveRequest, FireFlyVerifierResolveResponse, FireFlyTokenApprovalRequest, + FireFlyNamespaceResponse, + FireFlyNamespacesResponse, } from './interfaces'; import { FireFlyWebSocket, FireFlyWebSocketCallback } from './websocket'; import HttpBase, { mapConfig } from './http'; @@ -130,6 +132,17 @@ export default class FireFly extends HttpBase { ); } + getNamespace( + name: string, + options?: FireFlyGetOptions, + ): Promise { + return this.getOne(`/namespaces/${name}`, undefined, options, true); + } + + getNamespaces(options?: FireFlyGetOptions): Promise { + return this.getMany('/namespaces', undefined, options, true); + } + getDatatypes( filter?: FireFlyDatatypeFilter, options?: FireFlyGetOptions, diff --git a/lib/interfaces.ts b/lib/interfaces.ts index 207b6e8..83ebc30 100644 --- a/lib/interfaces.ts +++ b/lib/interfaces.ts @@ -63,6 +63,14 @@ export interface FireFlyWebSocketOptions { heartbeatInterval: number; } +// Namespace +export type FireFlyNamespaceResponse = Required< + operations['getNamespace']['responses']['200']['content']['application/json'] +>; + +export type FireFlyNamespacesResponse = Required< +operations['getNamespaces']['responses']['200']['content']['application/json'] +>; // Network export type FireFlyIdentityFilter = operations['getIdentities']['parameters']['query']; From 3a824d71eda42dbead242403e219b97c4415b170 Mon Sep 17 00:00:00 2001 From: Chengxuan Xing Date: Thu, 5 Jan 2023 21:26:26 +0000 Subject: [PATCH 2/3] version bump Signed-off-by: Chengxuan Xing --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8939ae6..27a8ecd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperledger/firefly-sdk", - "version": "1.2.1", + "version": "1.2.2", "description": "Client SDK for Hyperledger FireFly", "main": "dist/index.js", "types": "dist/index.d.ts", From 00e597bbce7c5b3f39c7c8feb279dd62441a8067 Mon Sep 17 00:00:00 2001 From: Chengxuan Xing Date: Thu, 5 Jan 2023 22:17:41 +0000 Subject: [PATCH 3/3] address review comment Signed-off-by: Chengxuan Xing --- lib/firefly.ts | 5 ++--- lib/interfaces.ts | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/firefly.ts b/lib/firefly.ts index eb94f2f..1a2136e 100644 --- a/lib/firefly.ts +++ b/lib/firefly.ts @@ -71,7 +71,6 @@ import { FireFlyVerifierResolveResponse, FireFlyTokenApprovalRequest, FireFlyNamespaceResponse, - FireFlyNamespacesResponse, } from './interfaces'; import { FireFlyWebSocket, FireFlyWebSocketCallback } from './websocket'; import HttpBase, { mapConfig } from './http'; @@ -139,8 +138,8 @@ export default class FireFly extends HttpBase { return this.getOne(`/namespaces/${name}`, undefined, options, true); } - getNamespaces(options?: FireFlyGetOptions): Promise { - return this.getMany('/namespaces', undefined, options, true); + getNamespaces(options?: FireFlyGetOptions): Promise { + return this.getMany('/namespaces', undefined, options, true); } getDatatypes( diff --git a/lib/interfaces.ts b/lib/interfaces.ts index 83ebc30..ae68ceb 100644 --- a/lib/interfaces.ts +++ b/lib/interfaces.ts @@ -68,9 +68,6 @@ export type FireFlyNamespaceResponse = Required< operations['getNamespace']['responses']['200']['content']['application/json'] >; -export type FireFlyNamespacesResponse = Required< -operations['getNamespaces']['responses']['200']['content']['application/json'] ->; // Network export type FireFlyIdentityFilter = operations['getIdentities']['parameters']['query'];