@trap_stevo/filetide 0.0.68 → 0.0.70

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.
package/LICENSE.md CHANGED
@@ -30,7 +30,11 @@ Without the express written permission of the Licensor, Licensee shall not:
30
30
  2. Include the Package's source code or object code in any distributed software, service, or application.
31
31
  3. Use the Package to create a competing product or service that replicates the functionality of the Package.
32
32
  4. Make the Package publicly available, including uploading it to public repositories or including it in distributed software bundles.
33
- 5. Use the Package in any way that violates applicable laws, infringes on third-party rights, or breaches this agreement.
33
+ 5. Attempt to extract or analyze the functionality, structure, or behavior of the Package through runtime inspection, instrumentation, reflection, or behavioral analysis.
34
+ 6. Privately share, sublicense, or distribute the Package or any portion thereof, whether internally within an organization or externally to any third party, without written authorization.
35
+ 7. Remove, obscure, obfuscate, or alter any attribution, copyright notices, proprietary labels, or identifiers included in the Package.
36
+ 8. Re-upload, rename, fork, or redistribute the Package or any portion thereof on any registry, platform, or namespace other than that explicitly maintained by or authorized by the Licensor.
37
+ 9. Use the Package in any way that violates applicable laws, infringes on third-party rights, or breaches this agreement.
34
38
 
35
39
  ## 5. **Wrapper API Creation**
36
40
  Licensee is permitted to create and distribute Wrapper APIs, provided that:
@@ -69,5 +73,7 @@ Licensee agrees to indemnify and hold harmless the Licensor from any and all cla
69
73
  ## 10. **Governing Law and Dispute Resolution**
70
74
  This Agreement shall be governed by and construed in accordance with the laws of **the state of Georgia**, without regard to its conflict of law principles. Any disputes arising out of this Agreement shall be resolved through arbitration in **the state of Georgia**.
71
75
 
72
- ## 9. **Amendments**
76
+ ## 11. **Amendments**
73
77
  Licensor reserves the right to modify or update this Agreement at any time. Any changes to the Agreement will be effective **30 days** after being posted to **https://www.npmjs.com/package/@trap_stevo/filetide**. The Licensor will notify Licensees of any material changes by **posting a notice in the package’s release notes on NPM**. Continued use of the package after the notice period constitutes acceptance of the modified terms.
78
+
79
+ **This Agreement applies to all versions of @trap_stevo/filetide downloaded, installed, or used on or after the Effective Date of this license, regardless of version number.** Use of any version of the Package after this date shall be deemed acceptance of and agreement to the terms of this license, unless otherwise explicitly stated by the Licensor.
@@ -145,14 +145,14 @@ class FileMessager {
145
145
  if (!forward) {
146
146
  return;
147
147
  }
148
- async function handle() {
148
+ const handle = async () => {
149
149
  if (mode === "signal") {
150
150
  forward("rehydrate");
151
151
  return;
152
152
  }
153
153
  const result = await this.getTiderPresenceVisualData(visualDataConfigurations);
154
154
  forward(result);
155
- }
155
+ };
156
156
  tidalytics.events.on("metric:created:tider:offline", handle);
157
157
  tidalytics.events.on("metric:created:tider:online", handle);
158
158
  }
@@ -165,14 +165,14 @@ class FileMessager {
165
165
  if (!forward) {
166
166
  return;
167
167
  }
168
- async function handle() {
168
+ const handle = async () => {
169
169
  if (mode === "signal") {
170
170
  forward("rehydrate");
171
171
  return;
172
172
  }
173
173
  const result = await this.getAlreadyOnlineVisualData(visualDataConfigurations);
174
174
  forward(result);
175
- }
175
+ };
176
176
  tidalytics.events.on("metric:created:tider:already-online", handle);
177
177
  }
