gscdump 0.22.4 → 0.23.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/query/index.d.mts +1 -4
- package/dist/query/index.mjs +22 -12
- package/package.json +3 -3
package/dist/query/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _dayjs, { Dayjs } from "dayjs";
|
|
2
1
|
import { TableName } from "@gscdump/contracts";
|
|
3
2
|
type GscSearchAnalyticsDimension = 'page' | 'query' | 'country' | 'device' | 'date' | 'hour' | 'searchAppearance';
|
|
4
3
|
type GscDataState = 'final' | 'all' | 'hourly_all';
|
|
@@ -271,9 +270,7 @@ declare function extractSpecialOperatorFilters(input?: FilterInput): InternalFil
|
|
|
271
270
|
* don't reach the engine.
|
|
272
271
|
*/
|
|
273
272
|
declare function extractSearchType(state: BuilderState | undefined | null): SearchType | undefined;
|
|
274
|
-
declare function dayjs(date?: _dayjs.ConfigType): Dayjs;
|
|
275
273
|
declare function currentPstDate(): string;
|
|
276
|
-
declare function dayjsPst(): Dayjs;
|
|
277
274
|
declare function today(): string;
|
|
278
275
|
declare function daysAgo(n: number): string;
|
|
279
|
-
export { type BuilderState, type Column, type ComparisonFilter, Countries, type Country, type Device, Devices, type Dimension, type DimensionValueMap, type Filter, type FilterInput, type GSCQueryBuilder, type GSCResult, type GSCRow, type InternalFilter, type JsonFilter, type JsonInternalFilter, type LogicalComparisonPlan, type LogicalDataset, type LogicalDimensionFilter, type LogicalMetricFilter, type LogicalQueryPlan, type Metric, type MetricColumn, type PlannerCapabilities, type QueryParam, type QueryParamName, type QueryParamValueMap, type SearchType, SearchTypes, UnsupportedLogicalCapabilityError, and, between, buildLogicalComparisonPlan, buildLogicalPlan, clicks, contains, country, ctr, currentPstDate, date,
|
|
276
|
+
export { type BuilderState, type Column, type ComparisonFilter, Countries, type Country, type Device, Devices, type Dimension, type DimensionValueMap, type Filter, type FilterInput, type GSCQueryBuilder, type GSCResult, type GSCRow, type InternalFilter, type JsonFilter, type JsonInternalFilter, type LogicalComparisonPlan, type LogicalDataset, type LogicalDimensionFilter, type LogicalMetricFilter, type LogicalQueryPlan, type Metric, type MetricColumn, type PlannerCapabilities, type QueryParam, type QueryParamName, type QueryParamValueMap, type SearchType, SearchTypes, UnsupportedLogicalCapabilityError, and, between, buildLogicalComparisonPlan, buildLogicalPlan, clicks, contains, country, ctr, currentPstDate, date, daysAgo, device, eq, extractDateRange, extractMetricFilters, extractSearchType, extractSpecialOperatorFilters, gsc, gt, gte, hour, impressions, inArray, isJsonFilter, like, lt, lte, ne, normalizeBuilderState, normalizeFilter, not, notRegex, or, page, parseJsonFilter, position, query, queryCanonical, regex, searchAppearance, searchType, today, topLevel };
|
package/dist/query/index.mjs
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { format, subDays } from "date-fns";
|
|
2
|
+
const PST_FORMATTER = new Intl.DateTimeFormat("en-CA", {
|
|
3
|
+
timeZone: "America/Los_Angeles",
|
|
4
|
+
year: "numeric",
|
|
5
|
+
month: "2-digit",
|
|
6
|
+
day: "2-digit"
|
|
7
|
+
});
|
|
8
|
+
function pstDateParts(d = /* @__PURE__ */ new Date()) {
|
|
9
|
+
const parts = PST_FORMATTER.formatToParts(d);
|
|
10
|
+
const get = (t) => Number(parts.find((p) => p.type === t).value);
|
|
11
|
+
return {
|
|
12
|
+
year: get("year"),
|
|
13
|
+
month: get("month"),
|
|
14
|
+
day: get("day")
|
|
15
|
+
};
|
|
8
16
|
}
|
|
9
17
|
function currentPstDate() {
|
|
10
|
-
|
|
18
|
+
const { year, month, day } = pstDateParts();
|
|
19
|
+
return `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
|
11
20
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
21
|
+
function daysAgoPst(n) {
|
|
22
|
+
const { year, month, day } = pstDateParts();
|
|
23
|
+
return format(subDays(new Date(year, month - 1, day, 12), n), "yyyy-MM-dd");
|
|
14
24
|
}
|
|
15
25
|
const MS_PER_DAY = 864e5;
|
|
16
26
|
function toIsoDate(d) {
|
|
@@ -2200,6 +2210,6 @@ function today() {
|
|
|
2200
2210
|
return currentPstDate();
|
|
2201
2211
|
}
|
|
2202
2212
|
function daysAgo(n) {
|
|
2203
|
-
return
|
|
2213
|
+
return daysAgoPst(n);
|
|
2204
2214
|
}
|
|
2205
|
-
export { Countries, Devices, SearchTypes, UnsupportedLogicalCapabilityError, and, between, buildLogicalComparisonPlan, buildLogicalPlan, clicks, contains, country, ctr, currentPstDate, date,
|
|
2215
|
+
export { Countries, Devices, SearchTypes, UnsupportedLogicalCapabilityError, and, between, buildLogicalComparisonPlan, buildLogicalPlan, clicks, contains, country, ctr, currentPstDate, date, daysAgo, device, eq, extractDateRange, extractMetricFilters, extractSearchType, extractSpecialOperatorFilters, gsc, gt, gte, hour, impressions, inArray, isJsonFilter, like, lt, lte, ne, normalizeBuilderState, normalizeFilter, not, notRegex, or, page, parseJsonFilter, position, query, queryCanonical, regex, searchAppearance, searchType, today, topLevel };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gscdump",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.23.0",
|
|
5
5
|
"description": "Google Search Console API wrapper with typed query builder, streaming pagination, and SEO analysis functions",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -104,11 +104,11 @@
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"
|
|
107
|
+
"date-fns": "^4.3.0",
|
|
108
108
|
"defu": "^6.1.7",
|
|
109
109
|
"ofetch": "^1.5.1",
|
|
110
110
|
"ufo": "^1.6.4",
|
|
111
|
-
"@gscdump/contracts": "0.
|
|
111
|
+
"@gscdump/contracts": "0.23.0"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@googleapis/indexing": "^6.0.1",
|