@loadstrike/loadstrike-sdk 1.0.26701 → 1.0.27101
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 +7 -0
- package/dist/cjs/index.js +8 -2
- package/dist/cjs/local.js +62 -10
- package/dist/cjs/runtime.js +344 -1
- package/dist/cjs/transports.js +346 -12
- package/dist/esm/index.js +2 -2
- package/dist/esm/local.js +62 -10
- package/dist/esm/runtime.js +339 -0
- package/dist/esm/transports.js +345 -11
- package/dist/types/contracts.d.ts +18 -0
- package/dist/types/index.d.ts +5 -5
- package/dist/types/local.d.ts +1 -2
- package/dist/types/runtime.d.ts +130 -0
- package/dist/types/transports.d.ts +80 -2
- package/package.json +3 -2
package/dist/cjs/transports.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.__loadstrikeTestExports = exports.EndpointAdapterFactory = exports.KafkaSaslOptions = exports.HttpAuthOptions = exports.HttpOAuth2ClientCredentialsOptions = exports.PushDiffusionEndpointDefinition = exports.DelegateStreamEndpointDefinition = exports.SqsEndpointDefinition = exports.AzureEventHubsEndpointDefinition = exports.RedisStreamsEndpointDefinition = exports.NatsEndpointDefinition = exports.RabbitMqEndpointDefinition = exports.KafkaEndpointDefinition = exports.HttpEndpointDefinition = exports.TrafficEndpointDefinition = exports.LOADSTRIKE_TRACE_ID_TRACKING_FIELD = exports.LOADSTRIKE_TRACE_ID_HEADER = void 0;
|
|
36
|
+
exports.__loadstrikeTestExports = exports.EndpointAdapterFactory = exports.KafkaSaslOptions = exports.HttpAuthOptions = exports.HttpOAuth2ClientCredentialsOptions = exports.WebSocketEndpointDefinition = exports.GrpcEndpointDefinition = exports.PushDiffusionEndpointDefinition = exports.DelegateStreamEndpointDefinition = exports.SqsEndpointDefinition = exports.AzureEventHubsEndpointDefinition = exports.RedisStreamsEndpointDefinition = exports.NatsEndpointDefinition = exports.RabbitMqEndpointDefinition = exports.KafkaEndpointDefinition = exports.HttpEndpointDefinition = exports.TrafficEndpointDefinition = exports.LOADSTRIKE_TRACE_ID_TRACKING_FIELD = exports.LOADSTRIKE_TRACE_ID_HEADER = void 0;
|
|
37
37
|
const node_crypto_1 = require("node:crypto");
|
|
38
38
|
const correlation_js_1 = require("./correlation.js");
|
|
39
39
|
exports.LOADSTRIKE_TRACE_ID_HEADER = "loadstrike-trace-id";
|
|
@@ -321,6 +321,74 @@ class PushDiffusionEndpointDefinitionModel extends TrafficEndpointDefinitionMode
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
+
class GrpcEndpointDefinitionModel extends TrafficEndpointDefinitionModel {
|
|
325
|
+
constructor(initial) {
|
|
326
|
+
super(initial);
|
|
327
|
+
this.Kind = "Grpc";
|
|
328
|
+
this.Target = "";
|
|
329
|
+
this.ServiceName = "";
|
|
330
|
+
this.MethodName = "";
|
|
331
|
+
this.MethodType = "Unary";
|
|
332
|
+
this.DeadlineSeconds = 30;
|
|
333
|
+
this.ConnectionMetadata = {};
|
|
334
|
+
this.Metadata = {};
|
|
335
|
+
initializeGrpcEndpointDefinitionModel(this, initial);
|
|
336
|
+
}
|
|
337
|
+
Validate() {
|
|
338
|
+
super.Validate();
|
|
339
|
+
requireNonEmptyString(this.Target, "Target must be provided for gRPC endpoint definitions.");
|
|
340
|
+
requireNonEmptyString(this.ServiceName, "ServiceName must be provided for gRPC endpoint definitions.");
|
|
341
|
+
requireNonEmptyString(this.MethodName, "MethodName must be provided for gRPC endpoint definitions.");
|
|
342
|
+
requireNonEmptyString(this.MethodType, "MethodType must be provided for gRPC endpoint definitions.");
|
|
343
|
+
if (this.DeadlineSeconds <= 0) {
|
|
344
|
+
throw new RangeError("Deadline must be greater than zero.");
|
|
345
|
+
}
|
|
346
|
+
if (this.Mode === "Produce" && typeof this.ProduceAsync !== "function") {
|
|
347
|
+
throw new Error("ProduceAsync delegate must be provided when endpoint mode is Produce.");
|
|
348
|
+
}
|
|
349
|
+
if (this.Mode === "Consume" && typeof this.ConsumeAsync !== "function") {
|
|
350
|
+
throw new Error("ConsumeAsync delegate must be provided when endpoint mode is Consume.");
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
class WebSocketEndpointDefinitionModel extends TrafficEndpointDefinitionModel {
|
|
355
|
+
constructor(initial) {
|
|
356
|
+
super(initial);
|
|
357
|
+
this.Kind = "WebSocket";
|
|
358
|
+
this.Url = "";
|
|
359
|
+
this.Subprotocols = [];
|
|
360
|
+
this.ConnectTimeoutSeconds = 30;
|
|
361
|
+
this.CloseTimeoutSeconds = 5;
|
|
362
|
+
this.ConnectionMetadata = {};
|
|
363
|
+
initializeWebSocketEndpointDefinitionModel(this, initial);
|
|
364
|
+
}
|
|
365
|
+
Validate() {
|
|
366
|
+
super.Validate();
|
|
367
|
+
const url = requireNonEmptyString(this.Url, "Url must be provided for WebSocket endpoint definitions.");
|
|
368
|
+
let parsed;
|
|
369
|
+
try {
|
|
370
|
+
parsed = new URL(url);
|
|
371
|
+
}
|
|
372
|
+
catch {
|
|
373
|
+
throw new Error("Url must be an absolute ws:// or wss:// URI.");
|
|
374
|
+
}
|
|
375
|
+
if (parsed.protocol !== "ws:" && parsed.protocol !== "wss:") {
|
|
376
|
+
throw new Error("Url must be an absolute ws:// or wss:// URI.");
|
|
377
|
+
}
|
|
378
|
+
if (this.ConnectTimeoutSeconds <= 0) {
|
|
379
|
+
throw new RangeError("ConnectTimeout must be greater than zero.");
|
|
380
|
+
}
|
|
381
|
+
if (this.CloseTimeoutSeconds <= 0) {
|
|
382
|
+
throw new RangeError("CloseTimeout must be greater than zero.");
|
|
383
|
+
}
|
|
384
|
+
if (this.Mode === "Produce" && typeof this.ProduceAsync !== "function") {
|
|
385
|
+
throw new Error("ProduceAsync delegate must be provided when endpoint mode is Produce.");
|
|
386
|
+
}
|
|
387
|
+
if (this.Mode === "Consume" && typeof this.ConsumeAsync !== "function") {
|
|
388
|
+
throw new Error("ConsumeAsync delegate must be provided when endpoint mode is Consume.");
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
324
392
|
exports.TrafficEndpointDefinition = TrafficEndpointDefinitionModel;
|
|
325
393
|
exports.HttpEndpointDefinition = HttpEndpointDefinitionModel;
|
|
326
394
|
exports.KafkaEndpointDefinition = KafkaEndpointDefinitionModel;
|
|
@@ -331,6 +399,8 @@ exports.AzureEventHubsEndpointDefinition = AzureEventHubsEndpointDefinitionModel
|
|
|
331
399
|
exports.SqsEndpointDefinition = SqsEndpointDefinitionModel;
|
|
332
400
|
exports.DelegateStreamEndpointDefinition = DelegateStreamEndpointDefinitionModel;
|
|
333
401
|
exports.PushDiffusionEndpointDefinition = PushDiffusionEndpointDefinitionModel;
|
|
402
|
+
exports.GrpcEndpointDefinition = GrpcEndpointDefinitionModel;
|
|
403
|
+
exports.WebSocketEndpointDefinition = WebSocketEndpointDefinitionModel;
|
|
334
404
|
exports.HttpOAuth2ClientCredentialsOptions = HttpOAuth2ClientCredentialsOptionsModel;
|
|
335
405
|
exports.HttpAuthOptions = HttpAuthOptionsModel;
|
|
336
406
|
exports.KafkaSaslOptions = KafkaSaslOptionsModel;
|
|
@@ -780,6 +850,101 @@ function initializePushDiffusionEndpointDefinitionModel(target, initial) {
|
|
|
780
850
|
target.SubscribeAsync = subscribeAsync;
|
|
781
851
|
}
|
|
782
852
|
}
|
|
853
|
+
function initializeGrpcEndpointDefinitionModel(target, initial) {
|
|
854
|
+
const raw = asRecordOrEmpty(initial);
|
|
855
|
+
const targetUrl = pickOptionalEndpointString(raw, "Target", "target");
|
|
856
|
+
if (targetUrl) {
|
|
857
|
+
target.Target = targetUrl;
|
|
858
|
+
}
|
|
859
|
+
const serviceName = pickOptionalEndpointString(raw, "ServiceName", "serviceName");
|
|
860
|
+
if (serviceName) {
|
|
861
|
+
target.ServiceName = serviceName;
|
|
862
|
+
}
|
|
863
|
+
const methodName = pickOptionalEndpointString(raw, "MethodName", "methodName");
|
|
864
|
+
if (methodName) {
|
|
865
|
+
target.MethodName = methodName;
|
|
866
|
+
}
|
|
867
|
+
const methodType = pickOptionalEndpointString(raw, "MethodType", "methodType");
|
|
868
|
+
if (methodType) {
|
|
869
|
+
target.MethodType = methodType;
|
|
870
|
+
}
|
|
871
|
+
const deadlineMs = pickOptionalEndpointNumber(raw, "DeadlineMs", "deadlineMs");
|
|
872
|
+
const deadlineSeconds = pickOptionalEndpointNumber(raw, "DeadlineSeconds", "deadlineSeconds", "Deadline", "deadline");
|
|
873
|
+
if (deadlineMs != null) {
|
|
874
|
+
target.DeadlineSeconds = deadlineMs / 1000;
|
|
875
|
+
}
|
|
876
|
+
else if (deadlineSeconds != null) {
|
|
877
|
+
target.DeadlineSeconds = deadlineSeconds;
|
|
878
|
+
}
|
|
879
|
+
const produce = pickEndpointFunction(raw, "Produce", "produce");
|
|
880
|
+
if (produce) {
|
|
881
|
+
target.Produce = produce;
|
|
882
|
+
}
|
|
883
|
+
const consume = pickEndpointFunction(raw, "Consume", "consume");
|
|
884
|
+
if (consume) {
|
|
885
|
+
target.Consume = consume;
|
|
886
|
+
}
|
|
887
|
+
const produceAsync = pickEndpointFunction(raw, "ProduceAsync", "produceAsync");
|
|
888
|
+
if (produceAsync) {
|
|
889
|
+
target.ProduceAsync = produceAsync;
|
|
890
|
+
}
|
|
891
|
+
const consumeAsync = pickEndpointFunction(raw, "ConsumeAsync", "consumeAsync");
|
|
892
|
+
if (consumeAsync) {
|
|
893
|
+
target.ConsumeAsync = consumeAsync;
|
|
894
|
+
}
|
|
895
|
+
if (hasAnyEndpointField(raw, ["ConnectionMetadata", "connectionMetadata"])) {
|
|
896
|
+
target.ConnectionMetadata = pickEndpointStringRecord(raw, "ConnectionMetadata", "connectionMetadata");
|
|
897
|
+
}
|
|
898
|
+
if (hasAnyEndpointField(raw, ["Metadata", "metadata"])) {
|
|
899
|
+
target.Metadata = pickEndpointStringRecord(raw, "Metadata", "metadata");
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
function initializeWebSocketEndpointDefinitionModel(target, initial) {
|
|
903
|
+
const raw = asRecordOrEmpty(initial);
|
|
904
|
+
const url = pickOptionalEndpointString(raw, "Url", "url");
|
|
905
|
+
if (url) {
|
|
906
|
+
target.Url = url;
|
|
907
|
+
}
|
|
908
|
+
const subprotocols = pickEndpointStringArray(raw, "Subprotocols", "subprotocols");
|
|
909
|
+
if (subprotocols) {
|
|
910
|
+
target.Subprotocols = subprotocols;
|
|
911
|
+
}
|
|
912
|
+
const connectMs = pickOptionalEndpointNumber(raw, "ConnectTimeoutMs", "connectTimeoutMs");
|
|
913
|
+
const connectSeconds = pickOptionalEndpointNumber(raw, "ConnectTimeoutSeconds", "connectTimeoutSeconds", "ConnectTimeout", "connectTimeout");
|
|
914
|
+
if (connectMs != null) {
|
|
915
|
+
target.ConnectTimeoutSeconds = connectMs / 1000;
|
|
916
|
+
}
|
|
917
|
+
else if (connectSeconds != null) {
|
|
918
|
+
target.ConnectTimeoutSeconds = connectSeconds;
|
|
919
|
+
}
|
|
920
|
+
const closeMs = pickOptionalEndpointNumber(raw, "CloseTimeoutMs", "closeTimeoutMs");
|
|
921
|
+
const closeSeconds = pickOptionalEndpointNumber(raw, "CloseTimeoutSeconds", "closeTimeoutSeconds", "CloseTimeout", "closeTimeout");
|
|
922
|
+
if (closeMs != null) {
|
|
923
|
+
target.CloseTimeoutSeconds = closeMs / 1000;
|
|
924
|
+
}
|
|
925
|
+
else if (closeSeconds != null) {
|
|
926
|
+
target.CloseTimeoutSeconds = closeSeconds;
|
|
927
|
+
}
|
|
928
|
+
const produce = pickEndpointFunction(raw, "Produce", "produce");
|
|
929
|
+
if (produce) {
|
|
930
|
+
target.Produce = produce;
|
|
931
|
+
}
|
|
932
|
+
const consume = pickEndpointFunction(raw, "Consume", "consume");
|
|
933
|
+
if (consume) {
|
|
934
|
+
target.Consume = consume;
|
|
935
|
+
}
|
|
936
|
+
const produceAsync = pickEndpointFunction(raw, "ProduceAsync", "produceAsync");
|
|
937
|
+
if (produceAsync) {
|
|
938
|
+
target.ProduceAsync = produceAsync;
|
|
939
|
+
}
|
|
940
|
+
const consumeAsync = pickEndpointFunction(raw, "ConsumeAsync", "consumeAsync");
|
|
941
|
+
if (consumeAsync) {
|
|
942
|
+
target.ConsumeAsync = consumeAsync;
|
|
943
|
+
}
|
|
944
|
+
if (hasAnyEndpointField(raw, ["ConnectionMetadata", "connectionMetadata"])) {
|
|
945
|
+
target.ConnectionMetadata = pickEndpointStringRecord(raw, "ConnectionMetadata", "connectionMetadata");
|
|
946
|
+
}
|
|
947
|
+
}
|
|
783
948
|
function validateTrafficEndpointDefinitionModel(target) {
|
|
784
949
|
requireNonEmptyString(target.Name, "Endpoint name must be provided.");
|
|
785
950
|
if (target.Mode !== "Produce" && target.Mode !== "Consume") {
|
|
@@ -1914,6 +2079,10 @@ class PushDiffusionEndpointAdapter extends CallbackAdapter {
|
|
|
1914
2079
|
}
|
|
1915
2080
|
class DelegateStreamEndpointAdapter extends CallbackAdapter {
|
|
1916
2081
|
}
|
|
2082
|
+
class GrpcEndpointAdapter extends CallbackAdapter {
|
|
2083
|
+
}
|
|
2084
|
+
class WebSocketEndpointAdapter extends CallbackAdapter {
|
|
2085
|
+
}
|
|
1917
2086
|
class EndpointAdapterFactory {
|
|
1918
2087
|
static create(endpoint) {
|
|
1919
2088
|
if (endpoint instanceof TrafficEndpointDefinitionModel) {
|
|
@@ -1940,6 +2109,10 @@ class EndpointAdapterFactory {
|
|
|
1940
2109
|
return new PushDiffusionEndpointAdapter(normalized);
|
|
1941
2110
|
case "DelegateStream":
|
|
1942
2111
|
return new DelegateStreamEndpointAdapter(normalized);
|
|
2112
|
+
case "Grpc":
|
|
2113
|
+
return new GrpcEndpointAdapter(normalized);
|
|
2114
|
+
case "WebSocket":
|
|
2115
|
+
return new WebSocketEndpointAdapter(normalized);
|
|
1943
2116
|
default:
|
|
1944
2117
|
throw new Error(`Unsupported endpoint kind: ${String(normalized?.kind ?? "")}.`);
|
|
1945
2118
|
}
|
|
@@ -2114,6 +2287,62 @@ const DELEGATE_STREAM_ENDPOINT_FLAT_KEYS = [
|
|
|
2114
2287
|
"ConnectionMetadata",
|
|
2115
2288
|
"connectionMetadata"
|
|
2116
2289
|
];
|
|
2290
|
+
const GRPC_ENDPOINT_FLAT_KEYS = [
|
|
2291
|
+
"Target",
|
|
2292
|
+
"target",
|
|
2293
|
+
"ServiceName",
|
|
2294
|
+
"serviceName",
|
|
2295
|
+
"MethodName",
|
|
2296
|
+
"methodName",
|
|
2297
|
+
"MethodType",
|
|
2298
|
+
"methodType",
|
|
2299
|
+
"Deadline",
|
|
2300
|
+
"deadline",
|
|
2301
|
+
"DeadlineSeconds",
|
|
2302
|
+
"deadlineSeconds",
|
|
2303
|
+
"DeadlineMs",
|
|
2304
|
+
"deadlineMs",
|
|
2305
|
+
"Metadata",
|
|
2306
|
+
"metadata",
|
|
2307
|
+
"Produce",
|
|
2308
|
+
"produce",
|
|
2309
|
+
"Consume",
|
|
2310
|
+
"consume",
|
|
2311
|
+
"ProduceAsync",
|
|
2312
|
+
"produceAsync",
|
|
2313
|
+
"ConsumeAsync",
|
|
2314
|
+
"consumeAsync",
|
|
2315
|
+
"ConnectionMetadata",
|
|
2316
|
+
"connectionMetadata"
|
|
2317
|
+
];
|
|
2318
|
+
const WEB_SOCKET_ENDPOINT_FLAT_KEYS = [
|
|
2319
|
+
"Url",
|
|
2320
|
+
"url",
|
|
2321
|
+
"Subprotocols",
|
|
2322
|
+
"subprotocols",
|
|
2323
|
+
"ConnectTimeout",
|
|
2324
|
+
"connectTimeout",
|
|
2325
|
+
"ConnectTimeoutSeconds",
|
|
2326
|
+
"connectTimeoutSeconds",
|
|
2327
|
+
"ConnectTimeoutMs",
|
|
2328
|
+
"connectTimeoutMs",
|
|
2329
|
+
"CloseTimeout",
|
|
2330
|
+
"closeTimeout",
|
|
2331
|
+
"CloseTimeoutSeconds",
|
|
2332
|
+
"closeTimeoutSeconds",
|
|
2333
|
+
"CloseTimeoutMs",
|
|
2334
|
+
"closeTimeoutMs",
|
|
2335
|
+
"Produce",
|
|
2336
|
+
"produce",
|
|
2337
|
+
"Consume",
|
|
2338
|
+
"consume",
|
|
2339
|
+
"ProduceAsync",
|
|
2340
|
+
"produceAsync",
|
|
2341
|
+
"ConsumeAsync",
|
|
2342
|
+
"consumeAsync",
|
|
2343
|
+
"ConnectionMetadata",
|
|
2344
|
+
"connectionMetadata"
|
|
2345
|
+
];
|
|
2117
2346
|
function normalizeEndpointDefinition(endpoint) {
|
|
2118
2347
|
if (!endpoint || typeof endpoint !== "object") {
|
|
2119
2348
|
return endpoint;
|
|
@@ -2148,7 +2377,9 @@ function normalizeEndpointDefinition(endpoint) {
|
|
|
2148
2377
|
azureEventHubs: normalizeProtocolOptions(pickEndpointTransportRecord(raw, kind, "AzureEventHubs", ["azureEventHubs", "AzureEventHubs"], AZURE_EVENT_HUBS_ENDPOINT_FLAT_KEYS)),
|
|
2149
2378
|
sqs: normalizeProtocolOptions(pickEndpointTransportRecord(raw, kind, "Sqs", ["sqs", "Sqs"], SQS_ENDPOINT_FLAT_KEYS)),
|
|
2150
2379
|
pushDiffusion: normalizeProtocolOptions(pickEndpointTransportRecord(raw, kind, "PushDiffusion", ["pushDiffusion", "PushDiffusion"], PUSH_DIFFUSION_ENDPOINT_FLAT_KEYS)),
|
|
2151
|
-
delegate: normalizeDelegateEndpointOptions(pickEndpointTransportRecord(raw, kind, "DelegateStream", ["delegate", "Delegate", "DelegateStream"], DELEGATE_STREAM_ENDPOINT_FLAT_KEYS))
|
|
2380
|
+
delegate: normalizeDelegateEndpointOptions(pickEndpointTransportRecord(raw, kind, "DelegateStream", ["delegate", "Delegate", "DelegateStream"], DELEGATE_STREAM_ENDPOINT_FLAT_KEYS)),
|
|
2381
|
+
grpc: normalizeProtocolOptions(pickEndpointTransportRecord(raw, kind, "Grpc", ["grpc", "Grpc"], GRPC_ENDPOINT_FLAT_KEYS)),
|
|
2382
|
+
webSocket: normalizeProtocolOptions(pickEndpointTransportRecord(raw, kind, "WebSocket", ["webSocket", "WebSocket"], WEB_SOCKET_ENDPOINT_FLAT_KEYS))
|
|
2152
2383
|
};
|
|
2153
2384
|
}
|
|
2154
2385
|
function resolveEndpointKind(raw) {
|
|
@@ -2234,6 +2465,28 @@ function resolveEndpointKind(raw) {
|
|
|
2234
2465
|
])) {
|
|
2235
2466
|
return "PushDiffusion";
|
|
2236
2467
|
}
|
|
2468
|
+
if (Object.keys(pickEndpointRecord(raw, "grpc", "Grpc")).length || hasAnyEndpointField(raw, [
|
|
2469
|
+
"Target",
|
|
2470
|
+
"target",
|
|
2471
|
+
"ServiceName",
|
|
2472
|
+
"serviceName",
|
|
2473
|
+
"MethodName",
|
|
2474
|
+
"methodName",
|
|
2475
|
+
"MethodType",
|
|
2476
|
+
"methodType"
|
|
2477
|
+
])) {
|
|
2478
|
+
return "Grpc";
|
|
2479
|
+
}
|
|
2480
|
+
if (Object.keys(pickEndpointRecord(raw, "webSocket", "WebSocket")).length || hasAnyEndpointField(raw, [
|
|
2481
|
+
"Subprotocols",
|
|
2482
|
+
"subprotocols",
|
|
2483
|
+
"ConnectTimeoutSeconds",
|
|
2484
|
+
"connectTimeoutSeconds",
|
|
2485
|
+
"CloseTimeoutSeconds",
|
|
2486
|
+
"closeTimeoutSeconds"
|
|
2487
|
+
])) {
|
|
2488
|
+
return "WebSocket";
|
|
2489
|
+
}
|
|
2237
2490
|
if (Object.keys(pickEndpointRecord(raw, "delegate", "Delegate", "DelegateStream")).length || hasAnyEndpointField(raw, [
|
|
2238
2491
|
"Produce",
|
|
2239
2492
|
"produce",
|
|
@@ -2477,10 +2730,8 @@ function validateEndpointDefinition(endpoint) {
|
|
|
2477
2730
|
if (mode !== "Produce" && mode !== "Consume") {
|
|
2478
2731
|
throw new Error(`Unsupported endpoint mode: ${mode}.`);
|
|
2479
2732
|
}
|
|
2480
|
-
const hasProduceDelegate =
|
|
2481
|
-
|
|
2482
|
-
const hasConsumeDelegate = typeof endpoint.delegate?.consume === "function"
|
|
2483
|
-
|| typeof endpoint.delegate?.consumeAsync === "function";
|
|
2733
|
+
const hasProduceDelegate = Boolean(resolveProduceDelegate(endpoint) || resolveStructuredProduceDelegate(endpoint));
|
|
2734
|
+
const hasConsumeDelegate = Boolean(resolveConsumeDelegate(endpoint) || resolveStructuredConsumeDelegate(endpoint) || resolveStructuredConsumeStreamDelegate(endpoint));
|
|
2484
2735
|
const hasModeDelegate = mode === "Produce" ? hasProduceDelegate : hasConsumeDelegate;
|
|
2485
2736
|
switch (kind) {
|
|
2486
2737
|
case "Http":
|
|
@@ -2510,6 +2761,12 @@ function validateEndpointDefinition(endpoint) {
|
|
|
2510
2761
|
case "DelegateStream":
|
|
2511
2762
|
validateDelegateStreamEndpoint(endpoint, mode);
|
|
2512
2763
|
return;
|
|
2764
|
+
case "Grpc":
|
|
2765
|
+
validateGrpcEndpoint(endpoint, mode);
|
|
2766
|
+
return;
|
|
2767
|
+
case "WebSocket":
|
|
2768
|
+
validateWebSocketEndpoint(endpoint, mode);
|
|
2769
|
+
return;
|
|
2513
2770
|
default:
|
|
2514
2771
|
throw new Error(`Unsupported endpoint kind: ${kind}.`);
|
|
2515
2772
|
}
|
|
@@ -2585,6 +2842,57 @@ function validateDelegateStreamEndpoint(endpoint, mode) {
|
|
|
2585
2842
|
throw new Error("ConsumeAsync delegate must be provided when endpoint mode is Consume.");
|
|
2586
2843
|
}
|
|
2587
2844
|
}
|
|
2845
|
+
function validateGrpcEndpoint(endpoint, mode) {
|
|
2846
|
+
const options = asRecordOrEmpty(endpoint.grpc);
|
|
2847
|
+
requireNonEmptyString(optionString(options, "Target", "target"), "Target must be provided for gRPC endpoint definitions.");
|
|
2848
|
+
requireNonEmptyString(optionString(options, "ServiceName", "serviceName"), "ServiceName must be provided for gRPC endpoint definitions.");
|
|
2849
|
+
requireNonEmptyString(optionString(options, "MethodName", "methodName"), "MethodName must be provided for gRPC endpoint definitions.");
|
|
2850
|
+
requireNonEmptyString(optionString(options, "MethodType", "methodType") || "Unary", "MethodType must be provided for gRPC endpoint definitions.");
|
|
2851
|
+
const deadlineMs = optionNumber(options, "DeadlineMs", "deadlineMs");
|
|
2852
|
+
const deadlineSeconds = optionNumber(options, "DeadlineSeconds", "deadlineSeconds", "Deadline", "deadline");
|
|
2853
|
+
if ((hasOptionValue(options, "DeadlineMs", "deadlineMs") && deadlineMs <= 0)
|
|
2854
|
+
|| (hasOptionValue(options, "DeadlineSeconds", "deadlineSeconds", "Deadline", "deadline") && deadlineSeconds <= 0)) {
|
|
2855
|
+
throw new RangeError("Deadline must be greater than zero.");
|
|
2856
|
+
}
|
|
2857
|
+
if (mode === "Produce" && !resolveStructuredProduceDelegate(endpoint) && !resolveProduceDelegate(endpoint)) {
|
|
2858
|
+
throw new Error("ProduceAsync delegate must be provided when endpoint mode is Produce.");
|
|
2859
|
+
}
|
|
2860
|
+
if (mode === "Consume" && !resolveStructuredConsumeDelegate(endpoint) && !resolveStructuredConsumeStreamDelegate(endpoint) && !resolveConsumeDelegate(endpoint)) {
|
|
2861
|
+
throw new Error("ConsumeAsync delegate must be provided when endpoint mode is Consume.");
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
function validateWebSocketEndpoint(endpoint, mode) {
|
|
2865
|
+
const options = asRecordOrEmpty(endpoint.webSocket);
|
|
2866
|
+
const url = requireNonEmptyString(optionString(options, "Url", "url"), "Url must be provided for WebSocket endpoint definitions.");
|
|
2867
|
+
let parsed;
|
|
2868
|
+
try {
|
|
2869
|
+
parsed = new URL(url);
|
|
2870
|
+
}
|
|
2871
|
+
catch {
|
|
2872
|
+
throw new Error("Url must be an absolute ws:// or wss:// URI.");
|
|
2873
|
+
}
|
|
2874
|
+
if (parsed.protocol !== "ws:" && parsed.protocol !== "wss:") {
|
|
2875
|
+
throw new Error("Url must be an absolute ws:// or wss:// URI.");
|
|
2876
|
+
}
|
|
2877
|
+
const connectMs = optionNumber(options, "ConnectTimeoutMs", "connectTimeoutMs");
|
|
2878
|
+
const connectSeconds = optionNumber(options, "ConnectTimeoutSeconds", "connectTimeoutSeconds", "ConnectTimeout", "connectTimeout");
|
|
2879
|
+
const closeMs = optionNumber(options, "CloseTimeoutMs", "closeTimeoutMs");
|
|
2880
|
+
const closeSeconds = optionNumber(options, "CloseTimeoutSeconds", "closeTimeoutSeconds", "CloseTimeout", "closeTimeout");
|
|
2881
|
+
if ((hasOptionValue(options, "ConnectTimeoutMs", "connectTimeoutMs") && connectMs <= 0)
|
|
2882
|
+
|| (hasOptionValue(options, "ConnectTimeoutSeconds", "connectTimeoutSeconds", "ConnectTimeout", "connectTimeout") && connectSeconds <= 0)) {
|
|
2883
|
+
throw new RangeError("ConnectTimeout must be greater than zero.");
|
|
2884
|
+
}
|
|
2885
|
+
if ((hasOptionValue(options, "CloseTimeoutMs", "closeTimeoutMs") && closeMs <= 0)
|
|
2886
|
+
|| (hasOptionValue(options, "CloseTimeoutSeconds", "closeTimeoutSeconds", "CloseTimeout", "closeTimeout") && closeSeconds <= 0)) {
|
|
2887
|
+
throw new RangeError("CloseTimeout must be greater than zero.");
|
|
2888
|
+
}
|
|
2889
|
+
if (mode === "Produce" && !resolveStructuredProduceDelegate(endpoint) && !resolveProduceDelegate(endpoint)) {
|
|
2890
|
+
throw new Error("ProduceAsync delegate must be provided when endpoint mode is Produce.");
|
|
2891
|
+
}
|
|
2892
|
+
if (mode === "Consume" && !resolveStructuredConsumeDelegate(endpoint) && !resolveStructuredConsumeStreamDelegate(endpoint) && !resolveConsumeDelegate(endpoint)) {
|
|
2893
|
+
throw new Error("ConsumeAsync delegate must be provided when endpoint mode is Consume.");
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2588
2896
|
function validateHttpAuthOptions(options) {
|
|
2589
2897
|
const auth = options.auth;
|
|
2590
2898
|
if (!auth) {
|
|
@@ -3227,6 +3535,10 @@ function createDelegateRequestEndpointView(endpoint) {
|
|
|
3227
3535
|
return new exports.AzureEventHubsEndpointDefinition(endpoint);
|
|
3228
3536
|
case "PushDiffusion":
|
|
3229
3537
|
return new exports.PushDiffusionEndpointDefinition(endpoint);
|
|
3538
|
+
case "Grpc":
|
|
3539
|
+
return new exports.GrpcEndpointDefinition(endpoint);
|
|
3540
|
+
case "WebSocket":
|
|
3541
|
+
return new exports.WebSocketEndpointDefinition(endpoint);
|
|
3230
3542
|
default:
|
|
3231
3543
|
return new exports.DelegateStreamEndpointDefinition(endpoint);
|
|
3232
3544
|
}
|
|
@@ -3445,12 +3757,20 @@ function parseBodyObject(body) {
|
|
|
3445
3757
|
function resolveStructuredProduceDelegate(endpoint) {
|
|
3446
3758
|
return endpoint.delegate?.produceAsync
|
|
3447
3759
|
?? endpoint.pushDiffusion?.PublishAsync
|
|
3448
|
-
?? endpoint.pushDiffusion?.publishAsync
|
|
3760
|
+
?? endpoint.pushDiffusion?.publishAsync
|
|
3761
|
+
?? endpoint.grpc?.ProduceAsync
|
|
3762
|
+
?? endpoint.grpc?.produceAsync
|
|
3763
|
+
?? endpoint.webSocket?.ProduceAsync
|
|
3764
|
+
?? endpoint.webSocket?.produceAsync;
|
|
3449
3765
|
}
|
|
3450
3766
|
function resolveStructuredConsumeDelegate(endpoint) {
|
|
3451
3767
|
const delegate = endpoint.delegate?.consumeAsync
|
|
3452
3768
|
?? endpoint.pushDiffusion?.SubscribeAsync
|
|
3453
|
-
?? endpoint.pushDiffusion?.subscribeAsync
|
|
3769
|
+
?? endpoint.pushDiffusion?.subscribeAsync
|
|
3770
|
+
?? endpoint.grpc?.ConsumeAsync
|
|
3771
|
+
?? endpoint.grpc?.consumeAsync
|
|
3772
|
+
?? endpoint.webSocket?.ConsumeAsync
|
|
3773
|
+
?? endpoint.webSocket?.consumeAsync;
|
|
3454
3774
|
return typeof delegate === "function" && delegate.length === 0
|
|
3455
3775
|
? delegate
|
|
3456
3776
|
: undefined;
|
|
@@ -3458,22 +3778,36 @@ function resolveStructuredConsumeDelegate(endpoint) {
|
|
|
3458
3778
|
function resolveStructuredConsumeStreamDelegate(endpoint) {
|
|
3459
3779
|
const delegate = endpoint.delegate?.consumeAsync
|
|
3460
3780
|
?? endpoint.pushDiffusion?.SubscribeAsync
|
|
3461
|
-
?? endpoint.pushDiffusion?.subscribeAsync
|
|
3781
|
+
?? endpoint.pushDiffusion?.subscribeAsync
|
|
3782
|
+
?? endpoint.grpc?.ConsumeAsync
|
|
3783
|
+
?? endpoint.grpc?.consumeAsync
|
|
3784
|
+
?? endpoint.webSocket?.ConsumeAsync
|
|
3785
|
+
?? endpoint.webSocket?.consumeAsync;
|
|
3462
3786
|
return typeof delegate === "function" && delegate.length > 0
|
|
3463
3787
|
? delegate
|
|
3464
3788
|
: undefined;
|
|
3465
3789
|
}
|
|
3466
3790
|
function resolveProduceDelegate(endpoint) {
|
|
3467
|
-
return endpoint.delegate?.produce
|
|
3791
|
+
return endpoint.delegate?.produce
|
|
3792
|
+
?? endpoint.grpc?.Produce
|
|
3793
|
+
?? endpoint.grpc?.produce
|
|
3794
|
+
?? endpoint.webSocket?.Produce
|
|
3795
|
+
?? endpoint.webSocket?.produce;
|
|
3468
3796
|
}
|
|
3469
3797
|
function resolveConsumeDelegate(endpoint) {
|
|
3470
|
-
return endpoint.delegate?.consume
|
|
3798
|
+
return endpoint.delegate?.consume
|
|
3799
|
+
?? endpoint.grpc?.Consume
|
|
3800
|
+
?? endpoint.grpc?.consume
|
|
3801
|
+
?? endpoint.webSocket?.Consume
|
|
3802
|
+
?? endpoint.webSocket?.consume;
|
|
3471
3803
|
}
|
|
3472
3804
|
function resolveConnectionMetadata(endpoint) {
|
|
3473
3805
|
return {
|
|
3474
3806
|
...(endpoint.connectionMetadata ?? {}),
|
|
3475
3807
|
...(endpoint.delegate?.connectionMetadata ?? {}),
|
|
3476
|
-
...toStringRecord(endpoint.pushDiffusion?.ConnectionProperties ?? endpoint.pushDiffusion?.connectionProperties)
|
|
3808
|
+
...toStringRecord(endpoint.pushDiffusion?.ConnectionProperties ?? endpoint.pushDiffusion?.connectionProperties),
|
|
3809
|
+
...toStringRecord(endpoint.grpc?.ConnectionMetadata ?? endpoint.grpc?.connectionMetadata),
|
|
3810
|
+
...toStringRecord(endpoint.webSocket?.ConnectionMetadata ?? endpoint.webSocket?.connectionMetadata)
|
|
3477
3811
|
};
|
|
3478
3812
|
}
|
|
3479
3813
|
function isStructuredProduceResult(value) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { LoadStrikeAutopilot, LoadStrikeAutopilotResult } from "./autopilot.js";
|
|
2
2
|
export { LoadStrikeAutopilotReadiness } from "./autopilot-contracts.js";
|
|
3
|
-
export { CrossPlatformScenarioConfigurator, ScenarioTrackingExtensions, LoadStrikeContext, LoadStrikePluginData, LoadStrikePluginDataTable, LoadStrikeNodeType, LoadStrikeReportFormat, LoadStrikeResponse, LoadStrikeLogLevel, LoadStrikeScenarioOperation, LoadStrikeOperationType, LoadStrikeRunner, LoadStrikeScenario, LoadStrikeSimulation, CrossPlatformTrackingConfiguration, LoadStrikeMetric, LoadStrikeCounter, LoadStrikeGauge, LoadStrikeStep, LoadStrikeThreshold } from "./runtime.js";
|
|
3
|
+
export { CrossPlatformScenarioConfigurator, ScenarioTrackingExtensions, LoadStrikeContext, LoadStrikeAccessibility, LoadStrikeBrowserWebVitals, LoadStrikePluginData, LoadStrikePluginDataTable, LoadStrikeNodeType, LoadStrikeReportFormat, LoadStrikeResponse, LoadStrikeLogLevel, LoadStrikeScenarioOperation, LoadStrikeOperationType, LoadStrikeRunner, LoadStrikeScenario, LoadStrikeScenarioShare, LoadStrikeSimulation, LoadStrikeTrafficMix, CrossPlatformTrackingConfiguration, LoadStrikeMetric, LoadStrikeCounter, LoadStrikeGauge, LoadStrikeStep, LoadStrikeThreshold } from "./runtime.js";
|
|
4
4
|
export { CorrelationStoreConfiguration, CrossPlatformTrackingRuntime, InMemoryCorrelationStore, RedisCorrelationStoreOptions, RedisCorrelationStore, TrackingPayloadBuilder, TrackingFieldSelector } from "./correlation.js";
|
|
5
|
-
export { LOADSTRIKE_TRACE_ID_HEADER, LOADSTRIKE_TRACE_ID_TRACKING_FIELD, TrafficEndpointDefinition, HttpEndpointDefinition, KafkaEndpointDefinition, KafkaSaslOptions, RabbitMqEndpointDefinition, NatsEndpointDefinition, RedisStreamsEndpointDefinition, AzureEventHubsEndpointDefinition, SqsEndpointDefinition, DelegateStreamEndpointDefinition, PushDiffusionEndpointDefinition, HttpOAuth2ClientCredentialsOptions, HttpAuthOptions } from "./transports.js";
|
|
5
|
+
export { LOADSTRIKE_TRACE_ID_HEADER, LOADSTRIKE_TRACE_ID_TRACKING_FIELD, TrafficEndpointDefinition, HttpEndpointDefinition, KafkaEndpointDefinition, KafkaSaslOptions, RabbitMqEndpointDefinition, NatsEndpointDefinition, RedisStreamsEndpointDefinition, AzureEventHubsEndpointDefinition, SqsEndpointDefinition, DelegateStreamEndpointDefinition, PushDiffusionEndpointDefinition, GrpcEndpointDefinition, WebSocketEndpointDefinition, HttpOAuth2ClientCredentialsOptions, HttpAuthOptions } from "./transports.js";
|
|
6
6
|
export { DatadogReportingSink, DatadogReportingSinkOptions, GrafanaLokiReportingSink, GrafanaLokiReportingSinkOptions, InfluxDbReportingSink, InfluxDbReportingSinkOptions, OtelCollectorReportingSink, OtelCollectorReportingSinkOptions, PortalReportingSink, SplunkReportingSink, SplunkReportingSinkOptions, TimescaleDbReportingSink, TimescaleDbReportingSinkOptions } from "./sinks.js";
|
package/dist/esm/local.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _LoadStrikeLocalClient_licensingApiBaseUrl, _LoadStrikeLocalClient_signingKeyCache;
|
|
1
13
|
import os from "node:os";
|
|
2
14
|
import * as fs from "node:fs";
|
|
3
15
|
import * as childProcess from "node:child_process";
|
|
@@ -28,7 +40,9 @@ const TRACKING_FEATURE_BY_KIND = {
|
|
|
28
40
|
delegatestream: "endpoint.delegate_stream",
|
|
29
41
|
nats: "endpoint.nats",
|
|
30
42
|
redisstreams: "endpoint.redis_streams",
|
|
31
|
-
sqs: "endpoint.sqs"
|
|
43
|
+
sqs: "endpoint.sqs",
|
|
44
|
+
grpc: "endpoint.grpc",
|
|
45
|
+
websocket: "endpoint.websocket"
|
|
32
46
|
};
|
|
33
47
|
const CI_ENVIRONMENT_VARIABLES = [
|
|
34
48
|
"GITHUB_ACTIONS",
|
|
@@ -53,13 +67,14 @@ export class LoadStrikeLocalClient {
|
|
|
53
67
|
* Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
|
|
54
68
|
*/
|
|
55
69
|
constructor(options = {}) {
|
|
56
|
-
this
|
|
70
|
+
_LoadStrikeLocalClient_licensingApiBaseUrl.set(this, void 0);
|
|
71
|
+
_LoadStrikeLocalClient_signingKeyCache.set(this, new Map());
|
|
57
72
|
assertNoDisableLicenseEnforcementOption(options, "LoadStrikeLocalClient");
|
|
58
|
-
this
|
|
73
|
+
__classPrivateFieldSet(this, _LoadStrikeLocalClient_licensingApiBaseUrl, resolveLicensingApiBaseUrl(), "f");
|
|
59
74
|
this.licenseValidationTimeoutMs = normalizeTimeoutMs(options.licenseValidationTimeoutMs);
|
|
60
75
|
}
|
|
61
76
|
portalReportingIngestUrl() {
|
|
62
|
-
return `${this.
|
|
77
|
+
return `${__classPrivateFieldGet(this, _LoadStrikeLocalClient_licensingApiBaseUrl, "f").replace(/\/+$/, "")}/api/v1/reporting/ingest`;
|
|
63
78
|
}
|
|
64
79
|
async run(request) {
|
|
65
80
|
const sanitized = sanitizeRequest(request);
|
|
@@ -328,8 +343,8 @@ export class LoadStrikeLocalClient {
|
|
|
328
343
|
const nowMs = Date.now();
|
|
329
344
|
const normalizedKeyId = stringOrDefault(keyId, "default").trim() || "default";
|
|
330
345
|
const normalizedAlgorithm = stringOrDefault(algorithm, "RS256").toUpperCase();
|
|
331
|
-
const cacheKey = `${this.
|
|
332
|
-
const cached = this.
|
|
346
|
+
const cacheKey = `${__classPrivateFieldGet(this, _LoadStrikeLocalClient_licensingApiBaseUrl, "f").toLowerCase()}|${normalizedAlgorithm}:${normalizedKeyId}`;
|
|
347
|
+
const cached = __classPrivateFieldGet(this, _LoadStrikeLocalClient_signingKeyCache, "f").get(cacheKey);
|
|
333
348
|
if (cached && cached.expiresAtUtc > nowMs) {
|
|
334
349
|
return cached;
|
|
335
350
|
}
|
|
@@ -357,7 +372,7 @@ export class LoadStrikeLocalClient {
|
|
|
357
372
|
publicKeyPem,
|
|
358
373
|
expiresAtUtc: nowMs + (15 * 60 * 1000)
|
|
359
374
|
};
|
|
360
|
-
this.
|
|
375
|
+
__classPrivateFieldGet(this, _LoadStrikeLocalClient_signingKeyCache, "f").set(cacheKey, keyRecord);
|
|
361
376
|
return keyRecord;
|
|
362
377
|
}
|
|
363
378
|
finally {
|
|
@@ -409,7 +424,7 @@ export class LoadStrikeLocalClient {
|
|
|
409
424
|
}
|
|
410
425
|
}
|
|
411
426
|
async postLicensingRequest(path, payload, signal) {
|
|
412
|
-
const response = await fetch(`${this.
|
|
427
|
+
const response = await fetch(`${__classPrivateFieldGet(this, _LoadStrikeLocalClient_licensingApiBaseUrl, "f").replace(/\/+$/, "")}${path}`, {
|
|
413
428
|
method: "POST",
|
|
414
429
|
headers: {
|
|
415
430
|
"Content-Type": "application/json",
|
|
@@ -428,7 +443,7 @@ export class LoadStrikeLocalClient {
|
|
|
428
443
|
return { response, json };
|
|
429
444
|
}
|
|
430
445
|
async getLicensingRequest(path, signal) {
|
|
431
|
-
const response = await fetch(`${this.
|
|
446
|
+
const response = await fetch(`${__classPrivateFieldGet(this, _LoadStrikeLocalClient_licensingApiBaseUrl, "f").replace(/\/+$/, "")}${path}`, {
|
|
432
447
|
method: "GET",
|
|
433
448
|
headers: {
|
|
434
449
|
Accept: "application/json"
|
|
@@ -445,6 +460,7 @@ export class LoadStrikeLocalClient {
|
|
|
445
460
|
return { response, json };
|
|
446
461
|
}
|
|
447
462
|
}
|
|
463
|
+
_LoadStrikeLocalClient_licensingApiBaseUrl = new WeakMap(), _LoadStrikeLocalClient_signingKeyCache = new WeakMap();
|
|
448
464
|
function assertNoDisableLicenseEnforcementOption(value, source) {
|
|
449
465
|
if (value == null || typeof value !== "object" || Array.isArray(value)) {
|
|
450
466
|
return;
|
|
@@ -474,7 +490,43 @@ function resolveLicensingApiBaseUrl() {
|
|
|
474
490
|
return normalizeLicensingApiBaseUrl(developmentLicensingApiBaseUrlOverride);
|
|
475
491
|
}
|
|
476
492
|
function setDevelopmentLicensingApiBaseUrlOverride(value) {
|
|
477
|
-
|
|
493
|
+
if (value != null && value.trim()) {
|
|
494
|
+
assertInternalTestHarnessLicensingOverride();
|
|
495
|
+
const normalized = normalizeLicensingApiBaseUrl(value);
|
|
496
|
+
if (!isLoopbackHttpBaseUrl(normalized)) {
|
|
497
|
+
throw new TypeError("Internal development licensing API overrides must use a loopback http URL.");
|
|
498
|
+
}
|
|
499
|
+
developmentLicensingApiBaseUrlOverride = normalized;
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
if (value != null) {
|
|
503
|
+
assertInternalTestHarnessLicensingOverride();
|
|
504
|
+
}
|
|
505
|
+
developmentLicensingApiBaseUrlOverride = undefined;
|
|
506
|
+
}
|
|
507
|
+
function assertInternalTestHarnessLicensingOverride() {
|
|
508
|
+
if (isInternalTestHarnessCall()) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
throw new TypeError("Internal development licensing API override is available only to LoadStrike SDK tests.");
|
|
512
|
+
}
|
|
513
|
+
function isInternalTestHarnessCall() {
|
|
514
|
+
const stack = String(new Error().stack ?? "").replace(/\\/g, "/").toLowerCase();
|
|
515
|
+
return stack.includes("/sdk/ts/tests/");
|
|
516
|
+
}
|
|
517
|
+
function isLoopbackHttpBaseUrl(value) {
|
|
518
|
+
let parsed;
|
|
519
|
+
try {
|
|
520
|
+
parsed = new URL(value);
|
|
521
|
+
}
|
|
522
|
+
catch {
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
if (parsed.protocol !== "http:") {
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
const host = parsed.hostname.trim().toLowerCase();
|
|
529
|
+
return host === "localhost" || host === "127.0.0.1" || host === "[::1]" || host === "::1" || host.endsWith(".localhost");
|
|
478
530
|
}
|
|
479
531
|
function normalizeTimeoutMs(value) {
|
|
480
532
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|