diff --git a/packages/grid_client/src/clients/tf-grid/kvstore.ts b/packages/grid_client/src/clients/tf-grid/kvstore.ts index cddfb1b225..6110534f71 100644 --- a/packages/grid_client/src/clients/tf-grid/kvstore.ts +++ b/packages/grid_client/src/clients/tf-grid/kvstore.ts @@ -26,9 +26,9 @@ class TFKVStore extends KVStore { * If encryption is enabled, the value will be encrypted before storing. * * @param {KVStoreSetOptions & { encrypt?: boolean }} options - The options for setting the `key-value` pair. - * @returns {Promise>} - A promise that resolves once the `key-value` set extrinsic is created. + * @returns {Promise>} - A promise that resolves to the address of the connected account. */ - async set(options: KVStoreSetOptions & { encrypt?: boolean }): Promise> { + async set(options: KVStoreSetOptions & { encrypt?: boolean }): Promise> { if (options.encrypt === false) { return super.set({ key: options.key, value: options.value }); } @@ -69,11 +69,11 @@ class TFKVStore extends KVStore { * @returns {Promise} - A promise that resolves with an array of keys that were removed. */ async batchRemove(options: KVStoreBatchRemoveOptions): Promise { - const extrinsics: ExtrinsicResult[] = []; + const extrinsics: ExtrinsicResult[] = []; for (const key of options.keys) { extrinsics.push(await this.delete({ key })); } - await this.client.applyAllExtrinsics(extrinsics); + await this.client.applyAllExtrinsics(extrinsics); return options.keys; } diff --git a/packages/grid_client/src/modules/base.ts b/packages/grid_client/src/modules/base.ts index d5fd52eb03..97115d1291 100644 --- a/packages/grid_client/src/modules/base.ts +++ b/packages/grid_client/src/modules/base.ts @@ -919,7 +919,7 @@ class BaseModule { } /** - * Add a new [ZDB or K8S worker] to the deployment. + * Add a new [machine, ZDB, or K8S worker] to the deployment. * * @param deployment_name The name of the deployment. * @param node_id The ID of the node where the machine will be added. diff --git a/packages/grid_client/src/modules/kvstore.ts b/packages/grid_client/src/modules/kvstore.ts index 2c97c84ba0..4dfed8dc7b 100644 --- a/packages/grid_client/src/modules/kvstore.ts +++ b/packages/grid_client/src/modules/kvstore.ts @@ -1,5 +1,3 @@ -import { KVStoreSetOptions } from "@threefold/tfchain_client"; - import { TFClient } from "../clients/tf-grid/client"; import { GridClientConfig } from "../config"; import { expose } from "../helpers/expose"; @@ -39,7 +37,7 @@ class KVStore { @expose @validateInput @checkBalance - async set(options: KVStoreSetModel): Promise { + async set(options: KVStoreSetModel): Promise { return (await this.client.kvStore.set(options)).apply(); } @@ -92,7 +90,7 @@ class KVStore { @expose @validateInput @checkBalance - async remove(options: KVStoreRemoveModel): Promise { + async remove(options: KVStoreRemoveModel): Promise { return (await this.client.kvStore.delete(options)).apply(); } diff --git a/packages/grid_client/src/modules/stellar.ts b/packages/grid_client/src/modules/stellar.ts index d204942cee..dc48b5d60c 100644 --- a/packages/grid_client/src/modules/stellar.ts +++ b/packages/grid_client/src/modules/stellar.ts @@ -61,10 +61,10 @@ class Stellar implements blockchainInterface { /** * Saves the extrinsics to the `key-value` store backend if the backend storage type is `tfkvstore` and extrinsics are provided. * - * @param {any[]} extrinsics - The extrinsics to be saved to the `key-value` store backend. + * @param {ExtrinsicResult[]} extrinsics - The extrinsics to be saved to the `key-value` store backend. * @returns {Promise} - A promise that resolves once the extrinsics are saved to the backend. */ - private async saveIfKVStoreBackend(extrinsics: any[]) { + private async saveIfKVStoreBackend(extrinsics: ExtrinsicResult[]) { if (this.config.backendStorageType === BackendStorageType.tfkvstore && extrinsics && extrinsics.length > 0) { extrinsics = extrinsics.filter(e => e !== undefined); if (extrinsics.length > 0) { diff --git a/packages/grid_client/src/storage/BackendStorageInterface.ts b/packages/grid_client/src/storage/BackendStorageInterface.ts index 3fe9385e46..ca20f6ae46 100644 --- a/packages/grid_client/src/storage/BackendStorageInterface.ts +++ b/packages/grid_client/src/storage/BackendStorageInterface.ts @@ -14,7 +14,7 @@ interface BackendStorageInterface { list(key: string); // This method currently only implemented in tfkvstore - moveValue?(fromKey: string, toKey: string): Promise[]>; + moveValue?(fromKey: string, toKey: string): Promise[]>; } export default BackendStorageInterface; diff --git a/packages/grid_client/src/storage/tfkvstore.ts b/packages/grid_client/src/storage/tfkvstore.ts index 84dfa50eca..592031c70d 100644 --- a/packages/grid_client/src/storage/tfkvstore.ts +++ b/packages/grid_client/src/storage/tfkvstore.ts @@ -106,11 +106,11 @@ class TFKVStoreBackend implements BackendStorageInterface { return splits; } - public async moveValue(fromKey: string, toKey: string): Promise[]> { + public async moveValue(fromKey: string, toKey: string): Promise[]> { fromKey = cropKey(fromKey); toKey = cropKey(toKey); - const exts: ExtrinsicResult[] = []; + const exts: ExtrinsicResult[] = []; for (let i = 0; ; i++) { const key = i === 0 ? fromKey : fromKey + "." + i; diff --git a/packages/tfchain_client/src/kvstore.ts b/packages/tfchain_client/src/kvstore.ts index a50037221f..f0c5b61254 100644 --- a/packages/tfchain_client/src/kvstore.ts +++ b/packages/tfchain_client/src/kvstore.ts @@ -23,12 +23,12 @@ class KVStore { * It then patches the extrinsic and returns the options that were set. * * @param options - An object containing the key and value to be set in the `key-value` store. - * @returns {Promise>} A promise that resolves to the options that were set in the store. + * @returns {Promise>} A promise that resolves to the address of the connected account. */ @checkConnection - async set(options: KVStoreSetOptions): Promise> { + async set(options: KVStoreSetOptions): Promise> { const extrinsic = await this.client.api.tx.tfkvStore.set(options.key, options.value); - return this.client.patchExtrinsic(extrinsic); + return this.client.patchExtrinsic(extrinsic); } /** @@ -38,12 +38,12 @@ class KVStore { * It then patches the extrinsic and returns the result of the deletion operation. * * @param options - An object containing the key to be deleted from the `key-value` store. - * @returns {Promise>} A promise that resolves once the delete extrinsic is successfully created. + * @returns {Promise>} A promise that resolves to the address of the connected account. */ @checkConnection - async delete(options: KVStoreGetOptions): Promise> { + async delete(options: KVStoreGetOptions): Promise> { const extrinsic = await this.client.api.tx.tfkvStore.delete(options.key); - return this.client.patchExtrinsic(extrinsic); + return this.client.patchExtrinsic(extrinsic); } /** @@ -91,11 +91,11 @@ class KVStore { */ async deleteAll(): Promise { const keys: string[] = await this.list(); - const extrinsics: ExtrinsicResult[] = []; + const extrinsics: ExtrinsicResult[] = []; for (const key of keys) { extrinsics.push(await this.delete({ key })); } - await this.client.applyAllExtrinsics(extrinsics); + await this.client.applyAllExtrinsics(extrinsics); return keys; } }