@gscdump/engine-gsc-api 0.35.12 → 0.36.0
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.mjs +10 -2
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -103,6 +103,9 @@ function isMetricDimension(dim) {
|
|
|
103
103
|
function builderFromState(state) {
|
|
104
104
|
return { getState: () => state };
|
|
105
105
|
}
|
|
106
|
+
function canPushDownPagination(state) {
|
|
107
|
+
return !state.orderBy && extractMetricFilters(state.filter).length === 0 && extractSpecialOperatorFilters(state.filter).length === 0;
|
|
108
|
+
}
|
|
106
109
|
function createGscApiQuerySource(options) {
|
|
107
110
|
const { client, siteUrl } = options;
|
|
108
111
|
return {
|
|
@@ -113,12 +116,17 @@ function createGscApiQuerySource(options) {
|
|
|
113
116
|
buildLogicalPlan(state, GSC_API_CAPABILITIES);
|
|
114
117
|
const filterDims = getFilterDimensions(state.filter, isMetricDimension);
|
|
115
118
|
assertDimensionsSupported([...state.dimensions, ...filterDims], "api", "gsc-api query source");
|
|
116
|
-
const
|
|
119
|
+
const pushDownPagination = canPushDownPagination(state);
|
|
120
|
+
const apiState = pushDownPagination ? state : {
|
|
117
121
|
...state,
|
|
118
122
|
rowLimit: void 0,
|
|
119
123
|
startRow: void 0
|
|
120
124
|
};
|
|
121
|
-
return applyBuilderStatePostProcessing(await collectRows(client.query(siteUrl, builderFromState(apiState))),
|
|
125
|
+
return applyBuilderStatePostProcessing(await collectRows(client.query(siteUrl, builderFromState(apiState))), pushDownPagination ? {
|
|
126
|
+
...state,
|
|
127
|
+
rowLimit: void 0,
|
|
128
|
+
startRow: void 0
|
|
129
|
+
} : state);
|
|
122
130
|
}
|
|
123
131
|
};
|
|
124
132
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/engine-gsc-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.36.0",
|
|
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.
|
|
40
|
-
"gscdump": "0.
|
|
39
|
+
"@gscdump/engine": "0.36.0",
|
|
40
|
+
"gscdump": "0.36.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"vitest": "^4.1.9"
|