gscdump 0.1.2 → 0.1.3
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/README.md +3 -4
- package/dist/index.d.mts +5 -1
- package/dist/index.mjs +10 -1
- package/dist/query/index.d.mts +5 -1
- package/dist/query/index.mjs +28 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,8 +23,8 @@ npm install gscdump
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
|
-
import { daysAgo, today } from '@gscdump/query'
|
|
27
26
|
import { fetchKeywordsWithComparison, fetchPagesWithComparison } from 'gscdump'
|
|
27
|
+
import { daysAgo, today } from 'gscdump/query'
|
|
28
28
|
|
|
29
29
|
// Auth accepts token string or object
|
|
30
30
|
const auth = 'ya29.xxx...'
|
|
@@ -87,8 +87,7 @@ result.rows[0].clicks // type: number
|
|
|
87
87
|
**With date helpers:**
|
|
88
88
|
|
|
89
89
|
```ts
|
|
90
|
-
import { daysAgo, today } from '
|
|
91
|
-
import { and, between, date, gsc, query, regex } from 'gscdump/query'
|
|
90
|
+
import { and, between, date, daysAgo, gsc, query, regex, today } from 'gscdump/query'
|
|
92
91
|
|
|
93
92
|
const q = gsc
|
|
94
93
|
.select('query', 'page')
|
|
@@ -154,7 +153,7 @@ const cannibalization = analyzeCannibalization(keywordPageData)
|
|
|
154
153
|
|
|
155
154
|
**Low-level:** `gscClient`, `queryRecursive`, `queryRecursiveStream`, `createQueryBody`, `withPropertyAggregation`, `withSearchAppearance`, `withDataType`, `withFreshData`, `withFinalData`
|
|
156
155
|
|
|
157
|
-
**Query Builder (`gscdump/query`):** `gsc`, `eq`, `ne`, `and`, `or`, `inArray`, `contains`, `like`, `regex`, `notRegex`, `not`, `between`, `gte`, `gt`, `lte`, `lt`, `page`, `query`, `device`, `country`, `date`, `searchAppearance`, `Device`, `Country`
|
|
156
|
+
**Query Builder (`gscdump/query`):** `gsc`, `eq`, `ne`, `and`, `or`, `inArray`, `contains`, `like`, `regex`, `notRegex`, `not`, `between`, `gte`, `gt`, `lte`, `lt`, `page`, `query`, `device`, `country`, `date`, `searchAppearance`, `Device`, `Country`, `today`, `daysAgo`
|
|
158
157
|
|
|
159
158
|
**Error Utilities:** `isQuotaError`, `isRateLimitError`, `isAuthError`, `getErrorCode`, `getErrorMessage`, `getRetryAfter`, `analyzeGscError`, `formatGscErrorForCli`
|
|
160
159
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1151,6 +1151,10 @@ declare function extractDateRange(filters: Filter<any>[]): {
|
|
|
1151
1151
|
endDate?: string;
|
|
1152
1152
|
};
|
|
1153
1153
|
//#endregion
|
|
1154
|
+
//#region src/query/index.d.ts
|
|
1155
|
+
declare function today(): string;
|
|
1156
|
+
declare function daysAgo(n: number): string;
|
|
1157
|
+
//#endregion
|
|
1154
1158
|
//#region src/utils/dayjs.d.ts
|
|
1155
1159
|
declare function dayjs(date?: _dayjs.ConfigType): Dayjs;
|
|
1156
1160
|
declare function currentPstDate(): string;
|
|
@@ -1172,4 +1176,4 @@ declare function formatDateGsc(d?: Date | string | null): string | null | undefi
|
|
|
1172
1176
|
*/
|
|
1173
1177
|
declare function percentDifference(a?: number | null, b?: number | null): number;
|
|
1174
1178
|
//#endregion
|
|
1175
|
-
export { AggregationType, AnalyticsData, ApiSite, ApiSitemap, ApiSitemapContent, Auth, AuthClient, AuthOptions, BaseMetrics, BrandSegmentationOptions, BrandSegmentationResult, BrandSummary, type BuilderState, CannibalizationOptions, CannibalizationPage, CannibalizationResult, CannibalizationSortMetric, ClusterType, ClusteringOptions, ClusteringResult, type Column, ComparisonResult, ConcentrationInput, ConcentrationItem, ConcentrationOptions, ConcentrationResult, ConcentrationRiskLevel, Country, type Country as CountryType, CountryData, DataRow, DataState, DataType, DateData, DateMetrics, DateRow, DatesComparisonResult, DecayInput, DecayOptions, DecayResult, DecaySortMetric, Device, type Device as DeviceType, DeviceData, type Dimension, DimensionFilter, DimensionFilterGroup, DimensionKey, type DimensionValueMap, ErrorInfo, FetchKeywordOptions, FetchKeywordResult, FetchPageOptions, FetchPageResult, type Filter, type GSCQueryBuilder, type GSCResult, type GSCRow, GSC_QUOTAS, GoogleSearchConsoleClient, GoogleSearchConsoleClientOptions, IndexStatusResult, IndexingMetadata, IndexingNotificationType, IndexingResult, InspectUrlIndexResponse, InspectUrlResult, KeywordCluster, KeywordData, KeywordRow, MobileUsabilityResult, MonthlyData, MoverData, MoversInput, MoversOptions, MoversResult, MoversSortMetric, OpportunityFactors, OpportunityOptions, OpportunityResult, OpportunitySortMetric, OpportunityWeights, Page, PageData, PageRow, Period, PublishUrlNotificationResponse, QueryOptions, QueryPageRow, QueryResultRow, RequiredNonNullable, ResolvedAnalyticsRange, RichResultsResult, SearchAnalyticsQuery, SearchAnalyticsResponse, SearchAppearanceData, SeasonalityMetric, SeasonalityOptions, SeasonalityResult, Site, SiteAnalytics, SortOrder, StreamRow, StrikingDistanceOptions, StrikingDistanceResult, StrikingDistanceSortMetric, UrlInspectionResult, UrlNotificationMetadata, YoYComparisonOptions, YoYComparisonResult, YoYMetrics, ZeroClickOptions, ZeroClickResult, analyzeBrandSegmentation, analyzeCannibalization, analyzeClustering, analyzeConcentration, analyzeDecay, analyzeError, analyzeKeywordConcentration, analyzeMovers, analyzeOpportunity, analyzePageConcentration, analyzeSeasonality, analyzeStrikingDistance, analyzeZeroClick, and, batchInspectUrls, batchRequestIndexing, between, collectStream, contains, _default as countries, country, createAuth, createFetch, createQueryBody, createSorter, currentPstDate, date, dayjs, dayjsPst, deleteSitemap, device, eq, extractDateRange, fetchAnalyticsWithComparison, fetchCountries, fetchCountriesWithComparison, fetchDates, fetchDatesWithComparison, fetchDevices, fetchDevicesWithComparison, fetchKeyword, fetchKeywords, fetchKeywordsWithComparison, fetchPage, fetchPages, fetchPagesWithComparison, fetchSearchAppearance, fetchSearchAppearanceWithComparison, fetchSitemap, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, fetchYoYComparison, formatDateGsc, formatErrorForCli, getErrorCode, getErrorMessage, getIndexingMetadata, getRetryAfter, googleSearchConsole, gsc, gt, gte, inArray, inspectUrl, isAuthError, isQuotaError, isRateLimitError, like, lt, lte, ne, not, notRegex, num, or, page, percentDifference, query, queryRecursive, queryRecursiveStream, regex, requestIndexing, searchAppearance, submitSitemap, withDataType, withFinalData, withFreshData, withPropertyAggregation, withSearchAppearance };
|
|
1179
|
+
export { AggregationType, AnalyticsData, ApiSite, ApiSitemap, ApiSitemapContent, Auth, AuthClient, AuthOptions, BaseMetrics, BrandSegmentationOptions, BrandSegmentationResult, BrandSummary, type BuilderState, CannibalizationOptions, CannibalizationPage, CannibalizationResult, CannibalizationSortMetric, ClusterType, ClusteringOptions, ClusteringResult, type Column, ComparisonResult, ConcentrationInput, ConcentrationItem, ConcentrationOptions, ConcentrationResult, ConcentrationRiskLevel, Country, type Country as CountryType, CountryData, DataRow, DataState, DataType, DateData, DateMetrics, DateRow, DatesComparisonResult, DecayInput, DecayOptions, DecayResult, DecaySortMetric, Device, type Device as DeviceType, DeviceData, type Dimension, DimensionFilter, DimensionFilterGroup, DimensionKey, type DimensionValueMap, ErrorInfo, FetchKeywordOptions, FetchKeywordResult, FetchPageOptions, FetchPageResult, type Filter, type GSCQueryBuilder, type GSCResult, type GSCRow, GSC_QUOTAS, GoogleSearchConsoleClient, GoogleSearchConsoleClientOptions, IndexStatusResult, IndexingMetadata, IndexingNotificationType, IndexingResult, InspectUrlIndexResponse, InspectUrlResult, KeywordCluster, KeywordData, KeywordRow, MobileUsabilityResult, MonthlyData, MoverData, MoversInput, MoversOptions, MoversResult, MoversSortMetric, OpportunityFactors, OpportunityOptions, OpportunityResult, OpportunitySortMetric, OpportunityWeights, Page, PageData, PageRow, Period, PublishUrlNotificationResponse, QueryOptions, QueryPageRow, QueryResultRow, RequiredNonNullable, ResolvedAnalyticsRange, RichResultsResult, SearchAnalyticsQuery, SearchAnalyticsResponse, SearchAppearanceData, SeasonalityMetric, SeasonalityOptions, SeasonalityResult, Site, SiteAnalytics, SortOrder, StreamRow, StrikingDistanceOptions, StrikingDistanceResult, StrikingDistanceSortMetric, UrlInspectionResult, UrlNotificationMetadata, YoYComparisonOptions, YoYComparisonResult, YoYMetrics, ZeroClickOptions, ZeroClickResult, analyzeBrandSegmentation, analyzeCannibalization, analyzeClustering, analyzeConcentration, analyzeDecay, analyzeError, analyzeKeywordConcentration, analyzeMovers, analyzeOpportunity, analyzePageConcentration, analyzeSeasonality, analyzeStrikingDistance, analyzeZeroClick, and, batchInspectUrls, batchRequestIndexing, between, collectStream, contains, _default as countries, country, createAuth, createFetch, createQueryBody, createSorter, currentPstDate, date, dayjs, dayjsPst, daysAgo, deleteSitemap, device, eq, extractDateRange, fetchAnalyticsWithComparison, fetchCountries, fetchCountriesWithComparison, fetchDates, fetchDatesWithComparison, fetchDevices, fetchDevicesWithComparison, fetchKeyword, fetchKeywords, fetchKeywordsWithComparison, fetchPage, fetchPages, fetchPagesWithComparison, fetchSearchAppearance, fetchSearchAppearanceWithComparison, fetchSitemap, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, fetchYoYComparison, formatDateGsc, formatErrorForCli, getErrorCode, getErrorMessage, getIndexingMetadata, getRetryAfter, googleSearchConsole, gsc, gt, gte, inArray, inspectUrl, isAuthError, isQuotaError, isRateLimitError, like, lt, lte, ne, not, notRegex, num, or, page, percentDifference, query, queryRecursive, queryRecursiveStream, regex, requestIndexing, searchAppearance, submitSitemap, today, withDataType, withFinalData, withFreshData, withPropertyAggregation, withSearchAppearance };
|
package/dist/index.mjs
CHANGED
|
@@ -3778,4 +3778,13 @@ function between(column, start, end) {
|
|
|
3778
3778
|
}
|
|
3779
3779
|
|
|
3780
3780
|
//#endregion
|
|
3781
|
-
|
|
3781
|
+
//#region src/query/index.ts
|
|
3782
|
+
function today() {
|
|
3783
|
+
return currentPstDate();
|
|
3784
|
+
}
|
|
3785
|
+
function daysAgo(n) {
|
|
3786
|
+
return dayjsPst().subtract(n, "day").format("YYYY-MM-DD");
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3789
|
+
//#endregion
|
|
3790
|
+
export { Country, Device, GSC_QUOTAS, analyzeBrandSegmentation, analyzeCannibalization, analyzeClustering, analyzeConcentration, analyzeDecay, analyzeError, analyzeKeywordConcentration, analyzeMovers, analyzeOpportunity, analyzePageConcentration, analyzeSeasonality, analyzeStrikingDistance, analyzeZeroClick, and, batchInspectUrls, batchRequestIndexing, between, collectStream, contains, countries_default as countries, country, createAuth, createFetch, createQueryBody, createSorter, currentPstDate, date, dayjs, dayjsPst, daysAgo, deleteSitemap, device, eq, extractDateRange, fetchAnalyticsWithComparison, fetchCountries, fetchCountriesWithComparison, fetchDates, fetchDatesWithComparison, fetchDevices, fetchDevicesWithComparison, fetchKeyword, fetchKeywords, fetchKeywordsWithComparison, fetchPage, fetchPages, fetchPagesWithComparison, fetchSearchAppearance, fetchSearchAppearanceWithComparison, fetchSitemap, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, fetchYoYComparison, formatDateGsc, formatErrorForCli, getErrorCode, getErrorMessage, getIndexingMetadata, getRetryAfter, googleSearchConsole, gsc, gt, gte, inArray, inspectUrl, isAuthError, isQuotaError, isRateLimitError, like, lt, lte, ne, not, notRegex, num, or, page, percentDifference, query, queryRecursive, queryRecursiveStream, regex, requestIndexing, searchAppearance, submitSitemap, today, withDataType, withFinalData, withFreshData, withPropertyAggregation, withSearchAppearance };
|
package/dist/query/index.d.mts
CHANGED
|
@@ -154,4 +154,8 @@ declare function extractDateRange(filters: Filter<any>[]): {
|
|
|
154
154
|
endDate?: string;
|
|
155
155
|
};
|
|
156
156
|
//#endregion
|
|
157
|
-
|
|
157
|
+
//#region src/query/index.d.ts
|
|
158
|
+
declare function today(): string;
|
|
159
|
+
declare function daysAgo(n: number): string;
|
|
160
|
+
//#endregion
|
|
161
|
+
export { type BuilderState, type Column, Country, type Country as CountryType, Device, type Device as DeviceType, type Dimension, type DimensionValueMap, type Filter, type GSCQueryBuilder, type GSCResult, type GSCRow, and, between, contains, country, date, daysAgo, device, eq, extractDateRange, gsc, gt, gte, inArray, like, lt, lte, ne, not, notRegex, or, page, query, regex, searchAppearance, today };
|
package/dist/query/index.mjs
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
import _dayjs from "dayjs";
|
|
2
|
+
import timezone from "dayjs/plugin/timezone.js";
|
|
3
|
+
import utc from "dayjs/plugin/utc.js";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/dayjs.ts
|
|
6
|
+
_dayjs.extend(utc);
|
|
7
|
+
_dayjs.extend(timezone);
|
|
8
|
+
function dayjs(date$1) {
|
|
9
|
+
return _dayjs(date$1);
|
|
10
|
+
}
|
|
11
|
+
function currentPstDate() {
|
|
12
|
+
return dayjs().tz("America/Los_Angeles").hour(12).minute(0).second(0).format("YYYY-MM-DD");
|
|
13
|
+
}
|
|
14
|
+
function dayjsPst() {
|
|
15
|
+
return dayjs().tz("America/Los_Angeles").hour(12).minute(0).second(0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
1
19
|
//#region src/query/resolver.ts
|
|
2
20
|
const DATE_OPERATORS = [
|
|
3
21
|
"gte",
|
|
@@ -1845,4 +1863,13 @@ function between(column, start, end) {
|
|
|
1845
1863
|
}
|
|
1846
1864
|
|
|
1847
1865
|
//#endregion
|
|
1848
|
-
|
|
1866
|
+
//#region src/query/index.ts
|
|
1867
|
+
function today() {
|
|
1868
|
+
return currentPstDate();
|
|
1869
|
+
}
|
|
1870
|
+
function daysAgo(n) {
|
|
1871
|
+
return dayjsPst().subtract(n, "day").format("YYYY-MM-DD");
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
//#endregion
|
|
1875
|
+
export { Country, Device, and, between, contains, country, date, daysAgo, device, eq, extractDateRange, gsc, gt, gte, inArray, like, lt, lte, ne, not, notRegex, or, page, query, regex, searchAppearance, today };
|
package/package.json
CHANGED