@loadstrike/loadstrike-sdk 1.0.10101 → 1.0.10801
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 +8 -8
- package/dist/cjs/cluster.js +18 -1
- package/dist/cjs/correlation.js +69 -11
- package/dist/cjs/index.js +2 -14
- package/dist/cjs/local.js +88 -18
- package/dist/cjs/reporting.js +19 -5
- package/dist/cjs/runtime.js +526 -264
- package/dist/cjs/sinks.js +200 -106
- package/dist/cjs/transports.js +104 -18
- package/dist/esm/cluster.js +17 -0
- package/dist/esm/correlation.js +68 -10
- package/dist/esm/index.js +2 -4
- package/dist/esm/local.js +86 -16
- package/dist/esm/reporting.js +18 -2
- package/dist/esm/runtime.js +527 -264
- package/dist/esm/sinks.js +199 -105
- package/dist/esm/transports.js +103 -17
- package/dist/types/cluster.d.ts +30 -0
- package/dist/types/contracts.d.ts +15 -15
- package/dist/types/correlation.d.ts +41 -1
- package/dist/types/index.d.ts +4 -8
- package/dist/types/local.d.ts +146 -2
- package/dist/types/reporting.d.ts +33 -0
- package/dist/types/runtime.d.ts +464 -77
- package/dist/types/sinks.d.ts +212 -21
- package/dist/types/transports.d.ts +142 -0
- package/package.json +8 -19
package/dist/types/sinks.d.ts
CHANGED
|
@@ -1,5 +1,133 @@
|
|
|
1
|
-
import type { ILoadStrikeReportingSink, LoadStrikeBaseContext, LoadStrikeMetricStats,
|
|
1
|
+
import type { ILoadStrikeReportingSink, LoadStrikeBaseContext, LoadStrikeMetricStats, LoadStrikeMetricValue, LoadStrikeNodeInfo, LoadStrikePluginData, LoadStrikeReportingSink, LoadStrikeRunResult, LoadStrikeScenarioStats, LoadStrikeSessionStartInfo, LoadStrikeSinkError, LoadStrikeStepStats, LoadStrikeTestInfo, LoadStrikeThresholdResult } from "./runtime.js";
|
|
2
|
+
interface LoadStrikeNodeStats {
|
|
3
|
+
startedUtc: string;
|
|
4
|
+
completedUtc: string;
|
|
5
|
+
allBytes: number;
|
|
6
|
+
allRequestCount: number;
|
|
7
|
+
allOkCount: number;
|
|
8
|
+
allFailCount: number;
|
|
9
|
+
failedThresholds: number;
|
|
10
|
+
durationMs: number;
|
|
11
|
+
nodeInfo: LoadStrikeNodeInfo;
|
|
12
|
+
testInfo: LoadStrikeTestInfo;
|
|
13
|
+
thresholds: LoadStrikeThresholdResult[];
|
|
14
|
+
thresholdResults: LoadStrikeThresholdResult[];
|
|
15
|
+
metrics: LoadStrikeMetricStats;
|
|
16
|
+
metricValues: LoadStrikeMetricValue[];
|
|
17
|
+
scenarioStats: LoadStrikeScenarioStats[];
|
|
18
|
+
stepStats: LoadStrikeStepStats[];
|
|
19
|
+
pluginsData: LoadStrikePluginData[];
|
|
20
|
+
disabledSinks: string[];
|
|
21
|
+
sinkErrors: LoadStrikeSinkError[];
|
|
22
|
+
reportFiles: string[];
|
|
23
|
+
logFiles: string[];
|
|
24
|
+
findScenarioStats: (scenarioName: string) => LoadStrikeScenarioStats | undefined;
|
|
25
|
+
getScenarioStats: (scenarioName: string) => LoadStrikeScenarioStats;
|
|
26
|
+
FindScenarioStats: (scenarioName: string) => LoadStrikeScenarioStats | undefined;
|
|
27
|
+
GetScenarioStats: (scenarioName: string) => LoadStrikeScenarioStats;
|
|
28
|
+
}
|
|
2
29
|
type SinkFetch = (input: string, init?: RequestInit) => Promise<Response>;
|
|
30
|
+
interface ReportingSinkEvent {
|
|
31
|
+
eventType: string;
|
|
32
|
+
occurredUtc: Date;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
testSuite: string;
|
|
35
|
+
testName: string;
|
|
36
|
+
clusterId: string;
|
|
37
|
+
nodeType: string;
|
|
38
|
+
machineName: string;
|
|
39
|
+
scenarioName: string | null;
|
|
40
|
+
stepName: string | null;
|
|
41
|
+
tags: Record<string, string>;
|
|
42
|
+
fields: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
interface SinkSessionMetadata {
|
|
45
|
+
sessionId: string;
|
|
46
|
+
testSuite: string;
|
|
47
|
+
testName: string;
|
|
48
|
+
clusterId: string;
|
|
49
|
+
nodeType: string;
|
|
50
|
+
machineName: string;
|
|
51
|
+
startedUtc: string;
|
|
52
|
+
}
|
|
53
|
+
interface InfluxDbResolvedOptions {
|
|
54
|
+
configurationSectionPath: string;
|
|
55
|
+
baseUrl: string;
|
|
56
|
+
writeEndpointPath: string;
|
|
57
|
+
organization: string;
|
|
58
|
+
bucket: string;
|
|
59
|
+
token: string;
|
|
60
|
+
measurementName: string;
|
|
61
|
+
metricsMeasurementName: string;
|
|
62
|
+
timeoutSeconds: number;
|
|
63
|
+
timeoutMs?: number;
|
|
64
|
+
staticTags: Record<string, string>;
|
|
65
|
+
}
|
|
66
|
+
interface GrafanaLokiResolvedOptions {
|
|
67
|
+
configurationSectionPath: string;
|
|
68
|
+
baseUrl: string;
|
|
69
|
+
pushEndpointPath: string;
|
|
70
|
+
metricsBaseUrl: string;
|
|
71
|
+
metricsEndpointPath: string;
|
|
72
|
+
bearerToken: string;
|
|
73
|
+
username: string;
|
|
74
|
+
password: string;
|
|
75
|
+
tenantId: string;
|
|
76
|
+
timeoutSeconds: number;
|
|
77
|
+
timeoutMs?: number;
|
|
78
|
+
staticLabels: Record<string, string>;
|
|
79
|
+
metricsHeaders: Record<string, string>;
|
|
80
|
+
}
|
|
81
|
+
interface TimescaleDbResolvedOptions {
|
|
82
|
+
configurationSectionPath: string;
|
|
83
|
+
connectionString: string;
|
|
84
|
+
schema: string;
|
|
85
|
+
tableName: string;
|
|
86
|
+
metricsTableName: string;
|
|
87
|
+
createSchemaIfMissing: boolean;
|
|
88
|
+
enableHypertableIfAvailable: boolean;
|
|
89
|
+
staticTags: Record<string, string>;
|
|
90
|
+
insert?: (qualifiedTableName: string, rows: Array<Record<string, unknown>>) => Promise<void> | void;
|
|
91
|
+
insertMetrics?: (qualifiedTableName: string, rows: Array<Record<string, unknown>>) => Promise<void> | void;
|
|
92
|
+
}
|
|
93
|
+
interface DatadogResolvedOptions {
|
|
94
|
+
configurationSectionPath: string;
|
|
95
|
+
baseUrl: string;
|
|
96
|
+
logsEndpointPath: string;
|
|
97
|
+
metricsEndpointPath: string;
|
|
98
|
+
apiKey: string;
|
|
99
|
+
applicationKey: string;
|
|
100
|
+
source: string;
|
|
101
|
+
service: string;
|
|
102
|
+
host: string;
|
|
103
|
+
timeoutSeconds: number;
|
|
104
|
+
timeoutMs?: number;
|
|
105
|
+
staticTags: Record<string, string>;
|
|
106
|
+
staticAttributes: Record<string, string>;
|
|
107
|
+
}
|
|
108
|
+
interface SplunkResolvedOptions {
|
|
109
|
+
configurationSectionPath: string;
|
|
110
|
+
baseUrl: string;
|
|
111
|
+
eventEndpointPath: string;
|
|
112
|
+
token: string;
|
|
113
|
+
source: string;
|
|
114
|
+
sourcetype: string;
|
|
115
|
+
index: string;
|
|
116
|
+
host: string;
|
|
117
|
+
timeoutSeconds: number;
|
|
118
|
+
timeoutMs?: number;
|
|
119
|
+
staticFields: Record<string, string>;
|
|
120
|
+
}
|
|
121
|
+
interface OtelCollectorResolvedOptions {
|
|
122
|
+
configurationSectionPath: string;
|
|
123
|
+
baseUrl: string;
|
|
124
|
+
logsEndpointPath: string;
|
|
125
|
+
metricsEndpointPath: string;
|
|
126
|
+
timeoutSeconds: number;
|
|
127
|
+
timeoutMs?: number;
|
|
128
|
+
headers: Record<string, string>;
|
|
129
|
+
staticResourceAttributes: Record<string, string>;
|
|
130
|
+
}
|
|
3
131
|
export interface InfluxDbSinkOptionsInput {
|
|
4
132
|
ConfigurationSectionPath?: string;
|
|
5
133
|
configurationSectionPath?: string;
|
|
@@ -258,7 +386,7 @@ export declare class MemoryReportingSink implements LoadStrikeReportingSink {
|
|
|
258
386
|
}>;
|
|
259
387
|
readonly realtimeSnapshots: LoadStrikeScenarioStats[][];
|
|
260
388
|
readonly realtimeMetrics: LoadStrikeMetricStats[];
|
|
261
|
-
readonly finalResults:
|
|
389
|
+
readonly finalResults: LoadStrikeRunResult[];
|
|
262
390
|
readonly runResults: Array<Record<string, unknown>>;
|
|
263
391
|
readonly sessions: LoadStrikeSessionStartInfo[];
|
|
264
392
|
stopCount: number;
|
|
@@ -270,8 +398,6 @@ export declare class MemoryReportingSink implements LoadStrikeReportingSink {
|
|
|
270
398
|
SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): void;
|
|
271
399
|
saveRealtimeMetrics(metrics: LoadStrikeMetricStats): void;
|
|
272
400
|
SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): void;
|
|
273
|
-
saveFinalStats(result: LoadStrikeNodeStats): void;
|
|
274
|
-
SaveFinalStats(result: LoadStrikeNodeStats): void;
|
|
275
401
|
saveRunResult(result: LoadStrikeRunResult): void;
|
|
276
402
|
SaveRunResult(result: LoadStrikeRunResult): void;
|
|
277
403
|
stop(): void;
|
|
@@ -290,9 +416,7 @@ export declare class ConsoleReportingSink implements LoadStrikeReportingSink {
|
|
|
290
416
|
SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): void;
|
|
291
417
|
saveRealtimeMetrics(metrics: LoadStrikeMetricStats): void;
|
|
292
418
|
SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): void;
|
|
293
|
-
|
|
294
|
-
SaveFinalStats(result: LoadStrikeNodeStats): void;
|
|
295
|
-
saveRunResult(_result: LoadStrikeRunResult): void;
|
|
419
|
+
saveRunResult(result: LoadStrikeRunResult): void;
|
|
296
420
|
SaveRunResult(result: LoadStrikeRunResult): void;
|
|
297
421
|
stop(): void;
|
|
298
422
|
Stop(): void;
|
|
@@ -310,8 +434,6 @@ export declare class CompositeReportingSink implements LoadStrikeReportingSink {
|
|
|
310
434
|
SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
|
|
311
435
|
saveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
312
436
|
SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
313
|
-
saveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
314
|
-
SaveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
315
437
|
saveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
316
438
|
SaveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
317
439
|
stop(): Promise<void>;
|
|
@@ -335,8 +457,6 @@ export declare class InfluxDbReportingSink implements LoadStrikeReportingSink {
|
|
|
335
457
|
SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
|
|
336
458
|
saveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
337
459
|
SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
338
|
-
saveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
339
|
-
SaveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
340
460
|
saveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
341
461
|
SaveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
342
462
|
stop(): void;
|
|
@@ -364,8 +484,6 @@ export declare class GrafanaLokiReportingSink implements LoadStrikeReportingSink
|
|
|
364
484
|
SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
|
|
365
485
|
saveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
366
486
|
SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
367
|
-
saveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
368
|
-
SaveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
369
487
|
saveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
370
488
|
SaveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
371
489
|
stop(): void;
|
|
@@ -394,8 +512,6 @@ export declare class TimescaleDbReportingSink implements LoadStrikeReportingSink
|
|
|
394
512
|
SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
|
|
395
513
|
saveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
396
514
|
SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
397
|
-
saveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
398
|
-
SaveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
399
515
|
saveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
400
516
|
SaveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
401
517
|
stop(): Promise<void>;
|
|
@@ -425,8 +541,6 @@ export declare class DatadogReportingSink implements LoadStrikeReportingSink {
|
|
|
425
541
|
SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
|
|
426
542
|
saveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
427
543
|
SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
428
|
-
saveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
429
|
-
SaveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
430
544
|
saveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
431
545
|
SaveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
432
546
|
stop(): void;
|
|
@@ -454,8 +568,6 @@ export declare class SplunkReportingSink implements LoadStrikeReportingSink {
|
|
|
454
568
|
SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
|
|
455
569
|
saveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
456
570
|
SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
457
|
-
saveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
458
|
-
SaveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
459
571
|
saveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
460
572
|
SaveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
461
573
|
stop(): void;
|
|
@@ -483,8 +595,6 @@ export declare class OtelCollectorReportingSink implements LoadStrikeReportingSi
|
|
|
483
595
|
SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
|
|
484
596
|
saveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
485
597
|
SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
486
|
-
saveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
487
|
-
SaveFinalStats(result: LoadStrikeNodeStats): Promise<void>;
|
|
488
598
|
saveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
489
599
|
SaveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
490
600
|
stop(): void;
|
|
@@ -494,4 +604,85 @@ export declare class OtelCollectorReportingSink implements LoadStrikeReportingSi
|
|
|
494
604
|
private getSession;
|
|
495
605
|
private persistEvents;
|
|
496
606
|
}
|
|
607
|
+
declare function createRealtimeStatsEvents(session: SinkSessionMetadata, scenarios: LoadStrikeScenarioStats[]): ReportingSinkEvent[];
|
|
608
|
+
declare function createFinalStatsEvents(session: SinkSessionMetadata, stats: LoadStrikeNodeStats): ReportingSinkEvent[];
|
|
609
|
+
declare function createRunResultEvents(session: SinkSessionMetadata, result: LoadStrikeRunResult): ReportingSinkEvent[];
|
|
610
|
+
declare function createReportingEvent(session: SinkSessionMetadata, occurredUtc: Date, eventType: string, scenarioName: string | null, stepName: string | null, tags: Record<string, string>, fields: Record<string, unknown>): ReportingSinkEvent;
|
|
611
|
+
declare function toOtelAnyValue(value: unknown): Record<string, unknown>;
|
|
612
|
+
declare function sinkSessionMetadataFromContext(context: LoadStrikeBaseContext, session?: LoadStrikeSessionStartInfo): SinkSessionMetadata;
|
|
613
|
+
declare function mergeInfluxOptions(target: InfluxDbResolvedOptions, source: Partial<InfluxDbResolvedOptions>): void;
|
|
614
|
+
declare function mergeGrafanaLokiOptions(target: GrafanaLokiResolvedOptions, source: Partial<GrafanaLokiResolvedOptions>): void;
|
|
615
|
+
declare function mergeTimescaleDbOptions(target: TimescaleDbResolvedOptions, source: Partial<TimescaleDbResolvedOptions>): void;
|
|
616
|
+
declare function mergeDatadogOptions(target: DatadogResolvedOptions, source: Partial<DatadogResolvedOptions>): void;
|
|
617
|
+
declare function mergeSplunkOptions(target: SplunkResolvedOptions, source: Partial<SplunkResolvedOptions>): void;
|
|
618
|
+
declare function mergeOtelCollectorOptions(target: OtelCollectorResolvedOptions, source: Partial<OtelCollectorResolvedOptions>): void;
|
|
619
|
+
declare function resolveConfigSection(source: Record<string, unknown>, path: string): Record<string, unknown>;
|
|
620
|
+
declare function pickRecordValue(record: Record<string, unknown>, ...keys: string[]): unknown;
|
|
621
|
+
declare function optionString(record: Record<string, unknown>, ...keys: string[]): string;
|
|
622
|
+
declare function pickBooleanValue(record: Record<string, unknown>, fallback: boolean, ...keys: string[]): boolean;
|
|
623
|
+
declare function optionNumber(record: Record<string, unknown>, ...keys: string[]): number | undefined;
|
|
624
|
+
declare function normalizeStringMap(value: unknown): Record<string, string>;
|
|
625
|
+
declare function resolveTimeoutMs(timeoutSeconds: number | undefined, timeoutMs: number | undefined): number;
|
|
626
|
+
declare function normalizePath(path: string): string;
|
|
627
|
+
declare function trimTrailingSlashes(value: string): string;
|
|
628
|
+
declare function sanitizeGrafanaLabelKey(value: string): string;
|
|
629
|
+
declare function sanitizeGrafanaLabelValue(value: string): string;
|
|
630
|
+
declare function replaceLiteral(value: string, search: string, replacement: string): string;
|
|
631
|
+
declare function normalizePluginFieldName(value: string): string;
|
|
632
|
+
declare function normalizePluginFieldValue(value: unknown): unknown;
|
|
633
|
+
declare function tryReadText(row: Record<string, unknown>, key: string): string | null;
|
|
634
|
+
declare function cleanNullableText(value: string | null | undefined): string | null;
|
|
635
|
+
declare function validateIdentifier(value: string, parameterName: string): void;
|
|
636
|
+
declare function quoteIdentifier(schema: string, tableName: string): string;
|
|
637
|
+
declare function normalizeConfigKey(value: string): string;
|
|
638
|
+
declare function cloneBaseContext(context: LoadStrikeBaseContext): LoadStrikeBaseContext;
|
|
639
|
+
declare function cloneSessionStartInfo(session: LoadStrikeSessionStartInfo): LoadStrikeSessionStartInfo;
|
|
640
|
+
declare function cloneMetricStats(metrics: LoadStrikeMetricStats): LoadStrikeMetricStats;
|
|
641
|
+
declare function cloneScenarioStats(value: LoadStrikeScenarioStats): LoadStrikeScenarioStats;
|
|
642
|
+
declare function cloneNodeStats(result: LoadStrikeNodeStats): LoadStrikeNodeStats;
|
|
643
|
+
declare function postWithTimeout(fetchImpl: SinkFetch, url: string, init: RequestInit, timeoutMs: number, sinkName: string): Promise<void>;
|
|
644
|
+
export declare const __loadstrikeTestExports: {
|
|
645
|
+
GrafanaLokiReportingSink: typeof GrafanaLokiReportingSink;
|
|
646
|
+
InfluxDbReportingSink: typeof InfluxDbReportingSink;
|
|
647
|
+
OtelCollectorReportingSink: typeof OtelCollectorReportingSink;
|
|
648
|
+
SplunkReportingSink: typeof SplunkReportingSink;
|
|
649
|
+
TimescaleDbReportingSink: typeof TimescaleDbReportingSink;
|
|
650
|
+
cleanNullableText: typeof cleanNullableText;
|
|
651
|
+
cloneBaseContext: typeof cloneBaseContext;
|
|
652
|
+
cloneMetricStats: typeof cloneMetricStats;
|
|
653
|
+
cloneNodeStats: typeof cloneNodeStats;
|
|
654
|
+
cloneScenarioStats: typeof cloneScenarioStats;
|
|
655
|
+
cloneSessionStartInfo: typeof cloneSessionStartInfo;
|
|
656
|
+
createFinalStatsEvents: typeof createFinalStatsEvents;
|
|
657
|
+
createRealtimeStatsEvents: typeof createRealtimeStatsEvents;
|
|
658
|
+
createRunResultEvents: typeof createRunResultEvents;
|
|
659
|
+
createReportingEvent: typeof createReportingEvent;
|
|
660
|
+
mergeDatadogOptions: typeof mergeDatadogOptions;
|
|
661
|
+
mergeInfluxOptions: typeof mergeInfluxOptions;
|
|
662
|
+
mergeGrafanaLokiOptions: typeof mergeGrafanaLokiOptions;
|
|
663
|
+
mergeOtelCollectorOptions: typeof mergeOtelCollectorOptions;
|
|
664
|
+
mergeSplunkOptions: typeof mergeSplunkOptions;
|
|
665
|
+
mergeTimescaleDbOptions: typeof mergeTimescaleDbOptions;
|
|
666
|
+
normalizeConfigKey: typeof normalizeConfigKey;
|
|
667
|
+
normalizePath: typeof normalizePath;
|
|
668
|
+
normalizePluginFieldName: typeof normalizePluginFieldName;
|
|
669
|
+
normalizePluginFieldValue: typeof normalizePluginFieldValue;
|
|
670
|
+
normalizeStringMap: typeof normalizeStringMap;
|
|
671
|
+
optionNumber: typeof optionNumber;
|
|
672
|
+
optionString: typeof optionString;
|
|
673
|
+
pickBooleanValue: typeof pickBooleanValue;
|
|
674
|
+
pickRecordValue: typeof pickRecordValue;
|
|
675
|
+
postWithTimeout: typeof postWithTimeout;
|
|
676
|
+
quoteIdentifier: typeof quoteIdentifier;
|
|
677
|
+
replaceLiteral: typeof replaceLiteral;
|
|
678
|
+
resolveConfigSection: typeof resolveConfigSection;
|
|
679
|
+
resolveTimeoutMs: typeof resolveTimeoutMs;
|
|
680
|
+
sanitizeGrafanaLabelKey: typeof sanitizeGrafanaLabelKey;
|
|
681
|
+
sanitizeGrafanaLabelValue: typeof sanitizeGrafanaLabelValue;
|
|
682
|
+
sinkSessionMetadataFromContext: typeof sinkSessionMetadataFromContext;
|
|
683
|
+
toOtelAnyValue: typeof toOtelAnyValue;
|
|
684
|
+
trimTrailingSlashes: typeof trimTrailingSlashes;
|
|
685
|
+
tryReadText: typeof tryReadText;
|
|
686
|
+
validateIdentifier: typeof validateIdentifier;
|
|
687
|
+
};
|
|
497
688
|
export {};
|
|
@@ -218,6 +218,10 @@ export interface AzureEventHubsEndpointOptions {
|
|
|
218
218
|
consumerGroup?: string;
|
|
219
219
|
PartitionId?: string;
|
|
220
220
|
partitionId?: string;
|
|
221
|
+
PartitionKey?: string;
|
|
222
|
+
partitionKey?: string;
|
|
223
|
+
PartitionCount?: number;
|
|
224
|
+
partitionCount?: number;
|
|
221
225
|
StartFromEarliest?: boolean;
|
|
222
226
|
startFromEarliest?: boolean;
|
|
223
227
|
[key: string]: unknown;
|
|
@@ -515,6 +519,10 @@ export interface AzureEventHubsEndpointDefinition extends TrafficEndpointDefinit
|
|
|
515
519
|
consumerGroup?: string;
|
|
516
520
|
PartitionId?: string;
|
|
517
521
|
partitionId?: string;
|
|
522
|
+
PartitionKey?: string;
|
|
523
|
+
partitionKey?: string;
|
|
524
|
+
PartitionCount?: number;
|
|
525
|
+
partitionCount?: number;
|
|
518
526
|
StartFromEarliest?: boolean;
|
|
519
527
|
startFromEarliest?: boolean;
|
|
520
528
|
}
|
|
@@ -696,6 +704,8 @@ declare class AzureEventHubsEndpointDefinitionModel extends TrafficEndpointDefin
|
|
|
696
704
|
ConsumerGroup: string;
|
|
697
705
|
StartFromEarliest: boolean;
|
|
698
706
|
PartitionId?: string;
|
|
707
|
+
PartitionKey?: string;
|
|
708
|
+
PartitionCount?: number;
|
|
699
709
|
constructor(initial?: AzureEventHubsEndpointDefinitionInit);
|
|
700
710
|
Validate(): void;
|
|
701
711
|
}
|
|
@@ -739,7 +749,139 @@ export interface EndpointAdapter {
|
|
|
739
749
|
consume(): Promise<TrackingPayload | null>;
|
|
740
750
|
dispose?(): Promise<void>;
|
|
741
751
|
}
|
|
752
|
+
declare class CallbackAdapter implements EndpointAdapter {
|
|
753
|
+
protected readonly endpoint: EndpointDefinition;
|
|
754
|
+
private readonly consumeQueue;
|
|
755
|
+
private consumeStreamStarted;
|
|
756
|
+
constructor(endpoint: EndpointDefinition);
|
|
757
|
+
produce(payload?: TrackingPayload): Promise<TrackingPayload | null>;
|
|
758
|
+
consume(): Promise<TrackingPayload | null>;
|
|
759
|
+
dispose(): Promise<void>;
|
|
760
|
+
protected defaultPayload(): TrackingPayload;
|
|
761
|
+
private ensureConsumeStreamStarted;
|
|
762
|
+
}
|
|
763
|
+
declare class HttpEndpointAdapter extends CallbackAdapter {
|
|
764
|
+
private readonly httpConsumeQueue;
|
|
765
|
+
private oauthToken;
|
|
766
|
+
produce(payload?: TrackingPayload): Promise<TrackingPayload | null>;
|
|
767
|
+
consume(): Promise<TrackingPayload | null>;
|
|
768
|
+
private resolveOAuthToken;
|
|
769
|
+
}
|
|
770
|
+
declare class RedisStreamsEndpointAdapter extends CallbackAdapter {
|
|
771
|
+
private clientPromise;
|
|
772
|
+
private groupReady;
|
|
773
|
+
produce(payload?: TrackingPayload): Promise<TrackingPayload | null>;
|
|
774
|
+
consume(): Promise<TrackingPayload | null>;
|
|
775
|
+
dispose(): Promise<void>;
|
|
776
|
+
private getClient;
|
|
777
|
+
private ensureConsumerGroup;
|
|
778
|
+
}
|
|
779
|
+
declare class AzureEventHubsEndpointAdapter extends CallbackAdapter {
|
|
780
|
+
private producerPromise;
|
|
781
|
+
private consumerPromise;
|
|
782
|
+
private subscriptionPromise;
|
|
783
|
+
private subscription;
|
|
784
|
+
private readonly queue;
|
|
785
|
+
produce(payload?: TrackingPayload): Promise<TrackingPayload | null>;
|
|
786
|
+
consume(): Promise<TrackingPayload | null>;
|
|
787
|
+
dispose(): Promise<void>;
|
|
788
|
+
private getProducer;
|
|
789
|
+
private getConsumer;
|
|
790
|
+
private ensureSubscriptionStarted;
|
|
791
|
+
}
|
|
742
792
|
export declare class EndpointAdapterFactory {
|
|
743
793
|
static create(endpoint: EndpointDefinitionInput): EndpointAdapter;
|
|
744
794
|
}
|
|
795
|
+
declare function validateTrackingSelectorPath(expression: string, fieldName: "TrackingField" | "GatherByField"): void;
|
|
796
|
+
declare function validateHttpEndpoint(endpoint: EndpointDefinition, mode: EndpointMode, hasModeDelegate: boolean): void;
|
|
797
|
+
declare function applyHttpAuthHeaders(headers: Record<string, string>, options: HttpEndpointOptions, resolveOAuthToken: () => Promise<string>): Promise<void>;
|
|
798
|
+
declare function buildHttpRequestBody(body: unknown, bodyType: NonNullable<HttpEndpointOptions["bodyType"]>, contentType: string): unknown;
|
|
799
|
+
declare function partitionFromKey(value: string, partitionCount: number): string;
|
|
800
|
+
declare function attachPayloadHelpers(payload: TrackingPayload): TrackingPayload;
|
|
801
|
+
declare function attachDotNetTrackingPayloadAliases<T extends TrackingPayload>(payload: T): T;
|
|
802
|
+
declare function attachStructuredProducedMessageRequestAliases(request: ProducedMessageRequest, endpoint: EndpointDefinition): ProducedMessageRequest;
|
|
803
|
+
declare function createDelegateRequestEndpointView(endpoint: EndpointDefinition): Record<string, unknown>;
|
|
804
|
+
declare function prepareProducedPayload(endpoint: EndpointDefinition, payload?: TrackingPayload): TrackingPayload;
|
|
805
|
+
declare function serializePayloadBody(body: unknown, contentType?: string): Uint8Array;
|
|
806
|
+
declare function deserializeBrokerPayloadBody(body: Uint8Array, contentType?: string, messagePayloadType?: string): unknown;
|
|
807
|
+
declare function extractTrackingValue(payload: TrackingPayload, selector: string): string | null;
|
|
808
|
+
declare function injectTrackingValue(payload: TrackingPayload, selector: string, value: string): boolean;
|
|
809
|
+
declare function setJsonBodyValue(body: unknown, path: string, value: string): unknown;
|
|
810
|
+
declare function parseBodyObject(body: unknown): Record<string, unknown> | null;
|
|
811
|
+
declare function resolveConnectionMetadata(endpoint: EndpointDefinition): Record<string, string>;
|
|
812
|
+
declare function canonicalizeHttpResponseSource(value: string): HttpResponseSource;
|
|
813
|
+
declare function inferLegacyHttpResponseSource(value: string | undefined): HttpResponseSource | undefined;
|
|
814
|
+
declare function buildKafkaClientOptions(endpoint: EndpointDefinition): any;
|
|
815
|
+
declare function shouldUseConfluentKafkaClient(endpoint: EndpointDefinition): boolean;
|
|
816
|
+
declare function buildConfluentKafkaClientOptions(endpoint: EndpointDefinition): Record<string, unknown>;
|
|
817
|
+
declare function resolveKafkaOAuthBearerToken(options: Record<string, unknown>): Promise<string>;
|
|
818
|
+
declare function mapKafkaSaslMechanism(mechanism: string): string;
|
|
819
|
+
declare function mapConfluentKafkaSecurityProtocol(protocol: string): string;
|
|
820
|
+
declare function mapConfluentKafkaSaslMechanism(mechanism: string): string;
|
|
821
|
+
declare function toKafkaHeadersWithContentType(headers: Record<string, string>, contentType?: string): Record<string, Buffer>;
|
|
822
|
+
declare function fromKafkaHeaders(headers: Record<string, Buffer | Uint8Array | string | Array<Buffer | Uint8Array | string> | undefined> | undefined): Record<string, string>;
|
|
823
|
+
declare function headerValue(headers: Record<string, Buffer | Uint8Array | string | Array<Buffer | Uint8Array | string> | undefined> | undefined, expected: string): string | undefined;
|
|
824
|
+
declare function createNatsHeaders(headers: Record<string, string>, contentType?: string): Promise<any | null>;
|
|
825
|
+
declare function toHeaderRecord(value: unknown): Record<string, string>;
|
|
826
|
+
declare function bufferToUint8Array(value: unknown): Uint8Array;
|
|
827
|
+
declare function readFirstRedisStreamEntry(value: unknown): {
|
|
828
|
+
id: string;
|
|
829
|
+
fields: Record<string, Uint8Array>;
|
|
830
|
+
} | null;
|
|
831
|
+
declare function createRedisStreamPayload(fields: Record<string, Uint8Array>, endpoint: EndpointDefinition): TrackingPayload;
|
|
832
|
+
declare function payloadBodyAsUtf8(body: unknown): string;
|
|
833
|
+
export declare const __loadstrikeTestExports: {
|
|
834
|
+
AzureEventHubsEndpointAdapter: typeof AzureEventHubsEndpointAdapter;
|
|
835
|
+
AzureEventHubsEndpointDefinition: typeof AzureEventHubsEndpointDefinitionModel;
|
|
836
|
+
AzureEventHubsEndpointDefinitionModel: typeof AzureEventHubsEndpointDefinitionModel;
|
|
837
|
+
CallbackAdapter: typeof CallbackAdapter;
|
|
838
|
+
DelegateStreamEndpointDefinition: typeof DelegateStreamEndpointDefinitionModel;
|
|
839
|
+
DelegateStreamEndpointDefinitionModel: typeof DelegateStreamEndpointDefinitionModel;
|
|
840
|
+
HttpEndpointAdapter: typeof HttpEndpointAdapter;
|
|
841
|
+
NatsEndpointDefinition: typeof NatsEndpointDefinitionModel;
|
|
842
|
+
NatsEndpointDefinitionModel: typeof NatsEndpointDefinitionModel;
|
|
843
|
+
PushDiffusionEndpointDefinition: typeof PushDiffusionEndpointDefinitionModel;
|
|
844
|
+
PushDiffusionEndpointDefinitionModel: typeof PushDiffusionEndpointDefinitionModel;
|
|
845
|
+
RabbitMqEndpointDefinition: typeof RabbitMqEndpointDefinitionModel;
|
|
846
|
+
RabbitMqEndpointDefinitionModel: typeof RabbitMqEndpointDefinitionModel;
|
|
847
|
+
RedisStreamsEndpointAdapter: typeof RedisStreamsEndpointAdapter;
|
|
848
|
+
RedisStreamsEndpointDefinition: typeof RedisStreamsEndpointDefinitionModel;
|
|
849
|
+
RedisStreamsEndpointDefinitionModel: typeof RedisStreamsEndpointDefinitionModel;
|
|
850
|
+
bufferToUint8Array: typeof bufferToUint8Array;
|
|
851
|
+
applyHttpAuthHeaders: typeof applyHttpAuthHeaders;
|
|
852
|
+
buildHttpRequestBody: typeof buildHttpRequestBody;
|
|
853
|
+
buildConfluentKafkaClientOptions: typeof buildConfluentKafkaClientOptions;
|
|
854
|
+
buildKafkaClientOptions: typeof buildKafkaClientOptions;
|
|
855
|
+
canonicalizeHttpResponseSource: typeof canonicalizeHttpResponseSource;
|
|
856
|
+
createDelegateRequestEndpointView: typeof createDelegateRequestEndpointView;
|
|
857
|
+
createNatsHeaders: typeof createNatsHeaders;
|
|
858
|
+
createRedisStreamPayload: typeof createRedisStreamPayload;
|
|
859
|
+
deserializeBrokerPayloadBody: typeof deserializeBrokerPayloadBody;
|
|
860
|
+
extractTrackingValue: typeof extractTrackingValue;
|
|
861
|
+
fromKafkaHeaders: typeof fromKafkaHeaders;
|
|
862
|
+
headerValue: typeof headerValue;
|
|
863
|
+
attachDotNetTrackingPayloadAliases: typeof attachDotNetTrackingPayloadAliases;
|
|
864
|
+
attachPayloadHelpers: typeof attachPayloadHelpers;
|
|
865
|
+
attachStructuredProducedMessageRequestAliases: typeof attachStructuredProducedMessageRequestAliases;
|
|
866
|
+
inferLegacyHttpResponseSource: typeof inferLegacyHttpResponseSource;
|
|
867
|
+
injectTrackingValue: typeof injectTrackingValue;
|
|
868
|
+
mapConfluentKafkaSaslMechanism: typeof mapConfluentKafkaSaslMechanism;
|
|
869
|
+
mapConfluentKafkaSecurityProtocol: typeof mapConfluentKafkaSecurityProtocol;
|
|
870
|
+
mapKafkaSaslMechanism: typeof mapKafkaSaslMechanism;
|
|
871
|
+
parseBodyObject: typeof parseBodyObject;
|
|
872
|
+
partitionFromKey: typeof partitionFromKey;
|
|
873
|
+
payloadBodyAsUtf8: typeof payloadBodyAsUtf8;
|
|
874
|
+
prepareProducedPayload: typeof prepareProducedPayload;
|
|
875
|
+
protocolBus: unknown;
|
|
876
|
+
readFirstRedisStreamEntry: typeof readFirstRedisStreamEntry;
|
|
877
|
+
resolveConnectionMetadata: typeof resolveConnectionMetadata;
|
|
878
|
+
resolveKafkaOAuthBearerToken: typeof resolveKafkaOAuthBearerToken;
|
|
879
|
+
serializePayloadBody: typeof serializePayloadBody;
|
|
880
|
+
setJsonBodyValue: typeof setJsonBodyValue;
|
|
881
|
+
shouldUseConfluentKafkaClient: typeof shouldUseConfluentKafkaClient;
|
|
882
|
+
toHeaderRecord: typeof toHeaderRecord;
|
|
883
|
+
toKafkaHeadersWithContentType: typeof toKafkaHeadersWithContentType;
|
|
884
|
+
validateHttpEndpoint: typeof validateHttpEndpoint;
|
|
885
|
+
validateTrackingSelectorPath: typeof validateTrackingSelectorPath;
|
|
886
|
+
};
|
|
745
887
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadstrike/loadstrike-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10801",
|
|
4
4
|
"description": "TypeScript and JavaScript SDK for in-process load execution, traffic correlation, and reporting.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"load-testing",
|
|
@@ -40,12 +40,6 @@
|
|
|
40
40
|
"require": "./dist/cjs/contracts.js",
|
|
41
41
|
"default": "./dist/esm/contracts.js"
|
|
42
42
|
},
|
|
43
|
-
"./local": {
|
|
44
|
-
"types": "./dist/types/local.d.ts",
|
|
45
|
-
"import": "./dist/esm/local.js",
|
|
46
|
-
"require": "./dist/cjs/local.js",
|
|
47
|
-
"default": "./dist/esm/local.js"
|
|
48
|
-
},
|
|
49
43
|
"./correlation": {
|
|
50
44
|
"types": "./dist/types/correlation.d.ts",
|
|
51
45
|
"import": "./dist/esm/correlation.js",
|
|
@@ -57,18 +51,6 @@
|
|
|
57
51
|
"import": "./dist/esm/transports.js",
|
|
58
52
|
"require": "./dist/cjs/transports.js",
|
|
59
53
|
"default": "./dist/esm/transports.js"
|
|
60
|
-
},
|
|
61
|
-
"./cluster": {
|
|
62
|
-
"types": "./dist/types/cluster.d.ts",
|
|
63
|
-
"import": "./dist/esm/cluster.js",
|
|
64
|
-
"require": "./dist/cjs/cluster.js",
|
|
65
|
-
"default": "./dist/esm/cluster.js"
|
|
66
|
-
},
|
|
67
|
-
"./sinks": {
|
|
68
|
-
"types": "./dist/types/sinks.d.ts",
|
|
69
|
-
"import": "./dist/esm/sinks.js",
|
|
70
|
-
"require": "./dist/cjs/sinks.js",
|
|
71
|
-
"default": "./dist/esm/sinks.js"
|
|
72
54
|
}
|
|
73
55
|
},
|
|
74
56
|
"files": [
|
|
@@ -83,7 +65,11 @@
|
|
|
83
65
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
84
66
|
"build:post": "node ./scripts/postbuild.mjs",
|
|
85
67
|
"clean": "rimraf dist",
|
|
68
|
+
"audit": "npm audit --audit-level=moderate",
|
|
69
|
+
"audit:fix": "npm audit fix --package-lock-only",
|
|
70
|
+
"pretest": "npm run build",
|
|
86
71
|
"test": "npm run test:coverage",
|
|
72
|
+
"test:clean": "npm run clean && npm test",
|
|
87
73
|
"test:coverage": "c8 --check-coverage --lines 89.5 --branches 81.6 --functions 95.5 node ./scripts/run-tests.mjs",
|
|
88
74
|
"test:unit": "node ./scripts/run-tests.mjs",
|
|
89
75
|
"test:broker": "node --test --test-concurrency=1 tests/broker-integration.test.mjs tests/broker-distributed.test.mjs"
|
|
@@ -107,5 +93,8 @@
|
|
|
107
93
|
"c8": "^11.0.0",
|
|
108
94
|
"rimraf": "^6.0.1",
|
|
109
95
|
"typescript": "^5.9.2"
|
|
96
|
+
},
|
|
97
|
+
"overrides": {
|
|
98
|
+
"brace-expansion": "5.0.5"
|
|
110
99
|
}
|
|
111
100
|
}
|