@trap_stevo/filetide 0.0.90 → 0.0.92

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.
@@ -448,9 +448,11 @@ class FileTide {
448
448
  return true;
449
449
  }
450
450
  static outputGradient(text, colors, metadata = {}) {
451
+ const renderedText = FileTideDebugUtilityManager.gradientText(String(text ?? ""), colors);
451
452
  if (typeof FileTide.outputHandler === "function") {
452
453
  FileTide.outputHandler({
453
454
  text: String(text ?? ""),
455
+ renderedText,
454
456
  colors,
455
457
  type: "gradient",
456
458
  metadata: metadata || {}
@@ -458,7 +460,6 @@ class FileTide {
458
460
  return;
459
461
  }
460
462
  FileTideDebugUtilityManager.outputGradient(text, colors);
461
- return;
462
463
  }
463
464
  static displayFileTideLogo() {
464
465
  displayFileTideLogo();
@@ -744,9 +745,6 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
744
745
  client.clientTide.onEvent(userID, "transfer-complete", data => {
745
746
  const savePath = FileUtilityManager.getTidePath(path.join(data.filePath, data.fileName));
746
747
  try {
747
- if (displayTransferOutput) {
748
- _FileTide.outputGradient(`[${userID}] File transfer complete ~ ${data.fileName}`, significantMessageColors);
749
- }
750
748
  const transferState = FileTransferTrackingManager.getTransfer(data.fileName);
751
749
  FileTideDebugUtilityManager.log("notice", true, `Transfer state ~ ${data.fileName} active | ${transferState !== null && transferState !== undefined ? true : false}`);
752
750
  if (!transferState) {
@@ -754,11 +752,6 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
754
752
  }
755
753
  if (transferState.fileStream) {
756
754
  fileTransferReceiver.completeTransfer(data, (transferData, transfers, success, error) => {
757
- if (success && displayTransferOutput) {
758
- _FileTide.outputGradient(`[${userID}] File saved at ~ ${savePath}\n`, significantMessageColors);
759
- } else if (!success && displayTransferOutput) {
760
- _FileTide.outputGradient(`[${userID}] Did not save file at ~ ${savePath}\n\t${error}\n`, errorMessageColors);
761
- }
762
755
  const transferStats = success ? this.transferStatsManager.completeTransfer(data.transferId || data.fileName) : this.transferStatsManager.failTransfer(data.transferId || data.fileName);
763
756
  if (onTransferComplete) {
764
757
  onTransferComplete({
@@ -766,15 +759,17 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
766
759
  stats: transferStats
767
760
  }, FileTransferTrackingManager.activeTransfers, success);
768
761
  }
762
+ if (success && displayTransferOutput) {
763
+ _FileTide.outputGradient(`[${userID}] File saved at ~ ${savePath}\n`, significantMessageColors);
764
+ } else if (!success && displayTransferOutput) {
765
+ _FileTide.outputGradient(`[${userID}] Did not save file at ~ ${savePath}\n\t${error}\n`, errorMessageColors);
766
+ }
769
767
  FileTransferTrackingManager.outputCurrentTransfers();
770
768
  this.transferStatsManager.clearTransfer(data.transferId || data.fileName);
771
769
  });
772
770
  return;
773
771
  }
774
772
  FileTransferTrackingManager.untrackTransfer(data.fileName);
775
- if (displayTransferOutput) {
776
- _FileTide.outputGradient(`[${userID}] Transfer successfully sent to ~ ${data.recipientId} and saved at ~ ${path.join(data.filePath, data.fileName)}\n`, significantMessageColors);
777
- }
778
773
  const transferStats = this.transferStatsManager.completeTransfer(data.transferId || data.fileName);
779
774
  if (onTransferComplete) {
780
775
  onTransferComplete({
@@ -783,13 +778,11 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
783
778
  }, FileTransferTrackingManager.activeTransfers, true);
784
779
  }
785
780
  if (displayTransferOutput) {
781
+ _FileTide.outputGradient(`[${userID}] Transfer successfully sent to ~ ${data.recipientId} and saved at ~ ${path.join(data.filePath, data.fileName)}\n`, significantMessageColors);
786
782
  FileTransferTrackingManager.outputCurrentTransfers();
787
783
  }
788
784
  this.transferStatsManager.clearTransfer(data.transferId || data.fileName);
789
785
  } catch (error) {
790
- if (displayTransferOutput) {
791
- _FileTide.outputGradient(`[${userID}] Did not save file at ~ ${savePath}\n${error}`, errorMessageColors);
792
- }
793
786
  const transferStats = this.transferStatsManager.failTransfer(data.transferId || data.fileName);
794
787
  if (onTransferComplete) {
795
788
  onTransferComplete({
@@ -798,6 +791,7 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
798
791
  }, FileTransferTrackingManager.activeTransfers, false);
799
792
  }
800
793
  if (displayTransferOutput) {
794
+ _FileTide.outputGradient(`[${userID}] Did not save file at ~ ${savePath}\n${error}`, errorMessageColors);
801
795
  FileTransferTrackingManager.outputCurrentTransfers();
802
796
  }
803
797
  this.transferStatsManager.clearTransfer(data.transferId || data.fileName);
@@ -805,9 +799,6 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
805
799
  });
806
800
  client.clientTide.onEvent(userID, "transfer-failed", async data => {
807
801
  const transferState = FileTransferTrackingManager.getTransfer(data.fileName);
808
- if (displayTransferOutput) {
809
- _FileTide.outputGradient(`[${userID}] File transfer failed ~ ${data.fileName}${data.reason ? `\n${data.reason}` : ""}`, errorMessageColors);
810
- }
811
802
  if (transferState?.fileStream) {
812
803
  try {
813
804
  await new Promise(resolve => {
@@ -830,6 +821,7 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
830
821
  onTransferComplete(failureData, FileTransferTrackingManager.activeTransfers, false);
831
822
  }
832
823
  if (displayTransferOutput) {
824
+ _FileTide.outputGradient(`[${userID}] File transfer failed ~ ${data.fileName}${data.reason ? `\n${data.reason}` : ""}`, errorMessageColors);
833
825
  FileTransferTrackingManager.outputCurrentTransfers();
834
826
  }
835
827
  this.transferStatsManager.clearTransfer(data.transferId || data.fileName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trap_stevo/filetide",
3
- "version": "0.0.90",
3
+ "version": "0.0.92",
4
4
  "description": "Revolutionizing real-time file transfer with seamless, instant communication across any device. Deliver files instantly, regardless of platform, and experience unparalleled speed and control in managing transfers. Elevate your file-sharing capabilities with a tool designed for precision, efficiency, and effortless connectivity.",
5
5
  "main": "dist/cjs/FileTide.js",
6
6
  "scripts": {