@balancy/wasm 1.0.40 → 1.0.42
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/dist/Balancy.wasm +0 -0
- package/dist/index.cjs.js +1 -30
- package/dist/index.es.js +1 -30
- package/dist/index.umd.js +1 -30
- package/dist/node/index.cjs.js +1 -30
- package/dist/node/index.es.js +1 -30
- package/dist/node/index.umd.js +1 -30
- package/package.json +1 -1
package/dist/Balancy.wasm
CHANGED
|
Binary file
|
package/dist/index.cjs.js
CHANGED
|
@@ -1222,12 +1222,6 @@ var Balancy = function() {
|
|
|
1222
1222
|
console.error("[ERROR] [Request ".concat(requestId, "] URL contains invalid characters:"), urlString);
|
|
1223
1223
|
return;
|
|
1224
1224
|
}
|
|
1225
|
-
console.log("[START] [Request ".concat(requestId, "] Starting ").concat(bLoadFile ? "FILE LOAD" : "API REQUEST"));
|
|
1226
|
-
console.log(" URL: ".concat(urlString));
|
|
1227
|
-
console.log(" Method: ".concat(methodString));
|
|
1228
|
-
if (bodyString) {
|
|
1229
|
-
console.log(" Body: ".concat(bodyString.length > 200 ? bodyString.substring(0, 200) + "..." : bodyString));
|
|
1230
|
-
}
|
|
1231
1225
|
} catch (error) {
|
|
1232
1226
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading strings from WASM memory:"), error);
|
|
1233
1227
|
return;
|
|
@@ -1243,7 +1237,6 @@ var Balancy = function() {
|
|
|
1243
1237
|
}
|
|
1244
1238
|
try {
|
|
1245
1239
|
if (requestContextPtr) {
|
|
1246
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1247
1240
|
Module._free(requestContextPtr);
|
|
1248
1241
|
}
|
|
1249
1242
|
if (!errorCallbackPtr || !callbackPtr) {
|
|
@@ -1261,7 +1254,6 @@ var Balancy = function() {
|
|
|
1261
1254
|
console.error("[ERROR] [Request ".concat(requestId, "] Failed to allocate memory for error message"));
|
|
1262
1255
|
return;
|
|
1263
1256
|
}
|
|
1264
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(errorLength + 1, " bytes for error message at ").concat(errorPtr));
|
|
1265
1257
|
stringToUTF8(errorMessage, errorPtr, errorLength + 1);
|
|
1266
1258
|
if (typeof Module["dynCall_viii"] !== "function") {
|
|
1267
1259
|
console.error("[ERROR] [Request ".concat(requestId, "] dynCall_viii function not available"));
|
|
@@ -1270,7 +1262,6 @@ var Balancy = function() {
|
|
|
1270
1262
|
}
|
|
1271
1263
|
Module["dynCall_viii"](errorCallbackPtr, status, errorPtr, callbackPtr);
|
|
1272
1264
|
Module._free(errorPtr);
|
|
1273
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed error message memory at ").concat(errorPtr));
|
|
1274
1265
|
} catch (error) {
|
|
1275
1266
|
console.error("[ERROR] [Request ".concat(requestId, "] Error in error callback:"), error);
|
|
1276
1267
|
}
|
|
@@ -1295,9 +1286,6 @@ var Balancy = function() {
|
|
|
1295
1286
|
headersObj.append(key, value);
|
|
1296
1287
|
headersLogged.push("".concat(key, ": ").concat(value));
|
|
1297
1288
|
}
|
|
1298
|
-
if (headersLogged.length > 0) {
|
|
1299
|
-
console.log(" Headers: ".concat(headersLogged.join(", ")));
|
|
1300
|
-
}
|
|
1301
1289
|
} catch (error) {
|
|
1302
1290
|
console.error("[ERROR] [Request ".concat(requestId, "] Error processing headers:"), error);
|
|
1303
1291
|
invokeErrorCallback(-1, "Header processing error: " + error.message, "");
|
|
@@ -1310,8 +1298,7 @@ var Balancy = function() {
|
|
|
1310
1298
|
};
|
|
1311
1299
|
var startTime = performance.now();
|
|
1312
1300
|
fetch(urlString, fetchOptions).then(function(response) {
|
|
1313
|
-
|
|
1314
|
-
console.log("[TIMING] [Request ".concat(requestId, "] Fetch completed in ").concat(duration.toFixed(2), "ms"));
|
|
1301
|
+
performance.now() - startTime;
|
|
1315
1302
|
if (!response.ok) {
|
|
1316
1303
|
console.error("[ERROR] [Request ".concat(requestId, "] Response not OK, status: ").concat(response.status, " ").concat(response.statusText));
|
|
1317
1304
|
response.text().then(function(errorMessage) {
|
|
@@ -1323,9 +1310,7 @@ var Balancy = function() {
|
|
|
1323
1310
|
});
|
|
1324
1311
|
return;
|
|
1325
1312
|
}
|
|
1326
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Response OK, status: ").concat(response.status));
|
|
1327
1313
|
var contentType = response.headers.get("content-type") || "";
|
|
1328
|
-
console.log(" Content-Type: ".concat(contentType));
|
|
1329
1314
|
var binaryExtensions = [
|
|
1330
1315
|
".png",
|
|
1331
1316
|
".jpg",
|
|
@@ -1366,11 +1351,9 @@ var Balancy = function() {
|
|
|
1366
1351
|
return contentType.toLowerCase().includes(type);
|
|
1367
1352
|
});
|
|
1368
1353
|
var isBinary = contentType.includes("application/octet-stream") || hasBinaryExtension || !isTextMimeType && !contentType.includes("charset");
|
|
1369
|
-
console.log(" Detected as: ".concat(isBinary ? "BINARY" : "TEXT", " data"));
|
|
1370
1354
|
if (isBinary) {
|
|
1371
1355
|
response.arrayBuffer().then(function(arrayBuffer) {
|
|
1372
1356
|
var dataSize = arrayBuffer.byteLength;
|
|
1373
|
-
console.log("[DATA] [Request ".concat(requestId, "] Binary data received: ").concat(dataSize, " bytes"));
|
|
1374
1357
|
if (dataSize <= 0 || dataSize > 104857600) {
|
|
1375
1358
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid binary data size: ").concat(dataSize));
|
|
1376
1359
|
invokeErrorCallback(-1, "Invalid binary data size: ".concat(dataSize), "");
|
|
@@ -1382,7 +1365,6 @@ var Balancy = function() {
|
|
|
1382
1365
|
invokeErrorCallback(-1, "Memory allocation failed for binary data", "");
|
|
1383
1366
|
return;
|
|
1384
1367
|
}
|
|
1385
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataSize, " bytes for binary data at ").concat(dataPtr));
|
|
1386
1368
|
var dataView = new Uint8Array(arrayBuffer);
|
|
1387
1369
|
Module.HEAPU8.set(dataView, dataPtr);
|
|
1388
1370
|
try {
|
|
@@ -1397,9 +1379,7 @@ var Balancy = function() {
|
|
|
1397
1379
|
return;
|
|
1398
1380
|
}
|
|
1399
1381
|
Module["dynCall_viii"](binaryCallbackPtr, dataPtr, dataSize, callbackPtr);
|
|
1400
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Binary callback completed successfully"));
|
|
1401
1382
|
if (requestContextPtr) {
|
|
1402
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1403
1383
|
Module._free(requestContextPtr);
|
|
1404
1384
|
}
|
|
1405
1385
|
} catch (error) {
|
|
@@ -1407,7 +1387,6 @@ var Balancy = function() {
|
|
|
1407
1387
|
invokeErrorCallback(-1, "Binary callback error: " + error.message, "");
|
|
1408
1388
|
}
|
|
1409
1389
|
Module._free(dataPtr);
|
|
1410
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed binary data memory at ").concat(dataPtr));
|
|
1411
1390
|
}).catch(function(error) {
|
|
1412
1391
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading binary data:"), error);
|
|
1413
1392
|
invokeErrorCallback(-1, error.message, "Failed to read binary response");
|
|
@@ -1415,10 +1394,6 @@ var Balancy = function() {
|
|
|
1415
1394
|
} else {
|
|
1416
1395
|
response.text().then(function(data) {
|
|
1417
1396
|
var dataLength = lengthBytesUTF8(data);
|
|
1418
|
-
console.log("[DATA] [Request ".concat(requestId, "] Text data received: ").concat(dataLength, " bytes"));
|
|
1419
|
-
if (data.length > 0) {
|
|
1420
|
-
console.log(" Preview: ".concat(data.substring(0, 200)).concat(data.length > 200 ? "..." : ""));
|
|
1421
|
-
}
|
|
1422
1397
|
if (dataLength <= 0 || dataLength > 104857600) {
|
|
1423
1398
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid text data size: ").concat(dataLength));
|
|
1424
1399
|
invokeErrorCallback(-1, "Invalid text data size: ".concat(dataLength), "");
|
|
@@ -1430,7 +1405,6 @@ var Balancy = function() {
|
|
|
1430
1405
|
invokeErrorCallback(-1, "Memory allocation failed for text data", "");
|
|
1431
1406
|
return;
|
|
1432
1407
|
}
|
|
1433
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataLength + 1, " bytes for text data at ").concat(dataPtr));
|
|
1434
1408
|
try {
|
|
1435
1409
|
stringToUTF8(data, dataPtr, dataLength + 1);
|
|
1436
1410
|
if (!successCallbackPtr || !callbackPtr) {
|
|
@@ -1444,9 +1418,7 @@ var Balancy = function() {
|
|
|
1444
1418
|
return;
|
|
1445
1419
|
}
|
|
1446
1420
|
Module["dynCall_viii"](successCallbackPtr, dataPtr, dataLength, callbackPtr);
|
|
1447
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Text callback completed successfully"));
|
|
1448
1421
|
if (requestContextPtr) {
|
|
1449
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1450
1422
|
Module._free(requestContextPtr);
|
|
1451
1423
|
}
|
|
1452
1424
|
} catch (error) {
|
|
@@ -1454,7 +1426,6 @@ var Balancy = function() {
|
|
|
1454
1426
|
invokeErrorCallback(-1, "Text callback error: " + error.message, "");
|
|
1455
1427
|
}
|
|
1456
1428
|
Module._free(dataPtr);
|
|
1457
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed text data memory at ").concat(dataPtr));
|
|
1458
1429
|
}).catch(function(error) {
|
|
1459
1430
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading text data:"), error);
|
|
1460
1431
|
invokeErrorCallback(-1, error.message, "Failed to read text response");
|
package/dist/index.es.js
CHANGED
|
@@ -1217,12 +1217,6 @@ var Balancy = function() {
|
|
|
1217
1217
|
console.error("[ERROR] [Request ".concat(requestId, "] URL contains invalid characters:"), urlString);
|
|
1218
1218
|
return;
|
|
1219
1219
|
}
|
|
1220
|
-
console.log("[START] [Request ".concat(requestId, "] Starting ").concat(bLoadFile ? "FILE LOAD" : "API REQUEST"));
|
|
1221
|
-
console.log(" URL: ".concat(urlString));
|
|
1222
|
-
console.log(" Method: ".concat(methodString));
|
|
1223
|
-
if (bodyString) {
|
|
1224
|
-
console.log(" Body: ".concat(bodyString.length > 200 ? bodyString.substring(0, 200) + "..." : bodyString));
|
|
1225
|
-
}
|
|
1226
1220
|
} catch (error) {
|
|
1227
1221
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading strings from WASM memory:"), error);
|
|
1228
1222
|
return;
|
|
@@ -1238,7 +1232,6 @@ var Balancy = function() {
|
|
|
1238
1232
|
}
|
|
1239
1233
|
try {
|
|
1240
1234
|
if (requestContextPtr) {
|
|
1241
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1242
1235
|
Module._free(requestContextPtr);
|
|
1243
1236
|
}
|
|
1244
1237
|
if (!errorCallbackPtr || !callbackPtr) {
|
|
@@ -1256,7 +1249,6 @@ var Balancy = function() {
|
|
|
1256
1249
|
console.error("[ERROR] [Request ".concat(requestId, "] Failed to allocate memory for error message"));
|
|
1257
1250
|
return;
|
|
1258
1251
|
}
|
|
1259
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(errorLength + 1, " bytes for error message at ").concat(errorPtr));
|
|
1260
1252
|
stringToUTF8(errorMessage, errorPtr, errorLength + 1);
|
|
1261
1253
|
if (typeof Module["dynCall_viii"] !== "function") {
|
|
1262
1254
|
console.error("[ERROR] [Request ".concat(requestId, "] dynCall_viii function not available"));
|
|
@@ -1265,7 +1257,6 @@ var Balancy = function() {
|
|
|
1265
1257
|
}
|
|
1266
1258
|
Module["dynCall_viii"](errorCallbackPtr, status, errorPtr, callbackPtr);
|
|
1267
1259
|
Module._free(errorPtr);
|
|
1268
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed error message memory at ").concat(errorPtr));
|
|
1269
1260
|
} catch (error) {
|
|
1270
1261
|
console.error("[ERROR] [Request ".concat(requestId, "] Error in error callback:"), error);
|
|
1271
1262
|
}
|
|
@@ -1290,9 +1281,6 @@ var Balancy = function() {
|
|
|
1290
1281
|
headersObj.append(key, value);
|
|
1291
1282
|
headersLogged.push("".concat(key, ": ").concat(value));
|
|
1292
1283
|
}
|
|
1293
|
-
if (headersLogged.length > 0) {
|
|
1294
|
-
console.log(" Headers: ".concat(headersLogged.join(", ")));
|
|
1295
|
-
}
|
|
1296
1284
|
} catch (error) {
|
|
1297
1285
|
console.error("[ERROR] [Request ".concat(requestId, "] Error processing headers:"), error);
|
|
1298
1286
|
invokeErrorCallback(-1, "Header processing error: " + error.message, "");
|
|
@@ -1305,8 +1293,7 @@ var Balancy = function() {
|
|
|
1305
1293
|
};
|
|
1306
1294
|
var startTime = performance.now();
|
|
1307
1295
|
fetch(urlString, fetchOptions).then(function(response) {
|
|
1308
|
-
|
|
1309
|
-
console.log("[TIMING] [Request ".concat(requestId, "] Fetch completed in ").concat(duration.toFixed(2), "ms"));
|
|
1296
|
+
performance.now() - startTime;
|
|
1310
1297
|
if (!response.ok) {
|
|
1311
1298
|
console.error("[ERROR] [Request ".concat(requestId, "] Response not OK, status: ").concat(response.status, " ").concat(response.statusText));
|
|
1312
1299
|
response.text().then(function(errorMessage) {
|
|
@@ -1318,9 +1305,7 @@ var Balancy = function() {
|
|
|
1318
1305
|
});
|
|
1319
1306
|
return;
|
|
1320
1307
|
}
|
|
1321
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Response OK, status: ").concat(response.status));
|
|
1322
1308
|
var contentType = response.headers.get("content-type") || "";
|
|
1323
|
-
console.log(" Content-Type: ".concat(contentType));
|
|
1324
1309
|
var binaryExtensions = [
|
|
1325
1310
|
".png",
|
|
1326
1311
|
".jpg",
|
|
@@ -1361,11 +1346,9 @@ var Balancy = function() {
|
|
|
1361
1346
|
return contentType.toLowerCase().includes(type);
|
|
1362
1347
|
});
|
|
1363
1348
|
var isBinary = contentType.includes("application/octet-stream") || hasBinaryExtension || !isTextMimeType && !contentType.includes("charset");
|
|
1364
|
-
console.log(" Detected as: ".concat(isBinary ? "BINARY" : "TEXT", " data"));
|
|
1365
1349
|
if (isBinary) {
|
|
1366
1350
|
response.arrayBuffer().then(function(arrayBuffer) {
|
|
1367
1351
|
var dataSize = arrayBuffer.byteLength;
|
|
1368
|
-
console.log("[DATA] [Request ".concat(requestId, "] Binary data received: ").concat(dataSize, " bytes"));
|
|
1369
1352
|
if (dataSize <= 0 || dataSize > 104857600) {
|
|
1370
1353
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid binary data size: ").concat(dataSize));
|
|
1371
1354
|
invokeErrorCallback(-1, "Invalid binary data size: ".concat(dataSize), "");
|
|
@@ -1377,7 +1360,6 @@ var Balancy = function() {
|
|
|
1377
1360
|
invokeErrorCallback(-1, "Memory allocation failed for binary data", "");
|
|
1378
1361
|
return;
|
|
1379
1362
|
}
|
|
1380
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataSize, " bytes for binary data at ").concat(dataPtr));
|
|
1381
1363
|
var dataView = new Uint8Array(arrayBuffer);
|
|
1382
1364
|
Module.HEAPU8.set(dataView, dataPtr);
|
|
1383
1365
|
try {
|
|
@@ -1392,9 +1374,7 @@ var Balancy = function() {
|
|
|
1392
1374
|
return;
|
|
1393
1375
|
}
|
|
1394
1376
|
Module["dynCall_viii"](binaryCallbackPtr, dataPtr, dataSize, callbackPtr);
|
|
1395
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Binary callback completed successfully"));
|
|
1396
1377
|
if (requestContextPtr) {
|
|
1397
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1398
1378
|
Module._free(requestContextPtr);
|
|
1399
1379
|
}
|
|
1400
1380
|
} catch (error) {
|
|
@@ -1402,7 +1382,6 @@ var Balancy = function() {
|
|
|
1402
1382
|
invokeErrorCallback(-1, "Binary callback error: " + error.message, "");
|
|
1403
1383
|
}
|
|
1404
1384
|
Module._free(dataPtr);
|
|
1405
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed binary data memory at ").concat(dataPtr));
|
|
1406
1385
|
}).catch(function(error) {
|
|
1407
1386
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading binary data:"), error);
|
|
1408
1387
|
invokeErrorCallback(-1, error.message, "Failed to read binary response");
|
|
@@ -1410,10 +1389,6 @@ var Balancy = function() {
|
|
|
1410
1389
|
} else {
|
|
1411
1390
|
response.text().then(function(data) {
|
|
1412
1391
|
var dataLength = lengthBytesUTF8(data);
|
|
1413
|
-
console.log("[DATA] [Request ".concat(requestId, "] Text data received: ").concat(dataLength, " bytes"));
|
|
1414
|
-
if (data.length > 0) {
|
|
1415
|
-
console.log(" Preview: ".concat(data.substring(0, 200)).concat(data.length > 200 ? "..." : ""));
|
|
1416
|
-
}
|
|
1417
1392
|
if (dataLength <= 0 || dataLength > 104857600) {
|
|
1418
1393
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid text data size: ").concat(dataLength));
|
|
1419
1394
|
invokeErrorCallback(-1, "Invalid text data size: ".concat(dataLength), "");
|
|
@@ -1425,7 +1400,6 @@ var Balancy = function() {
|
|
|
1425
1400
|
invokeErrorCallback(-1, "Memory allocation failed for text data", "");
|
|
1426
1401
|
return;
|
|
1427
1402
|
}
|
|
1428
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataLength + 1, " bytes for text data at ").concat(dataPtr));
|
|
1429
1403
|
try {
|
|
1430
1404
|
stringToUTF8(data, dataPtr, dataLength + 1);
|
|
1431
1405
|
if (!successCallbackPtr || !callbackPtr) {
|
|
@@ -1439,9 +1413,7 @@ var Balancy = function() {
|
|
|
1439
1413
|
return;
|
|
1440
1414
|
}
|
|
1441
1415
|
Module["dynCall_viii"](successCallbackPtr, dataPtr, dataLength, callbackPtr);
|
|
1442
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Text callback completed successfully"));
|
|
1443
1416
|
if (requestContextPtr) {
|
|
1444
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1445
1417
|
Module._free(requestContextPtr);
|
|
1446
1418
|
}
|
|
1447
1419
|
} catch (error) {
|
|
@@ -1449,7 +1421,6 @@ var Balancy = function() {
|
|
|
1449
1421
|
invokeErrorCallback(-1, "Text callback error: " + error.message, "");
|
|
1450
1422
|
}
|
|
1451
1423
|
Module._free(dataPtr);
|
|
1452
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed text data memory at ").concat(dataPtr));
|
|
1453
1424
|
}).catch(function(error) {
|
|
1454
1425
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading text data:"), error);
|
|
1455
1426
|
invokeErrorCallback(-1, error.message, "Failed to read text response");
|
package/dist/index.umd.js
CHANGED
|
@@ -1224,12 +1224,6 @@
|
|
|
1224
1224
|
console.error("[ERROR] [Request ".concat(requestId, "] URL contains invalid characters:"), urlString);
|
|
1225
1225
|
return;
|
|
1226
1226
|
}
|
|
1227
|
-
console.log("[START] [Request ".concat(requestId, "] Starting ").concat(bLoadFile ? "FILE LOAD" : "API REQUEST"));
|
|
1228
|
-
console.log(" URL: ".concat(urlString));
|
|
1229
|
-
console.log(" Method: ".concat(methodString));
|
|
1230
|
-
if (bodyString) {
|
|
1231
|
-
console.log(" Body: ".concat(bodyString.length > 200 ? bodyString.substring(0, 200) + "..." : bodyString));
|
|
1232
|
-
}
|
|
1233
1227
|
} catch (error) {
|
|
1234
1228
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading strings from WASM memory:"), error);
|
|
1235
1229
|
return;
|
|
@@ -1245,7 +1239,6 @@
|
|
|
1245
1239
|
}
|
|
1246
1240
|
try {
|
|
1247
1241
|
if (requestContextPtr) {
|
|
1248
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1249
1242
|
Module._free(requestContextPtr);
|
|
1250
1243
|
}
|
|
1251
1244
|
if (!errorCallbackPtr || !callbackPtr) {
|
|
@@ -1263,7 +1256,6 @@
|
|
|
1263
1256
|
console.error("[ERROR] [Request ".concat(requestId, "] Failed to allocate memory for error message"));
|
|
1264
1257
|
return;
|
|
1265
1258
|
}
|
|
1266
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(errorLength + 1, " bytes for error message at ").concat(errorPtr));
|
|
1267
1259
|
stringToUTF8(errorMessage, errorPtr, errorLength + 1);
|
|
1268
1260
|
if (typeof Module["dynCall_viii"] !== "function") {
|
|
1269
1261
|
console.error("[ERROR] [Request ".concat(requestId, "] dynCall_viii function not available"));
|
|
@@ -1272,7 +1264,6 @@
|
|
|
1272
1264
|
}
|
|
1273
1265
|
Module["dynCall_viii"](errorCallbackPtr, status, errorPtr, callbackPtr);
|
|
1274
1266
|
Module._free(errorPtr);
|
|
1275
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed error message memory at ").concat(errorPtr));
|
|
1276
1267
|
} catch (error) {
|
|
1277
1268
|
console.error("[ERROR] [Request ".concat(requestId, "] Error in error callback:"), error);
|
|
1278
1269
|
}
|
|
@@ -1297,9 +1288,6 @@
|
|
|
1297
1288
|
headersObj.append(key, value);
|
|
1298
1289
|
headersLogged.push("".concat(key, ": ").concat(value));
|
|
1299
1290
|
}
|
|
1300
|
-
if (headersLogged.length > 0) {
|
|
1301
|
-
console.log(" Headers: ".concat(headersLogged.join(", ")));
|
|
1302
|
-
}
|
|
1303
1291
|
} catch (error) {
|
|
1304
1292
|
console.error("[ERROR] [Request ".concat(requestId, "] Error processing headers:"), error);
|
|
1305
1293
|
invokeErrorCallback(-1, "Header processing error: " + error.message, "");
|
|
@@ -1312,8 +1300,7 @@
|
|
|
1312
1300
|
};
|
|
1313
1301
|
var startTime = performance.now();
|
|
1314
1302
|
fetch(urlString, fetchOptions).then(function(response) {
|
|
1315
|
-
|
|
1316
|
-
console.log("[TIMING] [Request ".concat(requestId, "] Fetch completed in ").concat(duration.toFixed(2), "ms"));
|
|
1303
|
+
performance.now() - startTime;
|
|
1317
1304
|
if (!response.ok) {
|
|
1318
1305
|
console.error("[ERROR] [Request ".concat(requestId, "] Response not OK, status: ").concat(response.status, " ").concat(response.statusText));
|
|
1319
1306
|
response.text().then(function(errorMessage) {
|
|
@@ -1325,9 +1312,7 @@
|
|
|
1325
1312
|
});
|
|
1326
1313
|
return;
|
|
1327
1314
|
}
|
|
1328
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Response OK, status: ").concat(response.status));
|
|
1329
1315
|
var contentType = response.headers.get("content-type") || "";
|
|
1330
|
-
console.log(" Content-Type: ".concat(contentType));
|
|
1331
1316
|
var binaryExtensions = [
|
|
1332
1317
|
".png",
|
|
1333
1318
|
".jpg",
|
|
@@ -1368,11 +1353,9 @@
|
|
|
1368
1353
|
return contentType.toLowerCase().includes(type);
|
|
1369
1354
|
});
|
|
1370
1355
|
var isBinary = contentType.includes("application/octet-stream") || hasBinaryExtension || !isTextMimeType && !contentType.includes("charset");
|
|
1371
|
-
console.log(" Detected as: ".concat(isBinary ? "BINARY" : "TEXT", " data"));
|
|
1372
1356
|
if (isBinary) {
|
|
1373
1357
|
response.arrayBuffer().then(function(arrayBuffer) {
|
|
1374
1358
|
var dataSize = arrayBuffer.byteLength;
|
|
1375
|
-
console.log("[DATA] [Request ".concat(requestId, "] Binary data received: ").concat(dataSize, " bytes"));
|
|
1376
1359
|
if (dataSize <= 0 || dataSize > 104857600) {
|
|
1377
1360
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid binary data size: ").concat(dataSize));
|
|
1378
1361
|
invokeErrorCallback(-1, "Invalid binary data size: ".concat(dataSize), "");
|
|
@@ -1384,7 +1367,6 @@
|
|
|
1384
1367
|
invokeErrorCallback(-1, "Memory allocation failed for binary data", "");
|
|
1385
1368
|
return;
|
|
1386
1369
|
}
|
|
1387
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataSize, " bytes for binary data at ").concat(dataPtr));
|
|
1388
1370
|
var dataView = new Uint8Array(arrayBuffer);
|
|
1389
1371
|
Module.HEAPU8.set(dataView, dataPtr);
|
|
1390
1372
|
try {
|
|
@@ -1399,9 +1381,7 @@
|
|
|
1399
1381
|
return;
|
|
1400
1382
|
}
|
|
1401
1383
|
Module["dynCall_viii"](binaryCallbackPtr, dataPtr, dataSize, callbackPtr);
|
|
1402
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Binary callback completed successfully"));
|
|
1403
1384
|
if (requestContextPtr) {
|
|
1404
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1405
1385
|
Module._free(requestContextPtr);
|
|
1406
1386
|
}
|
|
1407
1387
|
} catch (error) {
|
|
@@ -1409,7 +1389,6 @@
|
|
|
1409
1389
|
invokeErrorCallback(-1, "Binary callback error: " + error.message, "");
|
|
1410
1390
|
}
|
|
1411
1391
|
Module._free(dataPtr);
|
|
1412
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed binary data memory at ").concat(dataPtr));
|
|
1413
1392
|
}).catch(function(error) {
|
|
1414
1393
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading binary data:"), error);
|
|
1415
1394
|
invokeErrorCallback(-1, error.message, "Failed to read binary response");
|
|
@@ -1417,10 +1396,6 @@
|
|
|
1417
1396
|
} else {
|
|
1418
1397
|
response.text().then(function(data) {
|
|
1419
1398
|
var dataLength = lengthBytesUTF8(data);
|
|
1420
|
-
console.log("[DATA] [Request ".concat(requestId, "] Text data received: ").concat(dataLength, " bytes"));
|
|
1421
|
-
if (data.length > 0) {
|
|
1422
|
-
console.log(" Preview: ".concat(data.substring(0, 200)).concat(data.length > 200 ? "..." : ""));
|
|
1423
|
-
}
|
|
1424
1399
|
if (dataLength <= 0 || dataLength > 104857600) {
|
|
1425
1400
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid text data size: ").concat(dataLength));
|
|
1426
1401
|
invokeErrorCallback(-1, "Invalid text data size: ".concat(dataLength), "");
|
|
@@ -1432,7 +1407,6 @@
|
|
|
1432
1407
|
invokeErrorCallback(-1, "Memory allocation failed for text data", "");
|
|
1433
1408
|
return;
|
|
1434
1409
|
}
|
|
1435
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataLength + 1, " bytes for text data at ").concat(dataPtr));
|
|
1436
1410
|
try {
|
|
1437
1411
|
stringToUTF8(data, dataPtr, dataLength + 1);
|
|
1438
1412
|
if (!successCallbackPtr || !callbackPtr) {
|
|
@@ -1446,9 +1420,7 @@
|
|
|
1446
1420
|
return;
|
|
1447
1421
|
}
|
|
1448
1422
|
Module["dynCall_viii"](successCallbackPtr, dataPtr, dataLength, callbackPtr);
|
|
1449
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Text callback completed successfully"));
|
|
1450
1423
|
if (requestContextPtr) {
|
|
1451
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1452
1424
|
Module._free(requestContextPtr);
|
|
1453
1425
|
}
|
|
1454
1426
|
} catch (error) {
|
|
@@ -1456,7 +1428,6 @@
|
|
|
1456
1428
|
invokeErrorCallback(-1, "Text callback error: " + error.message, "");
|
|
1457
1429
|
}
|
|
1458
1430
|
Module._free(dataPtr);
|
|
1459
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed text data memory at ").concat(dataPtr));
|
|
1460
1431
|
}).catch(function(error) {
|
|
1461
1432
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading text data:"), error);
|
|
1462
1433
|
invokeErrorCallback(-1, error.message, "Failed to read text response");
|
package/dist/node/index.cjs.js
CHANGED
|
@@ -1230,12 +1230,6 @@ var Balancy = function() {
|
|
|
1230
1230
|
console.error("[ERROR] [Request ".concat(requestId, "] URL contains invalid characters:"), urlString);
|
|
1231
1231
|
return;
|
|
1232
1232
|
}
|
|
1233
|
-
console.log("[START] [Request ".concat(requestId, "] Starting ").concat(bLoadFile ? "FILE LOAD" : "API REQUEST"));
|
|
1234
|
-
console.log(" URL: ".concat(urlString));
|
|
1235
|
-
console.log(" Method: ".concat(methodString));
|
|
1236
|
-
if (bodyString) {
|
|
1237
|
-
console.log(" Body: ".concat(bodyString.length > 200 ? bodyString.substring(0, 200) + "..." : bodyString));
|
|
1238
|
-
}
|
|
1239
1233
|
} catch (error) {
|
|
1240
1234
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading strings from WASM memory:"), error);
|
|
1241
1235
|
return;
|
|
@@ -1251,7 +1245,6 @@ var Balancy = function() {
|
|
|
1251
1245
|
}
|
|
1252
1246
|
try {
|
|
1253
1247
|
if (requestContextPtr) {
|
|
1254
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1255
1248
|
Module._free(requestContextPtr);
|
|
1256
1249
|
}
|
|
1257
1250
|
if (!errorCallbackPtr || !callbackPtr) {
|
|
@@ -1269,7 +1262,6 @@ var Balancy = function() {
|
|
|
1269
1262
|
console.error("[ERROR] [Request ".concat(requestId, "] Failed to allocate memory for error message"));
|
|
1270
1263
|
return;
|
|
1271
1264
|
}
|
|
1272
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(errorLength + 1, " bytes for error message at ").concat(errorPtr));
|
|
1273
1265
|
stringToUTF8(errorMessage, errorPtr, errorLength + 1);
|
|
1274
1266
|
if (typeof Module["dynCall_viii"] !== "function") {
|
|
1275
1267
|
console.error("[ERROR] [Request ".concat(requestId, "] dynCall_viii function not available"));
|
|
@@ -1278,7 +1270,6 @@ var Balancy = function() {
|
|
|
1278
1270
|
}
|
|
1279
1271
|
Module["dynCall_viii"](errorCallbackPtr, status, errorPtr, callbackPtr);
|
|
1280
1272
|
Module._free(errorPtr);
|
|
1281
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed error message memory at ").concat(errorPtr));
|
|
1282
1273
|
} catch (error) {
|
|
1283
1274
|
console.error("[ERROR] [Request ".concat(requestId, "] Error in error callback:"), error);
|
|
1284
1275
|
}
|
|
@@ -1303,9 +1294,6 @@ var Balancy = function() {
|
|
|
1303
1294
|
headersObj.append(key, value);
|
|
1304
1295
|
headersLogged.push("".concat(key, ": ").concat(value));
|
|
1305
1296
|
}
|
|
1306
|
-
if (headersLogged.length > 0) {
|
|
1307
|
-
console.log(" Headers: ".concat(headersLogged.join(", ")));
|
|
1308
|
-
}
|
|
1309
1297
|
} catch (error) {
|
|
1310
1298
|
console.error("[ERROR] [Request ".concat(requestId, "] Error processing headers:"), error);
|
|
1311
1299
|
invokeErrorCallback(-1, "Header processing error: " + error.message, "");
|
|
@@ -1318,8 +1306,7 @@ var Balancy = function() {
|
|
|
1318
1306
|
};
|
|
1319
1307
|
var startTime = performance.now();
|
|
1320
1308
|
fetch(urlString, fetchOptions).then(function(response) {
|
|
1321
|
-
|
|
1322
|
-
console.log("[TIMING] [Request ".concat(requestId, "] Fetch completed in ").concat(duration.toFixed(2), "ms"));
|
|
1309
|
+
performance.now() - startTime;
|
|
1323
1310
|
if (!response.ok) {
|
|
1324
1311
|
console.error("[ERROR] [Request ".concat(requestId, "] Response not OK, status: ").concat(response.status, " ").concat(response.statusText));
|
|
1325
1312
|
response.text().then(function(errorMessage) {
|
|
@@ -1331,9 +1318,7 @@ var Balancy = function() {
|
|
|
1331
1318
|
});
|
|
1332
1319
|
return;
|
|
1333
1320
|
}
|
|
1334
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Response OK, status: ").concat(response.status));
|
|
1335
1321
|
var contentType = response.headers.get("content-type") || "";
|
|
1336
|
-
console.log(" Content-Type: ".concat(contentType));
|
|
1337
1322
|
var binaryExtensions = [
|
|
1338
1323
|
".png",
|
|
1339
1324
|
".jpg",
|
|
@@ -1374,11 +1359,9 @@ var Balancy = function() {
|
|
|
1374
1359
|
return contentType.toLowerCase().includes(type);
|
|
1375
1360
|
});
|
|
1376
1361
|
var isBinary = contentType.includes("application/octet-stream") || hasBinaryExtension || !isTextMimeType && !contentType.includes("charset");
|
|
1377
|
-
console.log(" Detected as: ".concat(isBinary ? "BINARY" : "TEXT", " data"));
|
|
1378
1362
|
if (isBinary) {
|
|
1379
1363
|
response.arrayBuffer().then(function(arrayBuffer) {
|
|
1380
1364
|
var dataSize = arrayBuffer.byteLength;
|
|
1381
|
-
console.log("[DATA] [Request ".concat(requestId, "] Binary data received: ").concat(dataSize, " bytes"));
|
|
1382
1365
|
if (dataSize <= 0 || dataSize > 104857600) {
|
|
1383
1366
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid binary data size: ").concat(dataSize));
|
|
1384
1367
|
invokeErrorCallback(-1, "Invalid binary data size: ".concat(dataSize), "");
|
|
@@ -1390,7 +1373,6 @@ var Balancy = function() {
|
|
|
1390
1373
|
invokeErrorCallback(-1, "Memory allocation failed for binary data", "");
|
|
1391
1374
|
return;
|
|
1392
1375
|
}
|
|
1393
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataSize, " bytes for binary data at ").concat(dataPtr));
|
|
1394
1376
|
var dataView = new Uint8Array(arrayBuffer);
|
|
1395
1377
|
Module.HEAPU8.set(dataView, dataPtr);
|
|
1396
1378
|
try {
|
|
@@ -1405,9 +1387,7 @@ var Balancy = function() {
|
|
|
1405
1387
|
return;
|
|
1406
1388
|
}
|
|
1407
1389
|
Module["dynCall_viii"](binaryCallbackPtr, dataPtr, dataSize, callbackPtr);
|
|
1408
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Binary callback completed successfully"));
|
|
1409
1390
|
if (requestContextPtr) {
|
|
1410
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1411
1391
|
Module._free(requestContextPtr);
|
|
1412
1392
|
}
|
|
1413
1393
|
} catch (error) {
|
|
@@ -1415,7 +1395,6 @@ var Balancy = function() {
|
|
|
1415
1395
|
invokeErrorCallback(-1, "Binary callback error: " + error.message, "");
|
|
1416
1396
|
}
|
|
1417
1397
|
Module._free(dataPtr);
|
|
1418
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed binary data memory at ").concat(dataPtr));
|
|
1419
1398
|
}).catch(function(error) {
|
|
1420
1399
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading binary data:"), error);
|
|
1421
1400
|
invokeErrorCallback(-1, error.message, "Failed to read binary response");
|
|
@@ -1423,10 +1402,6 @@ var Balancy = function() {
|
|
|
1423
1402
|
} else {
|
|
1424
1403
|
response.text().then(function(data) {
|
|
1425
1404
|
var dataLength = lengthBytesUTF8(data);
|
|
1426
|
-
console.log("[DATA] [Request ".concat(requestId, "] Text data received: ").concat(dataLength, " bytes"));
|
|
1427
|
-
if (data.length > 0) {
|
|
1428
|
-
console.log(" Preview: ".concat(data.substring(0, 200)).concat(data.length > 200 ? "..." : ""));
|
|
1429
|
-
}
|
|
1430
1405
|
if (dataLength <= 0 || dataLength > 104857600) {
|
|
1431
1406
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid text data size: ").concat(dataLength));
|
|
1432
1407
|
invokeErrorCallback(-1, "Invalid text data size: ".concat(dataLength), "");
|
|
@@ -1438,7 +1413,6 @@ var Balancy = function() {
|
|
|
1438
1413
|
invokeErrorCallback(-1, "Memory allocation failed for text data", "");
|
|
1439
1414
|
return;
|
|
1440
1415
|
}
|
|
1441
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataLength + 1, " bytes for text data at ").concat(dataPtr));
|
|
1442
1416
|
try {
|
|
1443
1417
|
stringToUTF8(data, dataPtr, dataLength + 1);
|
|
1444
1418
|
if (!successCallbackPtr || !callbackPtr) {
|
|
@@ -1452,9 +1426,7 @@ var Balancy = function() {
|
|
|
1452
1426
|
return;
|
|
1453
1427
|
}
|
|
1454
1428
|
Module["dynCall_viii"](successCallbackPtr, dataPtr, dataLength, callbackPtr);
|
|
1455
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Text callback completed successfully"));
|
|
1456
1429
|
if (requestContextPtr) {
|
|
1457
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1458
1430
|
Module._free(requestContextPtr);
|
|
1459
1431
|
}
|
|
1460
1432
|
} catch (error) {
|
|
@@ -1462,7 +1434,6 @@ var Balancy = function() {
|
|
|
1462
1434
|
invokeErrorCallback(-1, "Text callback error: " + error.message, "");
|
|
1463
1435
|
}
|
|
1464
1436
|
Module._free(dataPtr);
|
|
1465
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed text data memory at ").concat(dataPtr));
|
|
1466
1437
|
}).catch(function(error) {
|
|
1467
1438
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading text data:"), error);
|
|
1468
1439
|
invokeErrorCallback(-1, error.message, "Failed to read text response");
|
package/dist/node/index.es.js
CHANGED
|
@@ -1225,12 +1225,6 @@ var Balancy = function() {
|
|
|
1225
1225
|
console.error("[ERROR] [Request ".concat(requestId, "] URL contains invalid characters:"), urlString);
|
|
1226
1226
|
return;
|
|
1227
1227
|
}
|
|
1228
|
-
console.log("[START] [Request ".concat(requestId, "] Starting ").concat(bLoadFile ? "FILE LOAD" : "API REQUEST"));
|
|
1229
|
-
console.log(" URL: ".concat(urlString));
|
|
1230
|
-
console.log(" Method: ".concat(methodString));
|
|
1231
|
-
if (bodyString) {
|
|
1232
|
-
console.log(" Body: ".concat(bodyString.length > 200 ? bodyString.substring(0, 200) + "..." : bodyString));
|
|
1233
|
-
}
|
|
1234
1228
|
} catch (error) {
|
|
1235
1229
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading strings from WASM memory:"), error);
|
|
1236
1230
|
return;
|
|
@@ -1246,7 +1240,6 @@ var Balancy = function() {
|
|
|
1246
1240
|
}
|
|
1247
1241
|
try {
|
|
1248
1242
|
if (requestContextPtr) {
|
|
1249
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1250
1243
|
Module._free(requestContextPtr);
|
|
1251
1244
|
}
|
|
1252
1245
|
if (!errorCallbackPtr || !callbackPtr) {
|
|
@@ -1264,7 +1257,6 @@ var Balancy = function() {
|
|
|
1264
1257
|
console.error("[ERROR] [Request ".concat(requestId, "] Failed to allocate memory for error message"));
|
|
1265
1258
|
return;
|
|
1266
1259
|
}
|
|
1267
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(errorLength + 1, " bytes for error message at ").concat(errorPtr));
|
|
1268
1260
|
stringToUTF8(errorMessage, errorPtr, errorLength + 1);
|
|
1269
1261
|
if (typeof Module["dynCall_viii"] !== "function") {
|
|
1270
1262
|
console.error("[ERROR] [Request ".concat(requestId, "] dynCall_viii function not available"));
|
|
@@ -1273,7 +1265,6 @@ var Balancy = function() {
|
|
|
1273
1265
|
}
|
|
1274
1266
|
Module["dynCall_viii"](errorCallbackPtr, status, errorPtr, callbackPtr);
|
|
1275
1267
|
Module._free(errorPtr);
|
|
1276
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed error message memory at ").concat(errorPtr));
|
|
1277
1268
|
} catch (error) {
|
|
1278
1269
|
console.error("[ERROR] [Request ".concat(requestId, "] Error in error callback:"), error);
|
|
1279
1270
|
}
|
|
@@ -1298,9 +1289,6 @@ var Balancy = function() {
|
|
|
1298
1289
|
headersObj.append(key, value);
|
|
1299
1290
|
headersLogged.push("".concat(key, ": ").concat(value));
|
|
1300
1291
|
}
|
|
1301
|
-
if (headersLogged.length > 0) {
|
|
1302
|
-
console.log(" Headers: ".concat(headersLogged.join(", ")));
|
|
1303
|
-
}
|
|
1304
1292
|
} catch (error) {
|
|
1305
1293
|
console.error("[ERROR] [Request ".concat(requestId, "] Error processing headers:"), error);
|
|
1306
1294
|
invokeErrorCallback(-1, "Header processing error: " + error.message, "");
|
|
@@ -1313,8 +1301,7 @@ var Balancy = function() {
|
|
|
1313
1301
|
};
|
|
1314
1302
|
var startTime = performance.now();
|
|
1315
1303
|
fetch(urlString, fetchOptions).then(function(response) {
|
|
1316
|
-
|
|
1317
|
-
console.log("[TIMING] [Request ".concat(requestId, "] Fetch completed in ").concat(duration.toFixed(2), "ms"));
|
|
1304
|
+
performance.now() - startTime;
|
|
1318
1305
|
if (!response.ok) {
|
|
1319
1306
|
console.error("[ERROR] [Request ".concat(requestId, "] Response not OK, status: ").concat(response.status, " ").concat(response.statusText));
|
|
1320
1307
|
response.text().then(function(errorMessage) {
|
|
@@ -1326,9 +1313,7 @@ var Balancy = function() {
|
|
|
1326
1313
|
});
|
|
1327
1314
|
return;
|
|
1328
1315
|
}
|
|
1329
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Response OK, status: ").concat(response.status));
|
|
1330
1316
|
var contentType = response.headers.get("content-type") || "";
|
|
1331
|
-
console.log(" Content-Type: ".concat(contentType));
|
|
1332
1317
|
var binaryExtensions = [
|
|
1333
1318
|
".png",
|
|
1334
1319
|
".jpg",
|
|
@@ -1369,11 +1354,9 @@ var Balancy = function() {
|
|
|
1369
1354
|
return contentType.toLowerCase().includes(type);
|
|
1370
1355
|
});
|
|
1371
1356
|
var isBinary = contentType.includes("application/octet-stream") || hasBinaryExtension || !isTextMimeType && !contentType.includes("charset");
|
|
1372
|
-
console.log(" Detected as: ".concat(isBinary ? "BINARY" : "TEXT", " data"));
|
|
1373
1357
|
if (isBinary) {
|
|
1374
1358
|
response.arrayBuffer().then(function(arrayBuffer) {
|
|
1375
1359
|
var dataSize = arrayBuffer.byteLength;
|
|
1376
|
-
console.log("[DATA] [Request ".concat(requestId, "] Binary data received: ").concat(dataSize, " bytes"));
|
|
1377
1360
|
if (dataSize <= 0 || dataSize > 104857600) {
|
|
1378
1361
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid binary data size: ").concat(dataSize));
|
|
1379
1362
|
invokeErrorCallback(-1, "Invalid binary data size: ".concat(dataSize), "");
|
|
@@ -1385,7 +1368,6 @@ var Balancy = function() {
|
|
|
1385
1368
|
invokeErrorCallback(-1, "Memory allocation failed for binary data", "");
|
|
1386
1369
|
return;
|
|
1387
1370
|
}
|
|
1388
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataSize, " bytes for binary data at ").concat(dataPtr));
|
|
1389
1371
|
var dataView = new Uint8Array(arrayBuffer);
|
|
1390
1372
|
Module.HEAPU8.set(dataView, dataPtr);
|
|
1391
1373
|
try {
|
|
@@ -1400,9 +1382,7 @@ var Balancy = function() {
|
|
|
1400
1382
|
return;
|
|
1401
1383
|
}
|
|
1402
1384
|
Module["dynCall_viii"](binaryCallbackPtr, dataPtr, dataSize, callbackPtr);
|
|
1403
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Binary callback completed successfully"));
|
|
1404
1385
|
if (requestContextPtr) {
|
|
1405
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1406
1386
|
Module._free(requestContextPtr);
|
|
1407
1387
|
}
|
|
1408
1388
|
} catch (error) {
|
|
@@ -1410,7 +1390,6 @@ var Balancy = function() {
|
|
|
1410
1390
|
invokeErrorCallback(-1, "Binary callback error: " + error.message, "");
|
|
1411
1391
|
}
|
|
1412
1392
|
Module._free(dataPtr);
|
|
1413
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed binary data memory at ").concat(dataPtr));
|
|
1414
1393
|
}).catch(function(error) {
|
|
1415
1394
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading binary data:"), error);
|
|
1416
1395
|
invokeErrorCallback(-1, error.message, "Failed to read binary response");
|
|
@@ -1418,10 +1397,6 @@ var Balancy = function() {
|
|
|
1418
1397
|
} else {
|
|
1419
1398
|
response.text().then(function(data) {
|
|
1420
1399
|
var dataLength = lengthBytesUTF8(data);
|
|
1421
|
-
console.log("[DATA] [Request ".concat(requestId, "] Text data received: ").concat(dataLength, " bytes"));
|
|
1422
|
-
if (data.length > 0) {
|
|
1423
|
-
console.log(" Preview: ".concat(data.substring(0, 200)).concat(data.length > 200 ? "..." : ""));
|
|
1424
|
-
}
|
|
1425
1400
|
if (dataLength <= 0 || dataLength > 104857600) {
|
|
1426
1401
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid text data size: ").concat(dataLength));
|
|
1427
1402
|
invokeErrorCallback(-1, "Invalid text data size: ".concat(dataLength), "");
|
|
@@ -1433,7 +1408,6 @@ var Balancy = function() {
|
|
|
1433
1408
|
invokeErrorCallback(-1, "Memory allocation failed for text data", "");
|
|
1434
1409
|
return;
|
|
1435
1410
|
}
|
|
1436
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataLength + 1, " bytes for text data at ").concat(dataPtr));
|
|
1437
1411
|
try {
|
|
1438
1412
|
stringToUTF8(data, dataPtr, dataLength + 1);
|
|
1439
1413
|
if (!successCallbackPtr || !callbackPtr) {
|
|
@@ -1447,9 +1421,7 @@ var Balancy = function() {
|
|
|
1447
1421
|
return;
|
|
1448
1422
|
}
|
|
1449
1423
|
Module["dynCall_viii"](successCallbackPtr, dataPtr, dataLength, callbackPtr);
|
|
1450
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Text callback completed successfully"));
|
|
1451
1424
|
if (requestContextPtr) {
|
|
1452
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1453
1425
|
Module._free(requestContextPtr);
|
|
1454
1426
|
}
|
|
1455
1427
|
} catch (error) {
|
|
@@ -1457,7 +1429,6 @@ var Balancy = function() {
|
|
|
1457
1429
|
invokeErrorCallback(-1, "Text callback error: " + error.message, "");
|
|
1458
1430
|
}
|
|
1459
1431
|
Module._free(dataPtr);
|
|
1460
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed text data memory at ").concat(dataPtr));
|
|
1461
1432
|
}).catch(function(error) {
|
|
1462
1433
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading text data:"), error);
|
|
1463
1434
|
invokeErrorCallback(-1, error.message, "Failed to read text response");
|
package/dist/node/index.umd.js
CHANGED
|
@@ -1230,12 +1230,6 @@
|
|
|
1230
1230
|
console.error("[ERROR] [Request ".concat(requestId, "] URL contains invalid characters:"), urlString);
|
|
1231
1231
|
return;
|
|
1232
1232
|
}
|
|
1233
|
-
console.log("[START] [Request ".concat(requestId, "] Starting ").concat(bLoadFile ? "FILE LOAD" : "API REQUEST"));
|
|
1234
|
-
console.log(" URL: ".concat(urlString));
|
|
1235
|
-
console.log(" Method: ".concat(methodString));
|
|
1236
|
-
if (bodyString) {
|
|
1237
|
-
console.log(" Body: ".concat(bodyString.length > 200 ? bodyString.substring(0, 200) + "..." : bodyString));
|
|
1238
|
-
}
|
|
1239
1233
|
} catch (error) {
|
|
1240
1234
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading strings from WASM memory:"), error);
|
|
1241
1235
|
return;
|
|
@@ -1251,7 +1245,6 @@
|
|
|
1251
1245
|
}
|
|
1252
1246
|
try {
|
|
1253
1247
|
if (requestContextPtr) {
|
|
1254
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1255
1248
|
Module._free(requestContextPtr);
|
|
1256
1249
|
}
|
|
1257
1250
|
if (!errorCallbackPtr || !callbackPtr) {
|
|
@@ -1269,7 +1262,6 @@
|
|
|
1269
1262
|
console.error("[ERROR] [Request ".concat(requestId, "] Failed to allocate memory for error message"));
|
|
1270
1263
|
return;
|
|
1271
1264
|
}
|
|
1272
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(errorLength + 1, " bytes for error message at ").concat(errorPtr));
|
|
1273
1265
|
stringToUTF8(errorMessage, errorPtr, errorLength + 1);
|
|
1274
1266
|
if (typeof Module["dynCall_viii"] !== "function") {
|
|
1275
1267
|
console.error("[ERROR] [Request ".concat(requestId, "] dynCall_viii function not available"));
|
|
@@ -1278,7 +1270,6 @@
|
|
|
1278
1270
|
}
|
|
1279
1271
|
Module["dynCall_viii"](errorCallbackPtr, status, errorPtr, callbackPtr);
|
|
1280
1272
|
Module._free(errorPtr);
|
|
1281
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed error message memory at ").concat(errorPtr));
|
|
1282
1273
|
} catch (error) {
|
|
1283
1274
|
console.error("[ERROR] [Request ".concat(requestId, "] Error in error callback:"), error);
|
|
1284
1275
|
}
|
|
@@ -1303,9 +1294,6 @@
|
|
|
1303
1294
|
headersObj.append(key, value);
|
|
1304
1295
|
headersLogged.push("".concat(key, ": ").concat(value));
|
|
1305
1296
|
}
|
|
1306
|
-
if (headersLogged.length > 0) {
|
|
1307
|
-
console.log(" Headers: ".concat(headersLogged.join(", ")));
|
|
1308
|
-
}
|
|
1309
1297
|
} catch (error) {
|
|
1310
1298
|
console.error("[ERROR] [Request ".concat(requestId, "] Error processing headers:"), error);
|
|
1311
1299
|
invokeErrorCallback(-1, "Header processing error: " + error.message, "");
|
|
@@ -1318,8 +1306,7 @@
|
|
|
1318
1306
|
};
|
|
1319
1307
|
var startTime = performance.now();
|
|
1320
1308
|
fetch(urlString, fetchOptions).then(function(response) {
|
|
1321
|
-
|
|
1322
|
-
console.log("[TIMING] [Request ".concat(requestId, "] Fetch completed in ").concat(duration.toFixed(2), "ms"));
|
|
1309
|
+
performance.now() - startTime;
|
|
1323
1310
|
if (!response.ok) {
|
|
1324
1311
|
console.error("[ERROR] [Request ".concat(requestId, "] Response not OK, status: ").concat(response.status, " ").concat(response.statusText));
|
|
1325
1312
|
response.text().then(function(errorMessage) {
|
|
@@ -1331,9 +1318,7 @@
|
|
|
1331
1318
|
});
|
|
1332
1319
|
return;
|
|
1333
1320
|
}
|
|
1334
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Response OK, status: ").concat(response.status));
|
|
1335
1321
|
var contentType = response.headers.get("content-type") || "";
|
|
1336
|
-
console.log(" Content-Type: ".concat(contentType));
|
|
1337
1322
|
var binaryExtensions = [
|
|
1338
1323
|
".png",
|
|
1339
1324
|
".jpg",
|
|
@@ -1374,11 +1359,9 @@
|
|
|
1374
1359
|
return contentType.toLowerCase().includes(type);
|
|
1375
1360
|
});
|
|
1376
1361
|
var isBinary = contentType.includes("application/octet-stream") || hasBinaryExtension || !isTextMimeType && !contentType.includes("charset");
|
|
1377
|
-
console.log(" Detected as: ".concat(isBinary ? "BINARY" : "TEXT", " data"));
|
|
1378
1362
|
if (isBinary) {
|
|
1379
1363
|
response.arrayBuffer().then(function(arrayBuffer) {
|
|
1380
1364
|
var dataSize = arrayBuffer.byteLength;
|
|
1381
|
-
console.log("[DATA] [Request ".concat(requestId, "] Binary data received: ").concat(dataSize, " bytes"));
|
|
1382
1365
|
if (dataSize <= 0 || dataSize > 104857600) {
|
|
1383
1366
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid binary data size: ").concat(dataSize));
|
|
1384
1367
|
invokeErrorCallback(-1, "Invalid binary data size: ".concat(dataSize), "");
|
|
@@ -1390,7 +1373,6 @@
|
|
|
1390
1373
|
invokeErrorCallback(-1, "Memory allocation failed for binary data", "");
|
|
1391
1374
|
return;
|
|
1392
1375
|
}
|
|
1393
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataSize, " bytes for binary data at ").concat(dataPtr));
|
|
1394
1376
|
var dataView = new Uint8Array(arrayBuffer);
|
|
1395
1377
|
Module.HEAPU8.set(dataView, dataPtr);
|
|
1396
1378
|
try {
|
|
@@ -1405,9 +1387,7 @@
|
|
|
1405
1387
|
return;
|
|
1406
1388
|
}
|
|
1407
1389
|
Module["dynCall_viii"](binaryCallbackPtr, dataPtr, dataSize, callbackPtr);
|
|
1408
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Binary callback completed successfully"));
|
|
1409
1390
|
if (requestContextPtr) {
|
|
1410
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1411
1391
|
Module._free(requestContextPtr);
|
|
1412
1392
|
}
|
|
1413
1393
|
} catch (error) {
|
|
@@ -1415,7 +1395,6 @@
|
|
|
1415
1395
|
invokeErrorCallback(-1, "Binary callback error: " + error.message, "");
|
|
1416
1396
|
}
|
|
1417
1397
|
Module._free(dataPtr);
|
|
1418
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed binary data memory at ").concat(dataPtr));
|
|
1419
1398
|
}).catch(function(error) {
|
|
1420
1399
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading binary data:"), error);
|
|
1421
1400
|
invokeErrorCallback(-1, error.message, "Failed to read binary response");
|
|
@@ -1423,10 +1402,6 @@
|
|
|
1423
1402
|
} else {
|
|
1424
1403
|
response.text().then(function(data) {
|
|
1425
1404
|
var dataLength = lengthBytesUTF8(data);
|
|
1426
|
-
console.log("[DATA] [Request ".concat(requestId, "] Text data received: ").concat(dataLength, " bytes"));
|
|
1427
|
-
if (data.length > 0) {
|
|
1428
|
-
console.log(" Preview: ".concat(data.substring(0, 200)).concat(data.length > 200 ? "..." : ""));
|
|
1429
|
-
}
|
|
1430
1405
|
if (dataLength <= 0 || dataLength > 104857600) {
|
|
1431
1406
|
console.error("[ERROR] [Request ".concat(requestId, "] Invalid text data size: ").concat(dataLength));
|
|
1432
1407
|
invokeErrorCallback(-1, "Invalid text data size: ".concat(dataLength), "");
|
|
@@ -1438,7 +1413,6 @@
|
|
|
1438
1413
|
invokeErrorCallback(-1, "Memory allocation failed for text data", "");
|
|
1439
1414
|
return;
|
|
1440
1415
|
}
|
|
1441
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Allocated ").concat(dataLength + 1, " bytes for text data at ").concat(dataPtr));
|
|
1442
1416
|
try {
|
|
1443
1417
|
stringToUTF8(data, dataPtr, dataLength + 1);
|
|
1444
1418
|
if (!successCallbackPtr || !callbackPtr) {
|
|
@@ -1452,9 +1426,7 @@
|
|
|
1452
1426
|
return;
|
|
1453
1427
|
}
|
|
1454
1428
|
Module["dynCall_viii"](successCallbackPtr, dataPtr, dataLength, callbackPtr);
|
|
1455
|
-
console.log("[SUCCESS] [Request ".concat(requestId, "] Text callback completed successfully"));
|
|
1456
1429
|
if (requestContextPtr) {
|
|
1457
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Cleaning up RequestContext at ").concat(requestContextPtr));
|
|
1458
1430
|
Module._free(requestContextPtr);
|
|
1459
1431
|
}
|
|
1460
1432
|
} catch (error) {
|
|
@@ -1462,7 +1434,6 @@
|
|
|
1462
1434
|
invokeErrorCallback(-1, "Text callback error: " + error.message, "");
|
|
1463
1435
|
}
|
|
1464
1436
|
Module._free(dataPtr);
|
|
1465
|
-
console.log("[MEMORY] [Request ".concat(requestId, "] Freed text data memory at ").concat(dataPtr));
|
|
1466
1437
|
}).catch(function(error) {
|
|
1467
1438
|
console.error("[ERROR] [Request ".concat(requestId, "] Error reading text data:"), error);
|
|
1468
1439
|
invokeErrorCallback(-1, error.message, "Failed to read text response");
|