178
178
  attachTiderBanVisualStream(options = {}) {
@@ -184,14 +184,14 @@ class FileMessager {
184
184
  if (!forward) {
185
185
  return;
186
186
  }
187
- async function handle() {
187
+ const handle = async () => {
188
188
  if (mode === "signal") {
189
189
  forward("rehydrate");
190
190
  return;
191
191
  }
192
192
  const result = await this.getTiderBanVisualData(visualDataConfigurations);
193
193
  forward(result);
194
- }
194
+ };
195
195
  tidalytics.events.on("metric:created:tider:unbanned", handle);
196
196
  tidalytics.events.on("metric:created:tider:banned", handle);
197
197
  tidalytics.events.on("metric:created:tider:kicked", handle);
@@ -205,14 +205,14 @@ class FileMessager {
205
205
  if (!forward) {
206
206
  return;
207
207
  }
208
- async function handle() {
208
+ const handle = async () => {
209
209
  if (mode === "signal") {
210
210
  forward("rehydrate");
211
211
  return;
212
212
  }
213
213
  const result = await this.getTideFileTransferVisualData(visualDataConfigurations);
214
214
  forward(result);
215
- }
215
+ };
216
216
  tidalytics.events.on("metric:created:tide:completed-transfer", handle);
217
217
  tidalytics.events.on("metric:created:tide:incoming-transfer", handle);
218
218
  tidalytics.events.on("metric:created:tide:incoming-file", handle);
@@ -226,14 +226,14 @@ class FileMessager {
226
226
  if (!forward) {
227
227
  return;
228
228
  }
229
- async function handle() {
229
+ const handle = async () => {
230
230
  if (mode === "signal") {
231
231
  forward("rehydrate");
232
232
  return;
233
233
  }
234
234
  const result = await this.getTideTransferStateVisualData(visualDataConfigurations);
235
235
  forward(result);
236
- }
236
+ };
237
237
  tidalytics.events.on("metric:created:tide:transfer-state", handle);
238
238
  }
239
239
  attachFileListVisualStream(options = {}) {
@@ -245,14 +245,14 @@ class FileMessager {
245
245
  if (!forward) {
246
246
  return;
247
247
  }
248
- async function handle() {
248
+ const handle = async () => {
249
249
  if (mode === "signal") {
250
250
  forward("rehydrate");
251
251
  return;
252
252
  }
253
253
  const result = await this.getFileListVisualData(visualDataConfigurations);
254
254
  forward(result);
255
- }
255
+ };
256
256
  tidalytics.events.on("metric:created:file-list:received", handle);
257
257
  tidalytics.events.on("metric:created:file-list:request", handle);
258
258
  }
@@ -265,14 +265,14 @@ class FileMessager {
265
265
  if (!forward) {
266
266
  return;
267
267
  }
268
- async function handle() {
268
+ const handle = async () => {
269
269
  if (mode === "signal") {
270
270
  forward("rehydrate");
271
271
  return;
272
272
  }
273
273
  const result = await this.getTideBarrierVisualData(visualDataConfigurations);
274
274
  forward(result);
275
- }
275
+ };
276
276
  tidalytics.events.on("metric:created:tide-barrier:accepted", handle);
277
277
  tidalytics.events.on("metric:created:tide-barrier:denied", handle);
278
278
  }
@@ -1165,6 +1165,14 @@ class FileMessager {
1165
1165
  }
1166
1166
  return client;
1167
1167
  }
1168
+ getClient(clientID) {
1169
+ const client = FileNetClientManager.getOnlineClient(clientID);
1170
+ if (!client) {
1171
+ console.log(`Client ~ ${clientID} not found.`);
1172
+ return;
1173
+ }
1174
+ return client;
1175
+ }
1168
1176
  requestFromClient(requesterID, senderID, filePath = process.cwd(), destinationPath) {
1169
1177
  const senderConnectionID = FileNetClientManager.getOnlineClient(senderID).id;
1170
1178
  const client = this.getClientFromID(senderConnectionID);
@@ -16,6 +16,28 @@ function pickData(data, keys) {
16
16
  }, {});
17
17
  }
18
18
  ;
19
+ function parseSizeString(str) {
20
+ if (typeof str === "number") {
21
+ return str;
22
+ }
23
+ if (typeof str !== "string") {
24
+ return 0;
25
+ }
26
+ const units = {
27
+ B: 1,
28
+ KB: 1024,
29
+ MB: 1024 ** 2,
30
+ GB: 1024 ** 3,
31
+ TB: 1024 ** 4
32
+ };
33
+ const match = str.trim().toUpperCase().match(/^([\d.]+)\s*(B|KB|MB|GB|TB)$/);
34
+ if (!match) {
35
+ return 0;
36
+ }
37
+ const [, numStr, unit] = match;
38
+ return parseFloat(numStr) * units[unit];
39
+ }
40
+ ;
19
41
  function aggregateMultiAverageChartData(events, {
20
42
  groupBy = ["user"],
21
43
  valueKey = "metadata.fileSize",
@@ -38,7 +60,17 @@ function aggregateMultiAverageChartData(events, {
38
60
  return getNestedData(event, path) ?? "unknown";
39
61
  });
40
62
  const label = labelParts.join(" | ");
41
- const value = getNestedData(event, valueKey);
63
+ let rawValue = getNestedData(event, valueKey);
64
+ let value;
65
+ if (mode === "sum") {
66
+ if (valueKey.includes("speed") || valueKey.includes("fileSize")) {
67
+ value = parseSizeString(rawValue);
68
+ } else {
69
+ value = parseFloat(rawValue) || 0;
70
+ }
71
+ } else {
72
+ value = 1;
73
+ }
42
74
  if (typeof value !== "number") {
43
75
  continue;
44
76
  }
@@ -100,7 +132,17 @@ function aggregateChartData(events, {
100
132
  label = event[typeKey] || "other";
101
133
  }
102
134
  const type = event[typeKey] || "other";
103
- const value = mode === "sum" ? getNestedData(event, valueKey) || 0 : 1;
135
+ let rawValue = mode === "sum" ? getNestedData(event, valueKey) || 0 : 1;
136
+ let value;
137
+ if (mode === "sum") {
138
+ if (valueKey.includes("speed") || valueKey.includes("fileSize")) {
139
+ value = parseSizeString(rawValue);
140
+ } else {
141
+ value = parseFloat(rawValue) || 0;
142
+ }
143
+ } else {
144
+ value = 1;
145
+ }
104
146
  if (!buckets[type]) {
105
147
  buckets[type] = {
106
148
  previewFileNames: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trap_stevo/filetide",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
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": {
@@ -34,11 +34,11 @@
34
34
  "author": "Steven Compton",
35
35
  "license": "See License in LICENSE.md",
36
36
  "dependencies": {
37
- "@trap_stevo/iotide": "^0.0.43",
38
- "@trap_stevo/iotide-client": "^0.0.25",
39
- "@trap_stevo/legendarybuilderpronodejs-utilities": "^1.0.48",
40
- "@trap_stevo/metrictide": "^0.0.3",
41
- "@trap_stevo/timelyst": "^0.0.5",
37
+ "@trap_stevo/iotide": "^0.0.44",
38
+ "@trap_stevo/iotide-client": "^0.0.26",
39
+ "@trap_stevo/legendarybuilderpronodejs-utilities": "^1.0.49",
40
+ "@trap_stevo/metrictide": "^0.0.4",
41
+ "@trap_stevo/timelyst": "^0.0.6",
42
42
  "chalk": "^4.1.2",
43
43
  "readline": "^1.3.0"
44
44
  },