@loadstrike/loadstrike-sdk 1.0.22801 → 1.0.23201

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.
@@ -558,6 +558,8 @@ export interface LoadStrikeSinkSession {
558
558
  configPath?: string;
559
559
  infraConfigPath?: string;
560
560
  infraConfig?: Record<string, unknown>;
561
+ runToken?: string;
562
+ portalReportingIngestUrl?: string;
561
563
  }
562
564
  export interface LoadStrikeBaseContext {
563
565
  logger: LoadStrikeLogger;
@@ -573,9 +575,13 @@ export interface LoadStrikeSessionStartInfo extends LoadStrikeBaseContext {
573
575
  startedUtc: string;
574
576
  scenarioNames: string[];
575
577
  scenarios: LoadStrikeScenarioStartInfo[];
578
+ runToken?: string;
579
+ portalReportingIngestUrl?: string;
576
580
  readonly StartedUtc?: string;
577
581
  readonly ScenarioNames?: string[];
578
582
  readonly Scenarios?: LoadStrikeScenarioStartInfo[];
583
+ readonly RunToken?: string;
584
+ readonly PortalReportingIngestUrl?: string;
579
585
  }
580
586
  type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> & {
581
587
  [Key in Keys]-?: Required<Pick<T, Key>> & Partial<Pick<T, Exclude<Keys, Key>>>;
@@ -1339,6 +1345,8 @@ export declare class LoadStrikeContext {
1339
1345
  * Use this when run results must be pushed to external observability or storage systems.
1340
1346
  */
1341
1347
  WithReportingSinks(...sinks: ILoadStrikeReportingSink[]): LoadStrikeContext;
1348
+ withPortalReporting(): LoadStrikeContext;
1349
+ WithPortalReporting(): LoadStrikeContext;
1342
1350
  /**
1343
1351
  * Registers runtime policies for the run.
1344
1352
  * Use this when scenario selection or step execution should obey policy callbacks.
@@ -1790,6 +1798,7 @@ export declare class LoadStrikeRunner {
1790
1798
  * Use this when run results must be pushed to external observability or storage systems.
1791
1799
  */
1792
1800
  static WithReportingSinks(context: LoadStrikeContext, ...sinks: ILoadStrikeReportingSink[]): LoadStrikeContext;
1801
+ static WithPortalReporting(context: LoadStrikeContext): LoadStrikeContext;
1793
1802
  /**
1794
1803
  * Registers runtime policies for the run.
1795
1804
  * Use this when scenario selection or step execution should obey policy callbacks.
@@ -1924,6 +1933,10 @@ export declare class LoadStrikeRunner {
1924
1933
  * Use this when sinks or dashboards should receive updates at a controlled interval.
1925
1934
  */
1926
1935
  WithReportingInterval(intervalSeconds: number): LoadStrikeRunner;
1936
+ withReportingSinks(...sinks: ILoadStrikeReportingSink[]): LoadStrikeRunner;
1937
+ WithReportingSinks(...sinks: ILoadStrikeReportingSink[]): LoadStrikeRunner;
1938
+ withPortalReporting(): LoadStrikeRunner;
1939
+ WithPortalReporting(): LoadStrikeRunner;
1927
1940
  /**
1928
1941
  * Sets the timeout for cluster command round-trips.
1929
1942
  * Use this when distributed control messages need a tighter or looser deadline.
@@ -21,10 +21,6 @@ interface LoadStrikeNodeStats {
21
21
  sinkErrors: LoadStrikeSinkError[];
22
22
  reportFiles: string[];
23
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
24
  }
29
25
  type SinkFetch = (input: string, init?: RequestInit) => Promise<Response>;
30
26
  interface ReportingSinkEvent {
@@ -282,6 +278,14 @@ export interface OtelCollectorSinkOptionsInput {
282
278
  FetchImpl?: SinkFetch;
283
279
  fetchImpl?: SinkFetch;
284
280
  }
281
+ export interface PortalReportingSinkOptionsInput {
282
+ TimeoutSeconds?: number;
283
+ timeoutSeconds?: number;
284
+ TimeoutMs?: number;
285
+ timeoutMs?: number;
286
+ FetchImpl?: SinkFetch;
287
+ fetchImpl?: SinkFetch;
288
+ }
285
289
  export declare class InfluxDbReportingSinkOptions {
286
290
  ConfigurationSectionPath: string;
287
291
  BaseUrl: string;
@@ -439,6 +443,35 @@ export declare class CompositeReportingSink implements LoadStrikeReportingSink {
439
443
  stop(): Promise<void>;
440
444
  Stop(): Promise<void>;
441
445
  }
446
+ export declare class PortalReportingSink implements LoadStrikeReportingSink {
447
+ readonly sinkName = "portal";
448
+ readonly SinkName = "portal";
449
+ readonly licenseFeature = "extensions.reporting_sinks.portal";
450
+ readonly LicenseFeature = "extensions.reporting_sinks.portal";
451
+ private readonly fetchImpl;
452
+ private readonly timeoutMs;
453
+ private baseContext;
454
+ private session;
455
+ private runToken;
456
+ private ingestUrl;
457
+ constructor(options?: PortalReportingSinkOptionsInput);
458
+ init(context: LoadStrikeBaseContext, _infraConfig: Record<string, unknown>): void;
459
+ Init(context: LoadStrikeBaseContext, infraConfig: Record<string, unknown>): void;
460
+ start(session: LoadStrikeSessionStartInfo): void;
461
+ Start(session: LoadStrikeSessionStartInfo): void;
462
+ saveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
463
+ SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
464
+ saveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
465
+ SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
466
+ saveRunResult(result: LoadStrikeRunResult): Promise<void>;
467
+ SaveRunResult(result: LoadStrikeRunResult): Promise<void>;
468
+ stop(): void;
469
+ Stop(): void;
470
+ Dispose(): void;
471
+ private getBaseContext;
472
+ private getSession;
473
+ private persistEvents;
474
+ }
442
475
  export declare class InfluxDbReportingSink implements LoadStrikeReportingSink {
443
476
  readonly sinkName = "influxdb";
444
477
  readonly SinkName = "influxdb";
@@ -1,7 +1,7 @@
1
1
  import { TrackingFieldSelector, type TrackingPayload } from "./correlation.js";
2
2
  export declare const LOADSTRIKE_TRACE_ID_HEADER = "loadstrike-trace-id";
3
3
  export declare const LOADSTRIKE_TRACE_ID_TRACKING_FIELD = "header:loadstrike-trace-id";
4
- export type EndpointKind = "Http" | "Kafka" | "RabbitMq" | "Nats" | "RedisStreams" | "AzureEventHubs" | "PushDiffusion" | "DelegateStream";
4
+ export type EndpointKind = "Http" | "Kafka" | "RabbitMq" | "Nats" | "RedisStreams" | "AzureEventHubs" | "Sqs" | "PushDiffusion" | "DelegateStream";
5
5
  export type EndpointMode = "Produce" | "Consume";
6
6
  export type HttpAuthMode = "None" | "Basic" | "Bearer" | "OAuth2ClientCredentials";
7
7
  export type HttpAuthType = HttpAuthMode;
@@ -228,6 +228,29 @@ export interface AzureEventHubsEndpointOptions {
228
228
  startFromEarliest?: boolean;
229
229
  [key: string]: unknown;
230
230
  }
231
+ export interface SqsEndpointOptions {
232
+ QueueUrl?: string;
233
+ queueUrl?: string;
234
+ Region?: string;
235
+ region?: string;
236
+ ServiceUrl?: string;
237
+ serviceUrl?: string;
238
+ AccessKeyId?: string;
239
+ accessKeyId?: string;
240
+ SecretAccessKey?: string;
241
+ secretAccessKey?: string;
242
+ SessionToken?: string;
243
+ sessionToken?: string;
244
+ WaitTimeSeconds?: number;
245
+ waitTimeSeconds?: number;
246
+ MaxNumberOfMessages?: number;
247
+ maxNumberOfMessages?: number;
248
+ VisibilityTimeoutSeconds?: number;
249
+ visibilityTimeoutSeconds?: number;
250
+ DeleteAfterConsume?: boolean;
251
+ deleteAfterConsume?: boolean;
252
+ [key: string]: unknown;
253
+ }
231
254
  export interface PushDiffusionEndpointOptions {
232
255
  ServerUrl?: string;
233
256
  serverUrl?: string;
@@ -322,6 +345,8 @@ export interface EndpointDefinition {
322
345
  redisStreams?: RedisStreamsEndpointOptions;
323
346
  AzureEventHubs?: AzureEventHubsEndpointOptions;
324
347
  azureEventHubs?: AzureEventHubsEndpointOptions;
348
+ Sqs?: SqsEndpointOptions;
349
+ sqs?: SqsEndpointOptions;
325
350
  PushDiffusion?: PushDiffusionEndpointOptions;
326
351
  pushDiffusion?: PushDiffusionEndpointOptions;
327
352
  Delegate?: DelegateEndpointOptions;
@@ -394,6 +419,7 @@ export interface DotNetEndpointDefinition {
394
419
  Nats?: NatsEndpointOptions;
395
420
  RedisStreams?: RedisStreamsEndpointOptions;
396
421
  AzureEventHubs?: AzureEventHubsEndpointOptions;
422
+ Sqs?: SqsEndpointOptions;
397
423
  PushDiffusion?: PushDiffusionEndpointOptions;
398
424
  Delegate?: DotNetDelegateEndpointOptions;
399
425
  DelegateStream?: DotNetDelegateEndpointOptions;
@@ -528,6 +554,30 @@ export interface AzureEventHubsEndpointDefinition extends TrafficEndpointDefinit
528
554
  StartFromEarliest?: boolean;
529
555
  startFromEarliest?: boolean;
530
556
  }
557
+ export interface SqsEndpointDefinition extends TrafficEndpointDefinition {
558
+ Kind?: "Sqs";
559
+ kind?: "Sqs";
560
+ QueueUrl?: string;
561
+ queueUrl?: string;
562
+ Region?: string;
563
+ region?: string;
564
+ ServiceUrl?: string;
565
+ serviceUrl?: string;
566
+ AccessKeyId?: string;
567
+ accessKeyId?: string;
568
+ SecretAccessKey?: string;
569
+ secretAccessKey?: string;
570
+ SessionToken?: string;
571
+ sessionToken?: string;
572
+ WaitTimeSeconds?: number;
573
+ waitTimeSeconds?: number;
574
+ MaxNumberOfMessages?: number;
575
+ maxNumberOfMessages?: number;
576
+ VisibilityTimeoutSeconds?: number;
577
+ visibilityTimeoutSeconds?: number;
578
+ DeleteAfterConsume?: boolean;
579
+ deleteAfterConsume?: boolean;
580
+ }
531
581
  export interface DelegateStreamEndpointDefinition extends TrafficEndpointDefinition {
532
582
  Kind?: "DelegateStream";
533
583
  kind?: "DelegateStream";
@@ -570,6 +620,7 @@ type RabbitMqEndpointDefinitionInit = Partial<RabbitMqEndpointDefinition>;
570
620
  type NatsEndpointDefinitionInit = Partial<NatsEndpointDefinition>;
571
621
  type RedisStreamsEndpointDefinitionInit = Partial<RedisStreamsEndpointDefinition>;
572
622
  type AzureEventHubsEndpointDefinitionInit = Partial<AzureEventHubsEndpointDefinition>;
623
+ type SqsEndpointDefinitionInit = Partial<SqsEndpointDefinition>;
573
624
  type DelegateStreamEndpointDefinitionInit = Partial<DelegateStreamEndpointDefinition>;
574
625
  type PushDiffusionEndpointDefinitionInit = Partial<PushDiffusionEndpointDefinition>;
575
626
  declare abstract class TrafficEndpointDefinitionModel {
@@ -711,6 +762,21 @@ declare class AzureEventHubsEndpointDefinitionModel extends TrafficEndpointDefin
711
762
  constructor(initial?: AzureEventHubsEndpointDefinitionInit);
712
763
  Validate(): void;
713
764
  }
765
+ declare class SqsEndpointDefinitionModel extends TrafficEndpointDefinitionModel {
766
+ readonly Kind: "Sqs";
767
+ QueueUrl: string;
768
+ Region: string;
769
+ ServiceUrl?: string;
770
+ AccessKeyId?: string;
771
+ SecretAccessKey?: string;
772
+ SessionToken?: string;
773
+ WaitTimeSeconds: number;
774
+ MaxNumberOfMessages: number;
775
+ VisibilityTimeoutSeconds?: number;
776
+ DeleteAfterConsume: boolean;
777
+ constructor(initial?: SqsEndpointDefinitionInit);
778
+ Validate(): void;
779
+ }
714
780
  declare class DelegateStreamEndpointDefinitionModel extends TrafficEndpointDefinitionModel {
715
781
  readonly Kind: "DelegateStream";
716
782
  Produce?: (payload: TrackingPayload) => Promise<TrackingPayload | null> | TrackingPayload | null;
@@ -740,12 +806,13 @@ export declare const RabbitMqEndpointDefinition: typeof RabbitMqEndpointDefiniti
740
806
  export declare const NatsEndpointDefinition: typeof NatsEndpointDefinitionModel;
741
807
  export declare const RedisStreamsEndpointDefinition: typeof RedisStreamsEndpointDefinitionModel;
742
808
  export declare const AzureEventHubsEndpointDefinition: typeof AzureEventHubsEndpointDefinitionModel;
809
+ export declare const SqsEndpointDefinition: typeof SqsEndpointDefinitionModel;
743
810
  export declare const DelegateStreamEndpointDefinition: typeof DelegateStreamEndpointDefinitionModel;
744
811
  export declare const PushDiffusionEndpointDefinition: typeof PushDiffusionEndpointDefinitionModel;
745
812
  export declare const HttpOAuth2ClientCredentialsOptions: typeof HttpOAuth2ClientCredentialsOptionsModel;
746
813
  export declare const HttpAuthOptions: typeof HttpAuthOptionsModel;
747
814
  export declare const KafkaSaslOptions: typeof KafkaSaslOptionsModel;
748
- export type EndpointDefinitionInput = EndpointDefinition | DotNetEndpointDefinition | HttpEndpointDefinition | KafkaEndpointDefinition | RabbitMqEndpointDefinition | NatsEndpointDefinition | RedisStreamsEndpointDefinition | AzureEventHubsEndpointDefinition | DelegateStreamEndpointDefinition | PushDiffusionEndpointDefinition;
815
+ export type EndpointDefinitionInput = EndpointDefinition | DotNetEndpointDefinition | HttpEndpointDefinition | KafkaEndpointDefinition | RabbitMqEndpointDefinition | NatsEndpointDefinition | RedisStreamsEndpointDefinition | AzureEventHubsEndpointDefinition | SqsEndpointDefinition | DelegateStreamEndpointDefinition | PushDiffusionEndpointDefinition;
749
816
  export interface EndpointAdapter {
750
817
  initialize?(): Promise<void>;
751
818
  produce(payload?: TrackingPayload): Promise<TrackingPayload | null>;
@@ -794,6 +861,18 @@ declare class AzureEventHubsEndpointAdapter extends CallbackAdapter {
794
861
  private getConsumer;
795
862
  private ensureSubscriptionStarted;
796
863
  }
864
+ type SqsClientLike = {
865
+ send(command: unknown): Promise<unknown>;
866
+ destroy?: () => void;
867
+ };
868
+ declare let sqsClientFactoryForTests: ((endpoint: EndpointDefinition) => SqsClientLike | Promise<SqsClientLike>) | null;
869
+ declare class SqsEndpointAdapter extends CallbackAdapter {
870
+ private clientPromise;
871
+ produce(payload?: TrackingPayload): Promise<TrackingPayload | null>;
872
+ consume(): Promise<TrackingPayload | null>;
873
+ dispose(): Promise<void>;
874
+ private getClient;
875
+ }
797
876
  export declare class EndpointAdapterFactory {
798
877
  static create(endpoint: EndpointDefinitionInput): EndpointAdapter;
799
878
  }
@@ -834,6 +913,16 @@ declare function readFirstRedisStreamEntry(value: unknown): {
834
913
  fields: Record<string, Uint8Array>;
835
914
  } | null;
836
915
  declare function createRedisStreamPayload(fields: Record<string, Uint8Array>, endpoint: EndpointDefinition): TrackingPayload;
916
+ declare function toSqsMessageAttributes(headers: Record<string, string>, contentType?: string): Record<string, {
917
+ DataType: string;
918
+ StringValue: string;
919
+ }>;
920
+ declare function fromSqsMessageAttributes(attributes: Record<string, {
921
+ StringValue?: string;
922
+ } | undefined> | undefined): {
923
+ headers: Record<string, string>;
924
+ contentType?: string;
925
+ };
837
926
  declare function payloadBodyAsUtf8(body: unknown): string;
838
927
  export declare const __loadstrikeTestExports: {
839
928
  AzureEventHubsEndpointAdapter: typeof AzureEventHubsEndpointAdapter;
@@ -852,6 +941,9 @@ export declare const __loadstrikeTestExports: {
852
941
  RedisStreamsEndpointAdapter: typeof RedisStreamsEndpointAdapter;
853
942
  RedisStreamsEndpointDefinition: typeof RedisStreamsEndpointDefinitionModel;
854
943
  RedisStreamsEndpointDefinitionModel: typeof RedisStreamsEndpointDefinitionModel;
944
+ SqsEndpointAdapter: typeof SqsEndpointAdapter;
945
+ SqsEndpointDefinition: typeof SqsEndpointDefinitionModel;
946
+ SqsEndpointDefinitionModel: typeof SqsEndpointDefinitionModel;
855
947
  bufferToUint8Array: typeof bufferToUint8Array;
856
948
  applyHttpAuthHeaders: typeof applyHttpAuthHeaders;
857
949
  buildHttpRequestBody: typeof buildHttpRequestBody;
@@ -886,6 +978,9 @@ export declare const __loadstrikeTestExports: {
886
978
  shouldUseConfluentKafkaClient: typeof shouldUseConfluentKafkaClient;
887
979
  toHeaderRecord: typeof toHeaderRecord;
888
980
  toKafkaHeadersWithContentType: typeof toKafkaHeadersWithContentType;
981
+ toSqsMessageAttributes: typeof toSqsMessageAttributes;
982
+ fromSqsMessageAttributes: typeof fromSqsMessageAttributes;
983
+ setSqsClientFactoryForTests: (factory: typeof sqsClientFactoryForTests) => void;
889
984
  validateHttpEndpoint: typeof validateHttpEndpoint;
890
985
  validateTrackingSelectorPath: typeof validateTrackingSelectorPath;
891
986
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loadstrike/loadstrike-sdk",
3
- "version": "1.0.22801",
3
+ "version": "1.0.23201",
4
4
  "description": "TypeScript and JavaScript SDK for in-process load execution, traffic correlation, and reporting.",
5
5
  "keywords": [
6
6
  "load-testing",
@@ -37,12 +37,6 @@
37
37
  "import": "./dist/esm/correlation.js",
38
38
  "require": "./dist/cjs/correlation.js",
39
39
  "default": "./dist/esm/correlation.js"
40
- },
41
- "./transports": {
42
- "types": "./dist/types/transports.d.ts",
43
- "import": "./dist/esm/transports.js",
44
- "require": "./dist/cjs/transports.js",
45
- "default": "./dist/esm/transports.js"
46
40
  }
47
41
  },
48
42
  "files": [
@@ -67,6 +61,7 @@
67
61
  "test:broker": "node --test --test-concurrency=1 tests/broker-integration.test.mjs tests/broker-distributed.test.mjs"
68
62
  },
69
63
  "dependencies": {
64
+ "@aws-sdk/client-sqs": "^3.1045.0",
70
65
  "@azure/event-hubs": "^5.12.2",
71
66
  "@confluentinc/kafka-javascript": "^1.8.2",
72
67
  "@types/pg": "^8.18.0",