@loadstrike/loadstrike-sdk 0.1.0 → 0.1.10001
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.
|
Binary file
|
|
Binary file
|
package/dist/cjs/reporting.js
CHANGED
|
@@ -10,9 +10,32 @@ exports.buildDotnetHtmlReport = buildDotnetHtmlReport;
|
|
|
10
10
|
const node_fs_1 = require("node:fs");
|
|
11
11
|
const node_os_1 = __importDefault(require("node:os"));
|
|
12
12
|
const node_path_1 = require("node:path");
|
|
13
|
+
const node_url_1 = require("node:url");
|
|
13
14
|
const REPORT_EOL = node_os_1.default.EOL;
|
|
14
15
|
const REPORT_FALLBACK_SVG = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 128'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='#64b5ff'/><stop offset='1' stop-color='#2f66db'/></linearGradient></defs><rect width='128' height='128' rx='24' fill='#081325'/><path d='M24 94L56 24l16 34 14-22 18 58h-16l-7-23-9 13-10-21-14 31H24z' fill='url(#g)'/></svg>";
|
|
15
16
|
const REPORT_LOGO_CACHE = new Map();
|
|
17
|
+
function resolveReportModuleDir() {
|
|
18
|
+
if (typeof __dirname === "string" && __dirname.length > 0) {
|
|
19
|
+
return __dirname;
|
|
20
|
+
}
|
|
21
|
+
const stack = new Error().stack ?? "";
|
|
22
|
+
for (const line of stack.split(/\r?\n/)) {
|
|
23
|
+
const fileUrlMatch = line.match(/file:\/\/\/[^\s)]+?\.(?:mjs|cjs|js|ts)/i);
|
|
24
|
+
if (!fileUrlMatch) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
return (0, node_path_1.dirname)((0, node_url_1.fileURLToPath)(fileUrlMatch[0]));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const REPORT_MODULE_DIR = (() => {
|
|
37
|
+
return resolveReportModuleDir();
|
|
38
|
+
})();
|
|
16
39
|
function appendReportLine(parts, text = "") {
|
|
17
40
|
parts.push(text, REPORT_EOL);
|
|
18
41
|
}
|
|
@@ -233,15 +256,9 @@ function buildReportLogoDataUri(resourceName) {
|
|
|
233
256
|
}
|
|
234
257
|
const filename = resourceName.includes("dark") ? "logo-dark-theme.png" : "logo-light-theme.png";
|
|
235
258
|
const candidates = [
|
|
236
|
-
(0, node_path_1.resolve)(
|
|
237
|
-
(0, node_path_1.resolve)(
|
|
238
|
-
|
|
239
|
-
(0, node_path_1.resolve)(process.cwd(), "..", "..", "..", "LoadStrike", "images", filename),
|
|
240
|
-
(0, node_path_1.resolve)(process.cwd(), "..", "..", "..", "..", "LoadStrike", "images", filename),
|
|
241
|
-
(0, node_path_1.resolve)(process.cwd(), "assets", filename),
|
|
242
|
-
(0, node_path_1.resolve)(process.cwd(), "src", "assets", filename),
|
|
243
|
-
(0, node_path_1.resolve)(process.cwd(), "sdk", "ts", "src", "assets", filename)
|
|
244
|
-
];
|
|
259
|
+
REPORT_MODULE_DIR ? (0, node_path_1.resolve)(REPORT_MODULE_DIR, "assets", filename) : "",
|
|
260
|
+
REPORT_MODULE_DIR ? (0, node_path_1.resolve)(REPORT_MODULE_DIR, "..", "assets", filename) : "",
|
|
261
|
+
].filter((value) => value.length > 0);
|
|
245
262
|
for (const candidate of candidates) {
|
|
246
263
|
try {
|
|
247
264
|
if ((0, node_fs_1.existsSync)(candidate)) {
|
package/dist/esm/reporting.js
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
|
-
import { resolve } from "node:path";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
4
5
|
const REPORT_EOL = os.EOL;
|
|
5
6
|
const REPORT_FALLBACK_SVG = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 128'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='#64b5ff'/><stop offset='1' stop-color='#2f66db'/></linearGradient></defs><rect width='128' height='128' rx='24' fill='#081325'/><path d='M24 94L56 24l16 34 14-22 18 58h-16l-7-23-9 13-10-21-14 31H24z' fill='url(#g)'/></svg>";
|
|
6
7
|
const REPORT_LOGO_CACHE = new Map();
|
|
8
|
+
function resolveReportModuleDir() {
|
|
9
|
+
if (typeof __dirname === "string" && __dirname.length > 0) {
|
|
10
|
+
return __dirname;
|
|
11
|
+
}
|
|
12
|
+
const stack = new Error().stack ?? "";
|
|
13
|
+
for (const line of stack.split(/\r?\n/)) {
|
|
14
|
+
const fileUrlMatch = line.match(/file:\/\/\/[^\s)]+?\.(?:mjs|cjs|js|ts)/i);
|
|
15
|
+
if (!fileUrlMatch) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
return dirname(fileURLToPath(fileUrlMatch[0]));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const REPORT_MODULE_DIR = (() => {
|
|
28
|
+
return resolveReportModuleDir();
|
|
29
|
+
})();
|
|
7
30
|
function appendReportLine(parts, text = "") {
|
|
8
31
|
parts.push(text, REPORT_EOL);
|
|
9
32
|
}
|
|
@@ -224,15 +247,9 @@ function buildReportLogoDataUri(resourceName) {
|
|
|
224
247
|
}
|
|
225
248
|
const filename = resourceName.includes("dark") ? "logo-dark-theme.png" : "logo-light-theme.png";
|
|
226
249
|
const candidates = [
|
|
227
|
-
resolve(
|
|
228
|
-
resolve(
|
|
229
|
-
|
|
230
|
-
resolve(process.cwd(), "..", "..", "..", "LoadStrike", "images", filename),
|
|
231
|
-
resolve(process.cwd(), "..", "..", "..", "..", "LoadStrike", "images", filename),
|
|
232
|
-
resolve(process.cwd(), "assets", filename),
|
|
233
|
-
resolve(process.cwd(), "src", "assets", filename),
|
|
234
|
-
resolve(process.cwd(), "sdk", "ts", "src", "assets", filename)
|
|
235
|
-
];
|
|
250
|
+
REPORT_MODULE_DIR ? resolve(REPORT_MODULE_DIR, "assets", filename) : "",
|
|
251
|
+
REPORT_MODULE_DIR ? resolve(REPORT_MODULE_DIR, "..", "assets", filename) : "",
|
|
252
|
+
].filter((value) => value.length > 0);
|
|
236
253
|
for (const candidate of candidates) {
|
|
237
254
|
try {
|
|
238
255
|
if (existsSync(candidate)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadstrike/loadstrike-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10001",
|
|
4
4
|
"description": "TypeScript and JavaScript SDK for in-process load execution, traffic correlation, and reporting.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"load-testing",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/loadstrike/LoadStrike.git",
|
|
17
|
+
"url": "git+https://github.com/loadstrike/LoadStrike.git",
|
|
18
18
|
"directory": "sdk/ts"
|
|
19
19
|
},
|
|
20
20
|
"type": "module",
|
|
@@ -85,7 +85,8 @@
|
|
|
85
85
|
"clean": "rimraf dist",
|
|
86
86
|
"test": "npm run test:coverage",
|
|
87
87
|
"test:coverage": "c8 --check-coverage --lines 89.5 --branches 81.6 --functions 95.5 node ./scripts/run-tests.mjs",
|
|
88
|
-
"test:unit": "node ./scripts/run-tests.mjs"
|
|
88
|
+
"test:unit": "node ./scripts/run-tests.mjs",
|
|
89
|
+
"test:broker": "node --test --test-concurrency=1 tests/broker-integration.test.mjs tests/broker-distributed.test.mjs"
|
|
89
90
|
},
|
|
90
91
|
"dependencies": {
|
|
91
92
|
"@azure/event-hubs": "^5.12.2",
|
|
@@ -103,7 +104,7 @@
|
|
|
103
104
|
"devDependencies": {
|
|
104
105
|
"@types/amqplib": "^0.10.7",
|
|
105
106
|
"@types/node": "^20.19.37",
|
|
106
|
-
"c8": "^
|
|
107
|
+
"c8": "^11.0.0",
|
|
107
108
|
"rimraf": "^6.0.1",
|
|
108
109
|
"typescript": "^5.9.2"
|
|
109
110
|
}
|