@checksum-ai/runtime 1.1.52 → 1.1.53-beta
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/checksumlib.js +147 -39
- package/cli.js +67 -67
- package/index.js +58 -58
- package/package.json +1 -1
- package/vtg-build/asset-manifest.json +3 -3
- package/vtg-build/index.html +1 -1
- package/vtg-build/static/js/main.1d284e9a.js +3 -0
- package/vtg-build/static/js/main.1d284e9a.js.LICENSE.txt +146 -0
- package/vtg-build/static/js/main.1d284e9a.js.map +1 -0
package/checksumlib.js
CHANGED
|
@@ -29412,14 +29412,74 @@
|
|
|
29412
29412
|
|
|
29413
29413
|
// ../browser-lib/src/session-record-replay/session-replayer.ts
|
|
29414
29414
|
var import_await_sleep3 = __toESM(require_await_sleep());
|
|
29415
|
+
|
|
29416
|
+
// ../browser-lib/src/session-record-replay/replayer-listeners-manager.ts
|
|
29417
|
+
var ReplayerListenersManager = class {
|
|
29418
|
+
constructor() {
|
|
29419
|
+
this._replayingState = "Paused" /* Paused */;
|
|
29420
|
+
// Internal state for isShowing
|
|
29421
|
+
this.listeners = [];
|
|
29422
|
+
}
|
|
29423
|
+
static {
|
|
29424
|
+
__name(this, "ReplayerListenersManager");
|
|
29425
|
+
}
|
|
29426
|
+
// Listeners array
|
|
29427
|
+
// Setter for isShowing with listener notification
|
|
29428
|
+
set replayingState(value) {
|
|
29429
|
+
this._replayingState = value;
|
|
29430
|
+
this.notifyListeners();
|
|
29431
|
+
}
|
|
29432
|
+
// Add a listener to observe changes to isShowing
|
|
29433
|
+
addListener(listener) {
|
|
29434
|
+
this.listeners.push(listener);
|
|
29435
|
+
}
|
|
29436
|
+
// Remove a listener
|
|
29437
|
+
removeListener(listener) {
|
|
29438
|
+
this.listeners = this.listeners.filter((l2) => l2 !== listener);
|
|
29439
|
+
}
|
|
29440
|
+
// Wrapper function to handle loading state
|
|
29441
|
+
async wrapWithLoadingState(fn, loadingCompletedState = "Paused" /* Paused */) {
|
|
29442
|
+
this.replayingState = "Processing" /* Processing */;
|
|
29443
|
+
return new Promise((resolve2, reject) => {
|
|
29444
|
+
requestAnimationFrame(() => {
|
|
29445
|
+
setTimeout(() => {
|
|
29446
|
+
fn().then((result2) => {
|
|
29447
|
+
resolve2(result2);
|
|
29448
|
+
}).catch((error) => {
|
|
29449
|
+
reject(error);
|
|
29450
|
+
}).finally(() => {
|
|
29451
|
+
this.replayingState = loadingCompletedState;
|
|
29452
|
+
});
|
|
29453
|
+
}, 0);
|
|
29454
|
+
});
|
|
29455
|
+
});
|
|
29456
|
+
}
|
|
29457
|
+
// Notify all listeners of the state change
|
|
29458
|
+
notifyListeners() {
|
|
29459
|
+
this.listeners.forEach((listener) => listener(this._replayingState));
|
|
29460
|
+
}
|
|
29461
|
+
};
|
|
29462
|
+
|
|
29463
|
+
// ../browser-lib/src/session-record-replay/session-replayer.ts
|
|
29415
29464
|
var DEBUG_MODE = false;
|
|
29416
29465
|
var SessionReplayer = class {
|
|
29417
29466
|
constructor(config = {}) {
|
|
29418
|
-
|
|
29419
|
-
this.eventsBuffer = [];
|
|
29467
|
+
this.initialEventsBuffer = [];
|
|
29420
29468
|
this.config = {
|
|
29421
29469
|
enableInteract: false
|
|
29422
29470
|
};
|
|
29471
|
+
this.overlayElement = null;
|
|
29472
|
+
this.timer = null;
|
|
29473
|
+
this.animationFrameStepHandler = {
|
|
29474
|
+
wait: /* @__PURE__ */ __name((callback) => requestAnimationFrame(callback), "wait"),
|
|
29475
|
+
cancel: /* @__PURE__ */ __name((id) => cancelAnimationFrame(id), "cancel")
|
|
29476
|
+
};
|
|
29477
|
+
this.timoutStepHandler = {
|
|
29478
|
+
wait: /* @__PURE__ */ __name((callback) => {
|
|
29479
|
+
return setTimeout(callback, 100);
|
|
29480
|
+
}, "wait"),
|
|
29481
|
+
cancel: /* @__PURE__ */ __name((id) => clearTimeout(id), "cancel")
|
|
29482
|
+
};
|
|
29423
29483
|
this.stop = /* @__PURE__ */ __name(() => {
|
|
29424
29484
|
try {
|
|
29425
29485
|
if (this.replayer) {
|
|
@@ -29442,6 +29502,7 @@
|
|
|
29442
29502
|
castedEvents: []
|
|
29443
29503
|
};
|
|
29444
29504
|
this.config = { ...this.config, ...config };
|
|
29505
|
+
this.replayerListenersManager = new ReplayerListenersManager();
|
|
29445
29506
|
}
|
|
29446
29507
|
static {
|
|
29447
29508
|
__name(this, "SessionReplayer");
|
|
@@ -29487,18 +29548,53 @@
|
|
|
29487
29548
|
}
|
|
29488
29549
|
});
|
|
29489
29550
|
}
|
|
29551
|
+
getCurrentTimestamp() {
|
|
29552
|
+
try {
|
|
29553
|
+
return this.replayer.getCurrentTime() + this.firstEvent.timestamp;
|
|
29554
|
+
} catch (e2) {
|
|
29555
|
+
return 0;
|
|
29556
|
+
}
|
|
29557
|
+
}
|
|
29558
|
+
monitorTime(targetTime, onTargetHook, stepHandler = this.animationFrameStepHandler) {
|
|
29559
|
+
const stopTimer = /* @__PURE__ */ __name(() => {
|
|
29560
|
+
if (this.timer) {
|
|
29561
|
+
stepHandler.cancel(this.timer);
|
|
29562
|
+
this.timer = null;
|
|
29563
|
+
}
|
|
29564
|
+
}, "stopTimer");
|
|
29565
|
+
stopTimer();
|
|
29566
|
+
const update = /* @__PURE__ */ __name(() => {
|
|
29567
|
+
const currentTime = this.replayer.getCurrentTime();
|
|
29568
|
+
if (targetTime && currentTime >= targetTime) {
|
|
29569
|
+
console.log(
|
|
29570
|
+
`[SessionReplayer] achieved target time: ${targetTime} with current time ${currentTime}`,
|
|
29571
|
+
Date.now()
|
|
29572
|
+
);
|
|
29573
|
+
onTargetHook();
|
|
29574
|
+
stopTimer();
|
|
29575
|
+
return;
|
|
29576
|
+
} else {
|
|
29577
|
+
console.log(
|
|
29578
|
+
`[SessionReplayer] monitoring time, current: ${currentTime}; target: ${targetTime}...`
|
|
29579
|
+
);
|
|
29580
|
+
}
|
|
29581
|
+
const meta = this.replayer.getMetaData();
|
|
29582
|
+
if (currentTime < meta.totalTime) {
|
|
29583
|
+
this.timer = stepHandler.wait(update);
|
|
29584
|
+
}
|
|
29585
|
+
}, "update");
|
|
29586
|
+
this.timer = stepHandler.wait(update);
|
|
29587
|
+
}
|
|
29490
29588
|
seek(ts, pause = true) {
|
|
29491
29589
|
return new Promise((resolve2) => {
|
|
29492
29590
|
const delta = ts - this.firstEvent.timestamp;
|
|
29493
|
-
this.
|
|
29494
|
-
|
|
29495
|
-
|
|
29496
|
-
|
|
29497
|
-
resolve2();
|
|
29498
|
-
}, 0);
|
|
29499
|
-
} else {
|
|
29591
|
+
this.monitorTime(delta, () => {
|
|
29592
|
+
if (pause) {
|
|
29593
|
+
this.replayer.pause();
|
|
29594
|
+
}
|
|
29500
29595
|
resolve2();
|
|
29501
|
-
}
|
|
29596
|
+
});
|
|
29597
|
+
this.replayer.play(delta);
|
|
29502
29598
|
});
|
|
29503
29599
|
}
|
|
29504
29600
|
start(options, castedEvents = []) {
|
|
@@ -29509,9 +29605,9 @@
|
|
|
29509
29605
|
if (this.config.onlyLive) {
|
|
29510
29606
|
this.makeReplayer([], { baselineTime: events[0].timestamp });
|
|
29511
29607
|
} else {
|
|
29512
|
-
this.
|
|
29513
|
-
if (this.
|
|
29514
|
-
this.makeReplayer(this.
|
|
29608
|
+
this.initialEventsBuffer.push(...events);
|
|
29609
|
+
if (this.initialEventsBuffer.length >= 2) {
|
|
29610
|
+
this.makeReplayer(this.initialEventsBuffer);
|
|
29515
29611
|
} else {
|
|
29516
29612
|
return;
|
|
29517
29613
|
}
|
|
@@ -29538,16 +29634,22 @@
|
|
|
29538
29634
|
return promise;
|
|
29539
29635
|
}
|
|
29540
29636
|
async goLive() {
|
|
29541
|
-
await this.
|
|
29542
|
-
|
|
29637
|
+
await this.replayerListenersManager.wrapWithLoadingState(async () => {
|
|
29638
|
+
await this.seek(this.lastEvent.timestamp, false);
|
|
29639
|
+
await (0, import_await_sleep3.default)(1e3);
|
|
29640
|
+
});
|
|
29543
29641
|
}
|
|
29544
29642
|
async goBack(timestamp, {
|
|
29545
29643
|
sleepAfter = 1e3,
|
|
29546
29644
|
beforeTimestamp = false,
|
|
29547
29645
|
includeAllMatchingTimestamps = false
|
|
29548
29646
|
} = {}) {
|
|
29549
|
-
await this.
|
|
29550
|
-
|
|
29647
|
+
await this.replayerListenersManager.wrapWithLoadingState(async () => {
|
|
29648
|
+
await this.seek(timestamp, true);
|
|
29649
|
+
if (sleepAfter) {
|
|
29650
|
+
await (0, import_await_sleep3.default)(sleepAfter);
|
|
29651
|
+
}
|
|
29652
|
+
});
|
|
29551
29653
|
}
|
|
29552
29654
|
storeEvent(event) {
|
|
29553
29655
|
if (!this.debugData.active) {
|
|
@@ -29565,7 +29667,7 @@
|
|
|
29565
29667
|
this.debugData.active = true;
|
|
29566
29668
|
window.__chkreplayer = {
|
|
29567
29669
|
events: /* @__PURE__ */ __name(() => this.debugData.events, "events"),
|
|
29568
|
-
back: /* @__PURE__ */ __name((ts) => this.goBack(ts
|
|
29670
|
+
back: /* @__PURE__ */ __name((ts) => this.goBack(ts), "back"),
|
|
29569
29671
|
currentTime: /* @__PURE__ */ __name(() => this.replayer.getCurrentTime(), "currentTime"),
|
|
29570
29672
|
castedEvents: /* @__PURE__ */ __name(() => this.debugData.castedEvents, "castedEvents")
|
|
29571
29673
|
};
|
|
@@ -30691,12 +30793,6 @@
|
|
|
30691
30793
|
this.observer = new MutationObserver((mutations) => {
|
|
30692
30794
|
mutations.forEach((mutation) => {
|
|
30693
30795
|
mutation.addedNodes.forEach((addedNode) => {
|
|
30694
|
-
if (addedNode.querySelector) {
|
|
30695
|
-
const ifr = addedNode.querySelector("iframe");
|
|
30696
|
-
if (ifr) {
|
|
30697
|
-
console.log("FFF", ifr);
|
|
30698
|
-
}
|
|
30699
|
-
}
|
|
30700
30796
|
if (addedNode.nodeType !== Node.ELEMENT_NODE) {
|
|
30701
30797
|
return;
|
|
30702
30798
|
}
|
|
@@ -32409,7 +32505,7 @@
|
|
|
32409
32505
|
|
|
32410
32506
|
// ../js-lib/src/helpers/helpers.ts
|
|
32411
32507
|
var awaitSleep = /* @__PURE__ */ __name((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)), "awaitSleep");
|
|
32412
|
-
var guardReturn = /* @__PURE__ */ __name(async (promise, timeout = 1e3, errMessage
|
|
32508
|
+
var guardReturn = /* @__PURE__ */ __name(async (promise, timeout = 1e3, errMessage) => {
|
|
32413
32509
|
if (timeout === null) {
|
|
32414
32510
|
return promise;
|
|
32415
32511
|
}
|
|
@@ -32420,7 +32516,10 @@
|
|
|
32420
32516
|
}, "guard");
|
|
32421
32517
|
const res = await Promise.race([promise, guard()]);
|
|
32422
32518
|
if (typeof res === "string" && res === timeoutStringIdentifier) {
|
|
32423
|
-
|
|
32519
|
+
if (typeof errMessage === "function") {
|
|
32520
|
+
throw new Error(errMessage());
|
|
32521
|
+
}
|
|
32522
|
+
throw new Error(errMessage ?? "guardReturnTimedOut");
|
|
32424
32523
|
}
|
|
32425
32524
|
return res;
|
|
32426
32525
|
}, "guardReturn");
|
|
@@ -32516,6 +32615,7 @@
|
|
|
32516
32615
|
this.expandCSSKeyFeatures(element, cssKeyElements);
|
|
32517
32616
|
}
|
|
32518
32617
|
while (element && element !== this.rootNode) {
|
|
32618
|
+
await awaitSleep(0);
|
|
32519
32619
|
const elementCandidates = this.getAllLocators(
|
|
32520
32620
|
element,
|
|
32521
32621
|
cssKeyElements,
|
|
@@ -32525,11 +32625,12 @@
|
|
|
32525
32625
|
}
|
|
32526
32626
|
);
|
|
32527
32627
|
const validLocators = [];
|
|
32528
|
-
const testCandidate = /* @__PURE__ */ __name((chain) => {
|
|
32628
|
+
const testCandidate = /* @__PURE__ */ __name(async (chain) => {
|
|
32529
32629
|
if (chain.hasDuplicateFilters()) {
|
|
32530
32630
|
return;
|
|
32531
32631
|
}
|
|
32532
32632
|
try {
|
|
32633
|
+
await awaitSleep(0);
|
|
32533
32634
|
const { elements } = this.getLocatorBase(element).locator(
|
|
32534
32635
|
chain.getSelector()
|
|
32535
32636
|
);
|
|
@@ -32543,15 +32644,15 @@
|
|
|
32543
32644
|
}
|
|
32544
32645
|
}, "testCandidate");
|
|
32545
32646
|
if (!locatorsChains.length) {
|
|
32546
|
-
elementCandidates
|
|
32547
|
-
|
|
32548
|
-
|
|
32647
|
+
for (const ec of elementCandidates) {
|
|
32648
|
+
await testCandidate(new LocatorChain([ec]));
|
|
32649
|
+
}
|
|
32549
32650
|
} else {
|
|
32550
|
-
|
|
32551
|
-
locatorsChains
|
|
32552
|
-
|
|
32553
|
-
|
|
32554
|
-
}
|
|
32651
|
+
for (const ec of elementCandidates) {
|
|
32652
|
+
for (const sc of locatorsChains) {
|
|
32653
|
+
await testCandidate(sc.cloneAndAddCandidate(ec));
|
|
32654
|
+
}
|
|
32655
|
+
}
|
|
32555
32656
|
}
|
|
32556
32657
|
if (validLocators.length === 0 && locatorsChains.length === 0) {
|
|
32557
32658
|
const selector = element.tagName.toLowerCase();
|
|
@@ -32944,7 +33045,7 @@
|
|
|
32944
33045
|
* @returns array of new candidates that return only one element
|
|
32945
33046
|
*/
|
|
32946
33047
|
async reduceMultiCandidates(candidate) {
|
|
32947
|
-
await awaitSleep(
|
|
33048
|
+
await awaitSleep(0);
|
|
32948
33049
|
const { elements } = candidate;
|
|
32949
33050
|
const parts = candidate.getSelector().split(" >> ");
|
|
32950
33051
|
const newCandidates = [];
|
|
@@ -34008,6 +34109,7 @@
|
|
|
34008
34109
|
this.sessionMirror = sessionMirror;
|
|
34009
34110
|
}
|
|
34010
34111
|
// Get files for a specific input by rrwebId
|
|
34112
|
+
// !! used in msg broker
|
|
34011
34113
|
async getFilesByRrwebId(rrwebId) {
|
|
34012
34114
|
const files = this.filesMap[rrwebId] ?? [];
|
|
34013
34115
|
try {
|
|
@@ -34074,7 +34176,10 @@
|
|
|
34074
34176
|
onBodyReady();
|
|
34075
34177
|
}
|
|
34076
34178
|
});
|
|
34077
|
-
bodyObserver.observe(document2.documentElement, {
|
|
34179
|
+
bodyObserver.observe(document2.documentElement, {
|
|
34180
|
+
childList: true,
|
|
34181
|
+
subtree: true
|
|
34182
|
+
});
|
|
34078
34183
|
}
|
|
34079
34184
|
// Cleanup the observer and remove event listeners
|
|
34080
34185
|
cleanup() {
|
|
@@ -34598,7 +34703,6 @@ ${data.locator}`
|
|
|
34598
34703
|
event.isCheckout = isCheckout;
|
|
34599
34704
|
window.checksumSendBroadcastMessage?.("rrweb", [event]);
|
|
34600
34705
|
this.lastRrwebEventTimestamp = event.timestamp;
|
|
34601
|
-
console.log(event.timestamp);
|
|
34602
34706
|
}, config.recordOptions);
|
|
34603
34707
|
}
|
|
34604
34708
|
if (initFilesObserver) {
|
|
@@ -35424,6 +35528,7 @@ ${data.locator}`
|
|
|
35424
35528
|
constructor() {
|
|
35425
35529
|
super({ enableInteract: true });
|
|
35426
35530
|
this.shouldHandleEvents = true;
|
|
35531
|
+
this.name = "timeMachine";
|
|
35427
35532
|
}
|
|
35428
35533
|
static {
|
|
35429
35534
|
__name(this, "TimeMachine");
|
|
@@ -35455,7 +35560,7 @@ ${data.locator}`
|
|
|
35455
35560
|
if (!timestamp) {
|
|
35456
35561
|
return this.goLive();
|
|
35457
35562
|
}
|
|
35458
|
-
return this.sessionReplayer.goBack(timestamp
|
|
35563
|
+
return this.sessionReplayer.goBack(timestamp);
|
|
35459
35564
|
}
|
|
35460
35565
|
getElementByRRwebId(rrwebId) {
|
|
35461
35566
|
return this.sessionReplayer.getNodeById(rrwebId);
|
|
@@ -35463,6 +35568,9 @@ ${data.locator}`
|
|
|
35463
35568
|
goLive() {
|
|
35464
35569
|
return this.sessionReplayer.goLive();
|
|
35465
35570
|
}
|
|
35571
|
+
getCurrentTimestamp() {
|
|
35572
|
+
return this.sessionReplayer.getCurrentTimestamp();
|
|
35573
|
+
}
|
|
35466
35574
|
};
|
|
35467
35575
|
|
|
35468
35576
|
// ../browser-lib/src/visual-test-generator/time-machine-event-handlers.ts
|