@dignetwork/dig-sdk 0.0.1-alpha.55 → 0.0.1-alpha.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,9 +14,9 @@ const credentialsUtils_1 = require("../utils/credentialsUtils");
14
14
  const https_1 = __importDefault(require("https"));
15
15
  const cli_progress_1 = __importDefault(require("cli-progress"));
16
16
  const colorette_1 = require("colorette"); // For colored output
17
- const ora_1 = __importDefault(require("ora")); // For spinners
18
17
  const config_1 = require("../utils/config");
19
18
  const hashUtils_1 = require("../utils/hashUtils");
19
+ const nanospinner_1 = require("nanospinner");
20
20
  class PropagationServer {
21
21
  constructor(storeId, ipAddress) {
22
22
  this.storeId = storeId;
@@ -52,7 +52,7 @@ class PropagationServer {
52
52
  * @returns {Promise<{ storeExists: boolean, rootHashExists: boolean }>} - An object indicating if the store and root hash exist.
53
53
  */
54
54
  async checkStoreExists(rootHash) {
55
- const spinner = (0, ora_1.default)(`Checking if store ${this.storeId} exists...`).start();
55
+ const spinner = (0, nanospinner_1.createSpinner)(`Checking if store ${this.storeId} exists...`).start();
56
56
  try {
57
57
  const config = {
58
58
  httpsAgent: this.createHttpsAgent(),
@@ -66,10 +66,10 @@ class PropagationServer {
66
66
  const storeExists = response.headers["x-store-exists"] === "true";
67
67
  const rootHashExists = response.headers["x-has-root-hash"] === "true";
68
68
  if (storeExists) {
69
- spinner.succeed((0, colorette_1.green)(`Store ${this.storeId} exists!`));
69
+ spinner.success({ text: (0, colorette_1.green)(`Store ${this.storeId} exists!`) });
70
70
  }
71
71
  else {
72
- spinner.fail((0, colorette_1.red)(`Store ${this.storeId} does not exist.`));
72
+ spinner.error({ text: (0, colorette_1.red)(`Store ${this.storeId} does not exist.`) });
73
73
  }
74
74
  if (rootHash) {
75
75
  if (rootHashExists) {
@@ -82,7 +82,7 @@ class PropagationServer {
82
82
  return { storeExists, rootHashExists };
83
83
  }
84
84
  catch (error) {
85
- spinner.fail((0, colorette_1.red)("Error checking if store exists:"));
85
+ spinner.error({ text: (0, colorette_1.red)("Error checking if store exists:") });
86
86
  console.error((0, colorette_1.red)(error));
87
87
  throw error;
88
88
  }
@@ -91,7 +91,7 @@ class PropagationServer {
91
91
  * Start an upload session by sending a POST request to the server.
92
92
  */
93
93
  async startUploadSession() {
94
- const spinner = (0, ora_1.default)(`Starting upload session for store ${this.storeId}...`).start();
94
+ const spinner = (0, nanospinner_1.createSpinner)(`Starting upload session for store ${this.storeId}...`).start();
95
95
  try {
96
96
  const config = {
97
97
  httpsAgent: this.createHttpsAgent(),
@@ -106,10 +106,12 @@ class PropagationServer {
106
106
  const url = `https://${this.ipAddress}:${PropagationServer.port}/upload/${this.storeId}`;
107
107
  const response = await axios_1.default.post(url, { publicKey: this.publicKey }, config);
108
108
  this.sessionId = response.data.sessionId;
109
- spinner.succeed((0, colorette_1.green)(`Upload session started for DataStore ${this.storeId} with session ID ${this.sessionId}`));
109
+ spinner.success({
110
+ text: (0, colorette_1.green)(`Upload session started for DataStore ${this.storeId} with session ID ${this.sessionId}`),
111
+ });
110
112
  }
111
113
  catch (error) {
112
- spinner.fail((0, colorette_1.red)("Error starting upload session:"));
114
+ spinner.error({ text: (0, colorette_1.red)("Error starting upload session:") });
113
115
  console.error((0, colorette_1.red)(error));
114
116
  throw error;
115
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dignetwork/dig-sdk",
3
- "version": "0.0.1-alpha.55",
3
+ "version": "0.0.1-alpha.56",
4
4
  "description": "",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -46,7 +46,6 @@
46
46
  "nanospinner": "^1.1.0",
47
47
  "nconf": "^0.12.1",
48
48
  "node-cache": "^5.1.2",
49
- "ora": "^8.1.0",
50
49
  "p-limit": "^6.1.0",
51
50
  "superagent": "^10.0.0",
52
51
  "unzipper": "^0.12.3"