@gscdump/engine-gsc-api 0.20.1 → 0.20.2

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/index.d.mts CHANGED
@@ -103,8 +103,9 @@ interface RunGscSyncSliceOptions {
103
103
  dataState?: GscDataState;
104
104
  /**
105
105
  * Invoked per GSC API page with the rows fetched. Return a promise; the
106
- * loop awaits it before paging further. Throw inside to abort; AbortError /
107
- * timeout messages are swallowed so the continuation can re-process.
106
+ * loop awaits it before paging further. Throw a durable error to abort the
107
+ * slice. A thrown AbortError / timeout stops the loop and returns retry
108
+ * state at the current cursor so the continuation re-processes this page.
108
109
  */
109
110
  onBatch: (rows: GscApiRow[]) => Promise<void>;
110
111
  initialStartRow?: number;
package/dist/index.mjs CHANGED
@@ -240,10 +240,17 @@ async function runGscSyncSlice(opts) {
240
240
  searchType,
241
241
  rowsThisPage: rows.length
242
242
  });
243
- if (rows.length > 0) await opts.onBatch(rows).catch((err) => {
244
- if (isTimeoutLike(err)) return;
245
- throw err;
246
- });
243
+ if (rows.length > 0) {
244
+ if (await opts.onBatch(rows).then(() => false).catch((err) => {
245
+ if (isTimeoutLike(err)) return true;
246
+ throw err;
247
+ })) return {
248
+ totalRows: totalRows - rows.length,
249
+ hasMore: true,
250
+ nextStartRow: startRow,
251
+ metadata
252
+ };
253
+ }
247
254
  if (rows.length < rowLimit) break;
248
255
  startRow += rows.length;
249
256
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/engine-gsc-api",
3
3
  "type": "module",
4
- "version": "0.20.1",
4
+ "version": "0.20.2",
5
5
  "description": "GSC live-API engine adapter — wraps the Search Analytics REST API as an AnalysisQuerySource for typed analyzer dispatch.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -36,8 +36,8 @@
36
36
  "node": ">=18"
37
37
  },
38
38
  "dependencies": {
39
- "@gscdump/engine": "0.20.1",
40
- "gscdump": "0.20.1"
39
+ "@gscdump/engine": "0.20.2",
40
+ "gscdump": "0.20.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "vitest": "^4.1.6"