@loadstrike/loadstrike-sdk 1.0.23201 → 1.0.23401
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/dist/cjs/runtime.js +13 -1
- package/dist/cjs/sinks.js +7 -2
- package/dist/esm/runtime.js +13 -1
- package/dist/esm/sinks.js +7 -2
- package/dist/types/runtime.d.ts +3 -0
- package/dist/types/sinks.d.ts +2 -0
- package/package.json +1 -1
package/dist/cjs/runtime.js
CHANGED
|
@@ -4112,7 +4112,8 @@ function attachSessionStartInfoAliases(session) {
|
|
|
4112
4112
|
ScenarioNames: "scenarioNames",
|
|
4113
4113
|
Scenarios: "scenarios",
|
|
4114
4114
|
RunToken: "runToken",
|
|
4115
|
-
PortalReportingIngestUrl: "portalReportingIngestUrl"
|
|
4115
|
+
PortalReportingIngestUrl: "portalReportingIngestUrl",
|
|
4116
|
+
PortalReportingRunId: "portalReportingRunId"
|
|
4116
4117
|
});
|
|
4117
4118
|
return session;
|
|
4118
4119
|
}
|
|
@@ -4122,10 +4123,21 @@ function attachPortalReportingSession(sinkSession, sessionInfo, licenseClient, l
|
|
|
4122
4123
|
return;
|
|
4123
4124
|
}
|
|
4124
4125
|
const ingestUrl = licenseClient.portalReportingIngestUrl();
|
|
4126
|
+
const runId = buildPortalReportingRunId(sessionInfo.testInfo.sessionId);
|
|
4125
4127
|
sinkSession.runToken = runToken;
|
|
4126
4128
|
sinkSession.portalReportingIngestUrl = ingestUrl;
|
|
4129
|
+
sinkSession.portalReportingRunId = runId;
|
|
4127
4130
|
sessionInfo.runToken = runToken;
|
|
4128
4131
|
sessionInfo.portalReportingIngestUrl = ingestUrl;
|
|
4132
|
+
sessionInfo.portalReportingRunId = runId;
|
|
4133
|
+
}
|
|
4134
|
+
function buildPortalReportingRunId(sessionId) {
|
|
4135
|
+
const sessionPart = String(sessionId ?? "")
|
|
4136
|
+
.replace(/[^A-Za-z0-9._-]+/g, "-")
|
|
4137
|
+
.replace(/^-+|-+$/g, "")
|
|
4138
|
+
.slice(0, 80);
|
|
4139
|
+
const uniquePart = generateRuntimeSessionId().slice(0, 16);
|
|
4140
|
+
return sessionPart ? `${sessionPart}-${uniquePart}` : uniquePart;
|
|
4129
4141
|
}
|
|
4130
4142
|
function attachScenarioInitContextAliases(context) {
|
|
4131
4143
|
context.nodeInfo = attachNodeInfoAliases(context.nodeInfo);
|
package/dist/cjs/sinks.js
CHANGED
|
@@ -1619,6 +1619,7 @@ function createReportingEvent(session, occurredUtc, eventType, scenarioName, ste
|
|
|
1619
1619
|
eventFields.completed_utc = occurredUtc.toISOString();
|
|
1620
1620
|
}
|
|
1621
1621
|
return {
|
|
1622
|
+
runId: session.runId,
|
|
1622
1623
|
eventType,
|
|
1623
1624
|
occurredUtc,
|
|
1624
1625
|
sessionId: session.sessionId,
|
|
@@ -1636,7 +1637,7 @@ function createReportingEvent(session, occurredUtc, eventType, scenarioName, ste
|
|
|
1636
1637
|
function portalEventPayload(event, index) {
|
|
1637
1638
|
return {
|
|
1638
1639
|
eventId: portalEventId(event, index),
|
|
1639
|
-
runId: event.
|
|
1640
|
+
runId: event.runId,
|
|
1640
1641
|
eventType: event.eventType,
|
|
1641
1642
|
occurredUtc: event.occurredUtc.toISOString(),
|
|
1642
1643
|
sessionId: event.sessionId,
|
|
@@ -1654,6 +1655,7 @@ function portalEventPayload(event, index) {
|
|
|
1654
1655
|
function portalEventId(event, index) {
|
|
1655
1656
|
const material = JSON.stringify({
|
|
1656
1657
|
sessionId: event.sessionId,
|
|
1658
|
+
runId: event.runId,
|
|
1657
1659
|
eventType: event.eventType,
|
|
1658
1660
|
occurredUtc: event.occurredUtc.toISOString(),
|
|
1659
1661
|
scenarioName: event.scenarioName ?? "",
|
|
@@ -2211,7 +2213,9 @@ function sinkSessionMetadataFromContext(context, session) {
|
|
|
2211
2213
|
const testInfo = context.testInfo;
|
|
2212
2214
|
const sessionStartedUtc = String(session?.startedUtc ?? session?.StartedUtc ?? "");
|
|
2213
2215
|
const contextStartedUtc = String(testInfo.createdUtc ?? testInfo.CreatedUtc ?? "");
|
|
2216
|
+
const runId = String(session?.portalReportingRunId ?? session?.PortalReportingRunId ?? testInfo.sessionId ?? "").trim();
|
|
2214
2217
|
return {
|
|
2218
|
+
runId: runId || String(testInfo.sessionId ?? ""),
|
|
2215
2219
|
sessionId: String(testInfo.sessionId ?? ""),
|
|
2216
2220
|
testSuite: String(testInfo.testSuite ?? ""),
|
|
2217
2221
|
testName: String(testInfo.testName ?? ""),
|
|
@@ -2691,7 +2695,8 @@ function cloneSessionStartInfo(session) {
|
|
|
2691
2695
|
scenarioNames: [...session.scenarioNames],
|
|
2692
2696
|
scenarios: session.scenarios.map((value) => ({ ...value })),
|
|
2693
2697
|
runToken: session.runToken,
|
|
2694
|
-
portalReportingIngestUrl: session.portalReportingIngestUrl
|
|
2698
|
+
portalReportingIngestUrl: session.portalReportingIngestUrl,
|
|
2699
|
+
portalReportingRunId: session.portalReportingRunId
|
|
2695
2700
|
};
|
|
2696
2701
|
}
|
|
2697
2702
|
function cloneNodeInfo(nodeInfo) {
|
package/dist/esm/runtime.js
CHANGED
|
@@ -4092,7 +4092,8 @@ function attachSessionStartInfoAliases(session) {
|
|
|
4092
4092
|
ScenarioNames: "scenarioNames",
|
|
4093
4093
|
Scenarios: "scenarios",
|
|
4094
4094
|
RunToken: "runToken",
|
|
4095
|
-
PortalReportingIngestUrl: "portalReportingIngestUrl"
|
|
4095
|
+
PortalReportingIngestUrl: "portalReportingIngestUrl",
|
|
4096
|
+
PortalReportingRunId: "portalReportingRunId"
|
|
4096
4097
|
});
|
|
4097
4098
|
return session;
|
|
4098
4099
|
}
|
|
@@ -4102,10 +4103,21 @@ function attachPortalReportingSession(sinkSession, sessionInfo, licenseClient, l
|
|
|
4102
4103
|
return;
|
|
4103
4104
|
}
|
|
4104
4105
|
const ingestUrl = licenseClient.portalReportingIngestUrl();
|
|
4106
|
+
const runId = buildPortalReportingRunId(sessionInfo.testInfo.sessionId);
|
|
4105
4107
|
sinkSession.runToken = runToken;
|
|
4106
4108
|
sinkSession.portalReportingIngestUrl = ingestUrl;
|
|
4109
|
+
sinkSession.portalReportingRunId = runId;
|
|
4107
4110
|
sessionInfo.runToken = runToken;
|
|
4108
4111
|
sessionInfo.portalReportingIngestUrl = ingestUrl;
|
|
4112
|
+
sessionInfo.portalReportingRunId = runId;
|
|
4113
|
+
}
|
|
4114
|
+
function buildPortalReportingRunId(sessionId) {
|
|
4115
|
+
const sessionPart = String(sessionId ?? "")
|
|
4116
|
+
.replace(/[^A-Za-z0-9._-]+/g, "-")
|
|
4117
|
+
.replace(/^-+|-+$/g, "")
|
|
4118
|
+
.slice(0, 80);
|
|
4119
|
+
const uniquePart = generateRuntimeSessionId().slice(0, 16);
|
|
4120
|
+
return sessionPart ? `${sessionPart}-${uniquePart}` : uniquePart;
|
|
4109
4121
|
}
|
|
4110
4122
|
function attachScenarioInitContextAliases(context) {
|
|
4111
4123
|
context.nodeInfo = attachNodeInfoAliases(context.nodeInfo);
|
package/dist/esm/sinks.js
CHANGED
|
@@ -1600,6 +1600,7 @@ function createReportingEvent(session, occurredUtc, eventType, scenarioName, ste
|
|
|
1600
1600
|
eventFields.completed_utc = occurredUtc.toISOString();
|
|
1601
1601
|
}
|
|
1602
1602
|
return {
|
|
1603
|
+
runId: session.runId,
|
|
1603
1604
|
eventType,
|
|
1604
1605
|
occurredUtc,
|
|
1605
1606
|
sessionId: session.sessionId,
|
|
@@ -1617,7 +1618,7 @@ function createReportingEvent(session, occurredUtc, eventType, scenarioName, ste
|
|
|
1617
1618
|
function portalEventPayload(event, index) {
|
|
1618
1619
|
return {
|
|
1619
1620
|
eventId: portalEventId(event, index),
|
|
1620
|
-
runId: event.
|
|
1621
|
+
runId: event.runId,
|
|
1621
1622
|
eventType: event.eventType,
|
|
1622
1623
|
occurredUtc: event.occurredUtc.toISOString(),
|
|
1623
1624
|
sessionId: event.sessionId,
|
|
@@ -1635,6 +1636,7 @@ function portalEventPayload(event, index) {
|
|
|
1635
1636
|
function portalEventId(event, index) {
|
|
1636
1637
|
const material = JSON.stringify({
|
|
1637
1638
|
sessionId: event.sessionId,
|
|
1639
|
+
runId: event.runId,
|
|
1638
1640
|
eventType: event.eventType,
|
|
1639
1641
|
occurredUtc: event.occurredUtc.toISOString(),
|
|
1640
1642
|
scenarioName: event.scenarioName ?? "",
|
|
@@ -2192,7 +2194,9 @@ function sinkSessionMetadataFromContext(context, session) {
|
|
|
2192
2194
|
const testInfo = context.testInfo;
|
|
2193
2195
|
const sessionStartedUtc = String(session?.startedUtc ?? session?.StartedUtc ?? "");
|
|
2194
2196
|
const contextStartedUtc = String(testInfo.createdUtc ?? testInfo.CreatedUtc ?? "");
|
|
2197
|
+
const runId = String(session?.portalReportingRunId ?? session?.PortalReportingRunId ?? testInfo.sessionId ?? "").trim();
|
|
2195
2198
|
return {
|
|
2199
|
+
runId: runId || String(testInfo.sessionId ?? ""),
|
|
2196
2200
|
sessionId: String(testInfo.sessionId ?? ""),
|
|
2197
2201
|
testSuite: String(testInfo.testSuite ?? ""),
|
|
2198
2202
|
testName: String(testInfo.testName ?? ""),
|
|
@@ -2672,7 +2676,8 @@ function cloneSessionStartInfo(session) {
|
|
|
2672
2676
|
scenarioNames: [...session.scenarioNames],
|
|
2673
2677
|
scenarios: session.scenarios.map((value) => ({ ...value })),
|
|
2674
2678
|
runToken: session.runToken,
|
|
2675
|
-
portalReportingIngestUrl: session.portalReportingIngestUrl
|
|
2679
|
+
portalReportingIngestUrl: session.portalReportingIngestUrl,
|
|
2680
|
+
portalReportingRunId: session.portalReportingRunId
|
|
2676
2681
|
};
|
|
2677
2682
|
}
|
|
2678
2683
|
function cloneNodeInfo(nodeInfo) {
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -560,6 +560,7 @@ export interface LoadStrikeSinkSession {
|
|
|
560
560
|
infraConfig?: Record<string, unknown>;
|
|
561
561
|
runToken?: string;
|
|
562
562
|
portalReportingIngestUrl?: string;
|
|
563
|
+
portalReportingRunId?: string;
|
|
563
564
|
}
|
|
564
565
|
export interface LoadStrikeBaseContext {
|
|
565
566
|
logger: LoadStrikeLogger;
|
|
@@ -577,11 +578,13 @@ export interface LoadStrikeSessionStartInfo extends LoadStrikeBaseContext {
|
|
|
577
578
|
scenarios: LoadStrikeScenarioStartInfo[];
|
|
578
579
|
runToken?: string;
|
|
579
580
|
portalReportingIngestUrl?: string;
|
|
581
|
+
portalReportingRunId?: string;
|
|
580
582
|
readonly StartedUtc?: string;
|
|
581
583
|
readonly ScenarioNames?: string[];
|
|
582
584
|
readonly Scenarios?: LoadStrikeScenarioStartInfo[];
|
|
583
585
|
readonly RunToken?: string;
|
|
584
586
|
readonly PortalReportingIngestUrl?: string;
|
|
587
|
+
readonly PortalReportingRunId?: string;
|
|
585
588
|
}
|
|
586
589
|
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> & {
|
|
587
590
|
[Key in Keys]-?: Required<Pick<T, Key>> & Partial<Pick<T, Exclude<Keys, Key>>>;
|
package/dist/types/sinks.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ interface LoadStrikeNodeStats {
|
|
|
24
24
|
}
|
|
25
25
|
type SinkFetch = (input: string, init?: RequestInit) => Promise<Response>;
|
|
26
26
|
interface ReportingSinkEvent {
|
|
27
|
+
runId: string;
|
|
27
28
|
eventType: string;
|
|
28
29
|
occurredUtc: Date;
|
|
29
30
|
sessionId: string;
|
|
@@ -38,6 +39,7 @@ interface ReportingSinkEvent {
|
|
|
38
39
|
fields: Record<string, unknown>;
|
|
39
40
|
}
|
|
40
41
|
interface SinkSessionMetadata {
|
|
42
|
+
runId: string;
|
|
41
43
|
sessionId: string;
|
|
42
44
|
testSuite: string;
|
|
43
45
|
testName: string;
|
package/package.json
CHANGED