@rickcedwhat/playwright-smart-table 6.24.0-next.b538792 → 6.24.0-next.c5e9002

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.
@@ -45,8 +45,9 @@ async function runMap(env, callback, options = {}, label = 'map') {
45
45
  let rowIndex = 0;
46
46
  let stopped = false;
47
47
  let stoppedIndex = Infinity;
48
+ // In parallel/synchronized mode rows can call stop() out of order; the earliest row wins.
48
49
  const stop = (idx) => {
49
- if (!stopped) {
50
+ if (idx < stoppedIndex) {
50
51
  log(env.config, `${label}: stop() called at row ${idx} — halting`);
51
52
  stopped = true;
52
53
  stoppedIndex = idx;
@@ -3,4 +3,4 @@
3
3
  * Generated by scripts/embed-version.mjs from package.json
4
4
  */
5
5
  /** Semver of this package. Use in logs or diagnostics to confirm the installed build. */
6
- export declare const PLAYWRIGHT_SMART_TABLE_VERSION: "6.24.0-next.b538792";
6
+ export declare const PLAYWRIGHT_SMART_TABLE_VERSION: "6.24.0-next.c5e9002";
@@ -6,4 +6,4 @@ exports.PLAYWRIGHT_SMART_TABLE_VERSION = void 0;
6
6
  * Generated by scripts/embed-version.mjs from package.json
7
7
  */
8
8
  /** Semver of this package. Use in logs or diagnostics to confirm the installed build. */
9
- exports.PLAYWRIGHT_SMART_TABLE_VERSION = "6.24.0-next.b538792";
9
+ exports.PLAYWRIGHT_SMART_TABLE_VERSION = "6.24.0-next.c5e9002";
package/dist/types.d.ts CHANGED
@@ -760,6 +760,14 @@ export type RowIterationContext<T = any> = {
760
760
  index: number;
761
761
  /** 0-based page index — which page this row was collected from. */
762
762
  pageIndex: number;
763
+ /**
764
+ * Ends the iteration. No further pages are loaded, and the result of `map` / `filter`
765
+ * includes this row and nothing after it. If several rows call `stop()`, the earliest one wins.
766
+ *
767
+ * In `'sequential'` mode (the default) no callback after this row runs. In `'parallel'` and
768
+ * `'synchronized'` mode the rest of the current page is already in flight, so later rows'
769
+ * callbacks may still run (and their side effects happen) even though their results are dropped.
770
+ */
763
771
  stop: () => void;
764
772
  };
765
773
  /** Concurrency modes for row iteration. */
@@ -935,7 +943,8 @@ export interface TableResult<T = any> extends AsyncIterable<{
935
943
  /**
936
944
  * Iterates every row across all pages, calling the callback for side effects.
937
945
  * Execution is sequential by default (safe for interactions like clicking/filling).
938
- * Call `stop()` in the callback to end iteration early.
946
+ * Call `stop()` in the callback to end iteration early. In sequential mode no later row runs;
947
+ * in parallel mode the rest of the current page may still run (see `RowIterationContext.stop`).
939
948
  *
940
949
  * @param callback - Function receiving { row, rowIndex, stop }
941
950
  * @param options - maxPages, concurrency, dedupe, useBulkPagination
@@ -952,7 +961,8 @@ export interface TableResult<T = any> extends AsyncIterable<{
952
961
  * Defaults to `concurrency: 'sequential'` (safe for clicks/fills). Pass
953
962
  * `concurrency: 'parallel'` for read-only extraction, or `'synchronized'` when
954
963
  * navigation must stay lock-step on virtualized grids.
955
- * Call `stop()` to halt after the current page finishes.
964
+ * Call `stop()` to end early: the result includes the row that called it and nothing after it
965
+ * (in parallel mode, later rows on the same page may still run; see `RowIterationContext.stop`).
956
966
  *
957
967
  * @param callback - Function receiving { row, rowIndex, stop }
958
968
  * @param options - maxPages, concurrency, dedupe, useBulkPagination
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rickcedwhat/playwright-smart-table",
3
- "version": "6.24.0-next.b538792",
3
+ "version": "6.24.0-next.c5e9002",
4
4
  "description": "Smart, column-aware table interactions for Playwright",
5
5
  "author": "Cedrick Catalan",
6
6
  "license": "MIT",