@loadstrike/loadstrike-sdk 1.0.16101 → 1.0.17301
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/README.md +22 -34
- package/dist/cjs/local.js +19 -1
- package/dist/esm/local.js +19 -1
- package/package.json +1 -9
package/README.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
# LoadStrike for TypeScript and JavaScript
|
|
1
|
+
# LoadStrike SDK for TypeScript and JavaScript
|
|
2
2
|
|
|
3
|
-
LoadStrike for
|
|
3
|
+
LoadStrike is a developer-first load testing SDK for Node.js applications, services, and test suites. Use it when you want to model real transactions in code, execute them in-process, and capture structured results without moving into a separate runner or DSL.
|
|
4
|
+
|
|
5
|
+
## What This SDK Is For
|
|
6
|
+
|
|
7
|
+
- Author scenario-based load tests in TypeScript or JavaScript.
|
|
8
|
+
- Exercise HTTP and event-driven workflows across multiple steps.
|
|
9
|
+
- Apply load simulations, thresholds, and custom metrics to real transactions.
|
|
10
|
+
- Generate local reports and, on eligible plans, publish observability data to supported sinks.
|
|
11
|
+
|
|
12
|
+
Built-in transport coverage includes HTTP, Kafka, RabbitMQ, NATS, Redis Streams, Azure Event Hubs, Push Diffusion, and delegate-based custom streams. Local report output supports HTML, Markdown, TXT, and CSV, and eligible plans can publish to InfluxDB, TimescaleDB, Grafana Loki, Datadog, Splunk HEC, and OpenTelemetry Collector.
|
|
4
13
|
|
|
5
14
|
## Requirements
|
|
6
15
|
|
|
@@ -12,33 +21,6 @@ LoadStrike for TypeScript and JavaScript lets you define, run, and report load s
|
|
|
12
21
|
npm install @loadstrike/loadstrike-sdk
|
|
13
22
|
```
|
|
14
23
|
|
|
15
|
-
## What You Can Do
|
|
16
|
-
|
|
17
|
-
- Define scenarios, steps, load simulations, thresholds, and metrics in code
|
|
18
|
-
- Run workloads in-process and collect structured results
|
|
19
|
-
- Generate HTML, Markdown, TXT, and CSV reports
|
|
20
|
-
- Extend runs with correlation, distributed execution, and reporting sinks when needed
|
|
21
|
-
|
|
22
|
-
## Supported Transports
|
|
23
|
-
|
|
24
|
-
- HTTP
|
|
25
|
-
- Kafka
|
|
26
|
-
- RabbitMQ
|
|
27
|
-
- NATS
|
|
28
|
-
- Redis Streams
|
|
29
|
-
- Azure Event Hubs
|
|
30
|
-
- Push Diffusion
|
|
31
|
-
- Delegate and custom stream endpoints
|
|
32
|
-
|
|
33
|
-
## Supported Reporting Sinks
|
|
34
|
-
|
|
35
|
-
- InfluxDB
|
|
36
|
-
- TimescaleDB
|
|
37
|
-
- Grafana Loki
|
|
38
|
-
- Datadog
|
|
39
|
-
- Splunk HEC
|
|
40
|
-
- OpenTelemetry Collector
|
|
41
|
-
|
|
42
24
|
## Quick Start
|
|
43
25
|
|
|
44
26
|
```ts
|
|
@@ -47,7 +29,7 @@ import {
|
|
|
47
29
|
LoadStrikeRunner,
|
|
48
30
|
LoadStrikeScenario,
|
|
49
31
|
LoadStrikeSimulation,
|
|
50
|
-
LoadStrikeStep
|
|
32
|
+
LoadStrikeStep,
|
|
51
33
|
} from "@loadstrike/loadstrike-sdk";
|
|
52
34
|
|
|
53
35
|
const scenario = LoadStrikeScenario
|
|
@@ -58,7 +40,9 @@ const scenario = LoadStrikeScenario
|
|
|
58
40
|
async () => LoadStrikeResponse.ok("200")
|
|
59
41
|
);
|
|
60
42
|
})
|
|
61
|
-
.withLoadSimulations(
|
|
43
|
+
.withLoadSimulations(
|
|
44
|
+
LoadStrikeSimulation.inject(10, 1, 20)
|
|
45
|
+
);
|
|
62
46
|
|
|
63
47
|
const result = await LoadStrikeRunner
|
|
64
48
|
.registerScenarios(scenario)
|
|
@@ -66,8 +50,12 @@ const result = await LoadStrikeRunner
|
|
|
66
50
|
.run();
|
|
67
51
|
```
|
|
68
52
|
|
|
69
|
-
|
|
53
|
+
`run()` returns the detailed run result, including generated report files, scenario statistics, metrics, and sink status.
|
|
54
|
+
|
|
55
|
+
## Runner Keys
|
|
56
|
+
|
|
57
|
+
Runnable workloads require a `RunnerKey`. Supply it with `.withRunnerKey(...)` or through your application configuration before calling `run()`.
|
|
70
58
|
|
|
71
|
-
## Documentation
|
|
59
|
+
## Documentation
|
|
72
60
|
|
|
73
|
-
https://loadstrike.com/documentation
|
|
61
|
+
- Product documentation: https://loadstrike.com/documentation
|
package/dist/cjs/local.js
CHANGED
|
@@ -44,6 +44,7 @@ const node_crypto_1 = require("node:crypto");
|
|
|
44
44
|
const correlation_js_1 = require("./correlation.js");
|
|
45
45
|
const transports_js_1 = require("./transports.js");
|
|
46
46
|
const DEFAULT_LICENSING_API_BASE_URL = "https://licensing.loadstrike.com";
|
|
47
|
+
const INTERNAL_BLACKBOX_LICENSING_API_BASE_URL_ENVIRONMENT_VARIABLE = "LOADSTRIKE_INTERNAL_BLACKBOX_API_BASE_URL";
|
|
47
48
|
let developmentLicensingApiBaseUrlOverride;
|
|
48
49
|
const BUILT_IN_WORKER_PLUGIN_NAMES = new Set([
|
|
49
50
|
"loadstrike failed responses",
|
|
@@ -404,8 +405,25 @@ function normalizeLicensingApiBaseUrl(value) {
|
|
|
404
405
|
const normalized = (value ?? "").trim();
|
|
405
406
|
return normalized || DEFAULT_LICENSING_API_BASE_URL;
|
|
406
407
|
}
|
|
408
|
+
function resolveInternalBlackboxLicensingApiBaseUrlOverride(value) {
|
|
409
|
+
const normalized = String(value ?? "").trim();
|
|
410
|
+
if (!normalized) {
|
|
411
|
+
return undefined;
|
|
412
|
+
}
|
|
413
|
+
try {
|
|
414
|
+
const parsed = new URL(normalized);
|
|
415
|
+
const host = parsed.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
416
|
+
if (["http:", "https:"].includes(parsed.protocol) && ["127.0.0.1", "localhost", "::1"].includes(host)) {
|
|
417
|
+
return normalized.replace(/\/+$/, "");
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
catch {
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
return undefined;
|
|
424
|
+
}
|
|
407
425
|
function resolveLicensingApiBaseUrl() {
|
|
408
|
-
return normalizeLicensingApiBaseUrl(process.env
|
|
426
|
+
return normalizeLicensingApiBaseUrl(resolveInternalBlackboxLicensingApiBaseUrlOverride(process.env[INTERNAL_BLACKBOX_LICENSING_API_BASE_URL_ENVIRONMENT_VARIABLE]) ?? developmentLicensingApiBaseUrlOverride);
|
|
409
427
|
}
|
|
410
428
|
function setDevelopmentLicensingApiBaseUrlOverride(value) {
|
|
411
429
|
developmentLicensingApiBaseUrlOverride = value;
|
package/dist/esm/local.js
CHANGED
|
@@ -5,6 +5,7 @@ import { createHash, createVerify, randomUUID } from "node:crypto";
|
|
|
5
5
|
import { CorrelationStoreConfiguration, CrossPlatformTrackingRuntime, RedisCorrelationStoreOptions, RedisCorrelationStore, TrackingFieldSelector } from "./correlation.js";
|
|
6
6
|
import { EndpointAdapterFactory } from "./transports.js";
|
|
7
7
|
const DEFAULT_LICENSING_API_BASE_URL = "https://licensing.loadstrike.com";
|
|
8
|
+
const INTERNAL_BLACKBOX_LICENSING_API_BASE_URL_ENVIRONMENT_VARIABLE = "LOADSTRIKE_INTERNAL_BLACKBOX_API_BASE_URL";
|
|
8
9
|
let developmentLicensingApiBaseUrlOverride;
|
|
9
10
|
const BUILT_IN_WORKER_PLUGIN_NAMES = new Set([
|
|
10
11
|
"loadstrike failed responses",
|
|
@@ -364,8 +365,25 @@ function normalizeLicensingApiBaseUrl(value) {
|
|
|
364
365
|
const normalized = (value ?? "").trim();
|
|
365
366
|
return normalized || DEFAULT_LICENSING_API_BASE_URL;
|
|
366
367
|
}
|
|
368
|
+
function resolveInternalBlackboxLicensingApiBaseUrlOverride(value) {
|
|
369
|
+
const normalized = String(value ?? "").trim();
|
|
370
|
+
if (!normalized) {
|
|
371
|
+
return undefined;
|
|
372
|
+
}
|
|
373
|
+
try {
|
|
374
|
+
const parsed = new URL(normalized);
|
|
375
|
+
const host = parsed.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
376
|
+
if (["http:", "https:"].includes(parsed.protocol) && ["127.0.0.1", "localhost", "::1"].includes(host)) {
|
|
377
|
+
return normalized.replace(/\/+$/, "");
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
catch {
|
|
381
|
+
return undefined;
|
|
382
|
+
}
|
|
383
|
+
return undefined;
|
|
384
|
+
}
|
|
367
385
|
function resolveLicensingApiBaseUrl() {
|
|
368
|
-
return normalizeLicensingApiBaseUrl(process.env
|
|
386
|
+
return normalizeLicensingApiBaseUrl(resolveInternalBlackboxLicensingApiBaseUrlOverride(process.env[INTERNAL_BLACKBOX_LICENSING_API_BASE_URL_ENVIRONMENT_VARIABLE]) ?? developmentLicensingApiBaseUrlOverride);
|
|
369
387
|
}
|
|
370
388
|
function setDevelopmentLicensingApiBaseUrlOverride(value) {
|
|
371
389
|
developmentLicensingApiBaseUrlOverride = value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadstrike/loadstrike-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17301",
|
|
4
4
|
"description": "TypeScript and JavaScript SDK for in-process load execution, traffic correlation, and reporting.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"load-testing",
|
|
@@ -9,14 +9,6 @@
|
|
|
9
9
|
"reporting"
|
|
10
10
|
],
|
|
11
11
|
"homepage": "https://loadstrike.com/documentation",
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/loadstrike/LoadStrike/issues"
|
|
14
|
-
},
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/loadstrike/LoadStrike.git",
|
|
18
|
-
"directory": "sdk/ts"
|
|
19
|
-
},
|
|
20
12
|
"type": "module",
|
|
21
13
|
"main": "dist/cjs/index.js",
|
|
22
14
|
"module": "dist/esm/index.js",
|