gscdump 3.4.4 → 3.6.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/README.md +36 -7
- package/dist/api/batch.d.mts +2 -3
- package/dist/api/batch.mjs +2 -0
- package/dist/api/indexing.d.mts +7 -8
- package/dist/api/indexing.mjs +1 -1
- package/dist/api/inspection.d.mts +21 -22
- package/dist/api/oauth.d.mts +8 -9
- package/dist/api/oauth.mjs +9 -1
- package/dist/api/sites.d.mts +9 -10
- package/dist/api/verification.d.mts +8 -9
- package/dist/bing/client.d.mts +3 -4
- package/dist/bing/client.mjs +10 -4
- package/dist/bing/normalize.d.mts +9 -10
- package/dist/bing/types.d.mts +42 -38
- package/dist/contracts.d.mts +12 -12
- package/dist/core/canonical.d.mts +3 -4
- package/dist/core/client.d.mts +16 -17
- package/dist/core/client.mjs +16 -13
- package/dist/core/errors.d.mts +9 -10
- package/dist/core/errors.mjs +2 -1
- package/dist/core/gsc-dates.d.mts +22 -23
- package/dist/core/indexing-issues.d.mts +10 -11
- package/dist/core/property.d.mts +9 -10
- package/dist/core/quota.d.mts +1 -2
- package/dist/core/result.d.mts +8 -9
- package/dist/core/scope-values.d.mts +5 -6
- package/dist/core/scopes.d.mts +3 -4
- package/dist/core/site-url.d.mts +4 -5
- package/dist/core/types.d.mts +29 -30
- package/dist/core/window.d.mts +5 -6
- package/dist/normalize.d.mts +1 -2
- package/dist/query/builder.d.mts +4 -5
- package/dist/query/columns.d.mts +13 -14
- package/dist/query/constants.d.mts +5 -5
- package/dist/query/errors.d.mts +7 -8
- package/dist/query/errors.mjs +1 -1
- package/dist/query/index.d.mts +3 -3
- package/dist/query/operators.d.mts +22 -23
- package/dist/query/plan.d.mts +18 -18
- package/dist/query/plan.mjs +7 -4
- package/dist/query/resolver.d.mts +10 -19
- package/dist/query/resolver.mjs +125 -61
- package/dist/query/types.d.mts +22 -23
- package/dist/query/utils/dayjs.d.mts +2 -3
- package/dist/sitemap-identity.d.mts +8 -9
- package/dist/tenant.d.mts +3 -4
- package/dist/url.d.mts +1 -2
- package/package.json +2 -2
package/dist/core/property.d.mts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
interface GscPropertyCandidate {
|
|
1
|
+
export interface GscPropertyCandidate {
|
|
2
2
|
siteUrl?: string | null;
|
|
3
3
|
permissionLevel?: string | null;
|
|
4
4
|
}
|
|
5
|
-
declare function isVerifiedGscProperty(property?: GscPropertyCandidate | null): boolean;
|
|
6
|
-
declare function isVerifiedGscPermission(level: string | null | undefined): boolean;
|
|
5
|
+
export declare function isVerifiedGscProperty(property?: GscPropertyCandidate | null): boolean;
|
|
6
|
+
export declare function isVerifiedGscPermission(level: string | null | undefined): boolean;
|
|
7
7
|
/**
|
|
8
8
|
* Does `propertyUrl` cover `targetDomain`? Matches sc-domain (exact or
|
|
9
9
|
* subdomain) and URL-prefix (host equality) without scheme/www noise.
|
|
10
10
|
*/
|
|
11
|
-
declare function gscPropertyMatchesTarget(targetDomain: string, propertyUrl: string | null | undefined): boolean;
|
|
11
|
+
export declare function gscPropertyMatchesTarget(targetDomain: string, propertyUrl: string | null | undefined): boolean;
|
|
12
12
|
/**
|
|
13
13
|
* Convenience: match `siteUrl` against `gscSiteUrl` directly (extracts the
|
|
14
14
|
* hostname from `siteUrl` first).
|
|
15
15
|
*/
|
|
16
|
-
declare function matchGscSite(siteUrl: string | null | undefined, gscSiteUrl: string | null | undefined): boolean;
|
|
16
|
+
export declare function matchGscSite(siteUrl: string | null | undefined, gscSiteUrl: string | null | undefined): boolean;
|
|
17
17
|
/**
|
|
18
18
|
* Pick the best GSC property for a hostname from a candidate list. "Best":
|
|
19
19
|
* 1. Verified Domain property (widest + readable)
|
|
@@ -25,17 +25,16 @@ declare function matchGscSite(siteUrl: string | null | undefined, gscSiteUrl: st
|
|
|
25
25
|
* Without this ranking, naively picking the first match would register an
|
|
26
26
|
* unverified property and leave the site stuck with zero data.
|
|
27
27
|
*/
|
|
28
|
-
declare function pickBestGscProperty<T extends GscPropertyCandidate>(origin: string, availableSites: readonly T[]): T | undefined;
|
|
28
|
+
export declare function pickBestGscProperty<T extends GscPropertyCandidate>(origin: string, availableSites: readonly T[]): T | undefined;
|
|
29
29
|
/**
|
|
30
30
|
* Richer best-property selection that also returns the matched domain and
|
|
31
31
|
* URL candidates separately, so callers can show "we matched on X domain
|
|
32
32
|
* property and Y URL-prefix property" diagnostics.
|
|
33
33
|
*/
|
|
34
|
-
declare function findBestGscProperty<T extends GscPropertyCandidate>(targetDomain: string, properties: readonly T[]): {
|
|
34
|
+
export declare function findBestGscProperty<T extends GscPropertyCandidate>(targetDomain: string, properties: readonly T[]): {
|
|
35
35
|
matchedSite: T | null;
|
|
36
36
|
domainProperty: T | null;
|
|
37
37
|
urlProperty: T | null;
|
|
38
38
|
};
|
|
39
|
-
declare function findExactGscProperty<T extends GscPropertyCandidate>(propertyUrl: string, properties: readonly T[]): T | null;
|
|
40
|
-
declare function formatGscPropertyCandidates(candidates: ReadonlyArray<GscPropertyCandidate | null | undefined>): string;
|
|
41
|
-
export { GscPropertyCandidate, findBestGscProperty, findExactGscProperty, formatGscPropertyCandidates, gscPropertyMatchesTarget, isVerifiedGscPermission, isVerifiedGscProperty, matchGscSite, pickBestGscProperty };
|
|
39
|
+
export declare function findExactGscProperty<T extends GscPropertyCandidate>(propertyUrl: string, properties: readonly T[]): T | null;
|
|
40
|
+
export declare function formatGscPropertyCandidates(candidates: ReadonlyArray<GscPropertyCandidate | null | undefined>): string;
|
package/dist/core/quota.d.mts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const URL_INSPECTION_EFFECTIVE_LIMIT = 1800;
|
|
2
|
-
export { URL_INSPECTION_EFFECTIVE_LIMIT };
|
|
1
|
+
export declare const URL_INSPECTION_EFFECTIVE_LIMIT = 1800;
|
package/dist/core/result.d.mts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
interface Ok<A> {
|
|
1
|
+
export interface Ok<A> {
|
|
2
2
|
readonly ok: true;
|
|
3
3
|
readonly value: A;
|
|
4
4
|
}
|
|
5
|
-
interface Err<E> {
|
|
5
|
+
export interface Err<E> {
|
|
6
6
|
readonly ok: false;
|
|
7
7
|
readonly error: E;
|
|
8
8
|
}
|
|
9
|
-
type Result<A, E> = Ok<A> | Err<E>;
|
|
10
|
-
declare function ok<A>(value: A): Ok<A>;
|
|
11
|
-
declare function err<E>(error: E): Err<E>;
|
|
12
|
-
declare function isOk<A, E>(result: Result<A, E>): result is Ok<A>;
|
|
13
|
-
declare function isErr<A, E>(result: Result<A, E>): result is Err<E>;
|
|
9
|
+
export type Result<A, E> = Ok<A> | Err<E>;
|
|
10
|
+
export declare function ok<A>(value: A): Ok<A>;
|
|
11
|
+
export declare function err<E>(error: E): Err<E>;
|
|
12
|
+
export declare function isOk<A, E>(result: Result<A, E>): result is Ok<A>;
|
|
13
|
+
export declare function isErr<A, E>(result: Result<A, E>): result is Err<E>;
|
|
14
14
|
/**
|
|
15
15
|
* Collapses a `Result` back into the throwing world: returns the value or throws
|
|
16
16
|
* via `toError`. Used by the throwing wrappers that sit over the `Result` core so
|
|
17
17
|
* existing call sites keep their `await`/`throw` ergonomics.
|
|
18
18
|
*/
|
|
19
|
-
declare function unwrapResult<A, E>(result: Result<A, E>, toError: (error: E) => unknown): A;
|
|
20
|
-
export { Err, Ok, Result, err, isErr, isOk, ok, unwrapResult };
|
|
19
|
+
export declare function unwrapResult<A, E>(result: Result<A, E>, toError: (error: E) => unknown): A;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
type GoogleScopesInput = string | readonly string[] | null | undefined;
|
|
2
|
-
declare const GSC_READ_SCOPE: "https://www.googleapis.com/auth/webmasters.readonly";
|
|
3
|
-
declare const GSC_WRITE_SCOPE: "https://www.googleapis.com/auth/webmasters";
|
|
4
|
-
declare const GSC_INDEXING_SCOPE: "https://www.googleapis.com/auth/indexing";
|
|
5
|
-
declare const GSC_SITE_VERIFICATION_SCOPE: "https://www.googleapis.com/auth/siteverification";
|
|
6
|
-
declare function hasGoogleScope(scopes: GoogleScopesInput, scope: string): boolean;
|
|
7
|
-
export { GSC_INDEXING_SCOPE, GSC_READ_SCOPE, GSC_SITE_VERIFICATION_SCOPE, GSC_WRITE_SCOPE, hasGoogleScope };
|
|
2
|
+
export declare const GSC_READ_SCOPE: "https://www.googleapis.com/auth/webmasters.readonly";
|
|
3
|
+
export declare const GSC_WRITE_SCOPE: "https://www.googleapis.com/auth/webmasters";
|
|
4
|
+
export declare const GSC_INDEXING_SCOPE: "https://www.googleapis.com/auth/indexing";
|
|
5
|
+
export declare const GSC_SITE_VERIFICATION_SCOPE: "https://www.googleapis.com/auth/siteverification";
|
|
6
|
+
export declare function hasGoogleScope(scopes: GoogleScopesInput, scope: string): boolean;
|
package/dist/core/scopes.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
type GoogleScopesInput = string | readonly string[] | null | undefined;
|
|
2
|
-
declare function hasGscReadScope(scopes: GoogleScopesInput): boolean;
|
|
3
|
-
declare function hasGscWriteScope(scopes: GoogleScopesInput): boolean;
|
|
4
|
-
declare function hasIndexingScope(scopes: GoogleScopesInput): boolean;
|
|
5
|
-
export { hasGscReadScope, hasGscWriteScope, hasIndexingScope };
|
|
2
|
+
export declare function hasGscReadScope(scopes: GoogleScopesInput): boolean;
|
|
3
|
+
export declare function hasGscWriteScope(scopes: GoogleScopesInput): boolean;
|
|
4
|
+
export declare function hasIndexingScope(scopes: GoogleScopesInput): boolean;
|
package/dist/core/site-url.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface ParsedGscSiteUrl {
|
|
1
|
+
export interface ParsedGscSiteUrl {
|
|
2
2
|
/** Original, canonical GSC property URL. */
|
|
3
3
|
label: string;
|
|
4
4
|
/** Bare hostname, stripped of protocol / sc-domain prefix / path. */
|
|
@@ -8,7 +8,7 @@ interface ParsedGscSiteUrl {
|
|
|
8
8
|
propertyType: 'domain' | 'url-prefix';
|
|
9
9
|
isDomain: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare function parseGscSiteUrl(siteUrl: string): ParsedGscSiteUrl;
|
|
11
|
+
export declare function parseGscSiteUrl(siteUrl: string): ParsedGscSiteUrl;
|
|
12
12
|
/**
|
|
13
13
|
* Comparison-canonical form of a GSC property URL. Strips `sc-domain:`,
|
|
14
14
|
* protocol, leading `www.`, trailing slash, and lowercases. Use when matching
|
|
@@ -16,10 +16,9 @@ declare function parseGscSiteUrl(siteUrl: string): ParsedGscSiteUrl;
|
|
|
16
16
|
* `sc-domain:example.com` vs bare hostnames — properties Google sometimes
|
|
17
17
|
* returns in different shapes for the same site.
|
|
18
18
|
*/
|
|
19
|
-
declare function normalizeGscSiteUrl(siteUrl: string): string;
|
|
19
|
+
export declare function normalizeGscSiteUrl(siteUrl: string): string;
|
|
20
20
|
/**
|
|
21
21
|
* Normalize a user-input URL/hostname into a canonical registration target.
|
|
22
22
|
* Returns lowercase hostname stripped of protocol, or null if unparseable.
|
|
23
23
|
*/
|
|
24
|
-
declare function normalizeRegistrationTarget(inputUrl: string): string | null;
|
|
25
|
-
export { ParsedGscSiteUrl, normalizeGscSiteUrl, normalizeRegistrationTarget, parseGscSiteUrl };
|
|
24
|
+
export declare function normalizeRegistrationTarget(inputUrl: string): string | null;
|
package/dist/core/types.d.mts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/** Search Console property returned by the Sites resource. */
|
|
2
|
-
interface ApiSite {
|
|
2
|
+
export interface ApiSite {
|
|
3
3
|
permissionLevel?: string | null;
|
|
4
4
|
siteUrl?: string | null;
|
|
5
5
|
}
|
|
6
6
|
/** Per-content-type counts returned with a sitemap. */
|
|
7
|
-
interface ApiSitemapContent {
|
|
7
|
+
export interface ApiSitemapContent {
|
|
8
8
|
/** @deprecated Google can still include this field on the wire. */
|
|
9
9
|
indexed?: string | null;
|
|
10
10
|
submitted?: string | null;
|
|
11
11
|
type?: string | null;
|
|
12
12
|
}
|
|
13
13
|
/** Sitemap returned by the Search Console Sitemaps resource. */
|
|
14
|
-
interface ApiSitemap {
|
|
14
|
+
export interface ApiSitemap {
|
|
15
15
|
contents?: ApiSitemapContent[];
|
|
16
16
|
errors?: string | null;
|
|
17
17
|
isPending?: boolean | null;
|
|
@@ -23,18 +23,18 @@ interface ApiSitemap {
|
|
|
23
23
|
warnings?: string | null;
|
|
24
24
|
}
|
|
25
25
|
/** A Search Analytics dimension filter. */
|
|
26
|
-
interface DimensionFilter {
|
|
26
|
+
export interface DimensionFilter {
|
|
27
27
|
dimension?: string | null;
|
|
28
28
|
expression?: string | null;
|
|
29
29
|
operator?: string | null;
|
|
30
30
|
}
|
|
31
31
|
/** A group of Search Analytics dimension filters. */
|
|
32
|
-
interface DimensionFilterGroup {
|
|
32
|
+
export interface DimensionFilterGroup {
|
|
33
33
|
filters?: DimensionFilter[];
|
|
34
34
|
groupType?: string | null;
|
|
35
35
|
}
|
|
36
36
|
/** Raw Search Analytics request accepted by Google's REST endpoint. */
|
|
37
|
-
interface SearchAnalyticsQuery {
|
|
37
|
+
export interface SearchAnalyticsQuery {
|
|
38
38
|
aggregationType?: string | null;
|
|
39
39
|
dataState?: string | null;
|
|
40
40
|
dimensionFilterGroups?: DimensionFilterGroup[];
|
|
@@ -47,7 +47,7 @@ interface SearchAnalyticsQuery {
|
|
|
47
47
|
type?: string | null;
|
|
48
48
|
}
|
|
49
49
|
/** Raw Search Analytics result row. */
|
|
50
|
-
interface DataRow {
|
|
50
|
+
export interface DataRow {
|
|
51
51
|
clicks?: number | null;
|
|
52
52
|
ctr?: number | null;
|
|
53
53
|
impressions?: number | null;
|
|
@@ -55,21 +55,21 @@ interface DataRow {
|
|
|
55
55
|
position?: number | null;
|
|
56
56
|
}
|
|
57
57
|
/** Completeness metadata returned with recent Search Analytics data. */
|
|
58
|
-
interface SearchAnalyticsMetadata {
|
|
58
|
+
export interface SearchAnalyticsMetadata {
|
|
59
59
|
first_incomplete_date?: string;
|
|
60
60
|
first_incomplete_hour?: string;
|
|
61
61
|
}
|
|
62
62
|
/** Raw Search Analytics response returned by Google's REST endpoint. */
|
|
63
|
-
interface SearchAnalyticsResponse {
|
|
63
|
+
export interface SearchAnalyticsResponse {
|
|
64
64
|
metadata?: SearchAnalyticsMetadata;
|
|
65
65
|
responseAggregationType?: string | null;
|
|
66
66
|
rows?: DataRow[];
|
|
67
67
|
}
|
|
68
|
-
interface AmpIssue {
|
|
68
|
+
export interface AmpIssue {
|
|
69
69
|
issueMessage?: string | null;
|
|
70
70
|
severity?: string | null;
|
|
71
71
|
}
|
|
72
|
-
interface AmpInspectionResult {
|
|
72
|
+
export interface AmpInspectionResult {
|
|
73
73
|
ampIndexStatusVerdict?: string | null;
|
|
74
74
|
ampUrl?: string | null;
|
|
75
75
|
indexingState?: string | null;
|
|
@@ -79,7 +79,7 @@ interface AmpInspectionResult {
|
|
|
79
79
|
robotsTxtState?: string | null;
|
|
80
80
|
verdict?: string | null;
|
|
81
81
|
}
|
|
82
|
-
interface IndexStatusResult {
|
|
82
|
+
export interface IndexStatusResult {
|
|
83
83
|
coverageState?: string | null;
|
|
84
84
|
crawledAs?: string | null;
|
|
85
85
|
googleCanonical?: string | null;
|
|
@@ -92,33 +92,33 @@ interface IndexStatusResult {
|
|
|
92
92
|
userCanonical?: string | null;
|
|
93
93
|
verdict?: string | null;
|
|
94
94
|
}
|
|
95
|
-
interface MobileUsabilityIssue {
|
|
95
|
+
export interface MobileUsabilityIssue {
|
|
96
96
|
issueType?: string | null;
|
|
97
97
|
message?: string | null;
|
|
98
98
|
severity?: string | null;
|
|
99
99
|
}
|
|
100
|
-
interface MobileUsabilityResult {
|
|
100
|
+
export interface MobileUsabilityResult {
|
|
101
101
|
issues?: MobileUsabilityIssue[];
|
|
102
102
|
verdict?: string | null;
|
|
103
103
|
}
|
|
104
|
-
interface RichResultsIssue {
|
|
104
|
+
export interface RichResultsIssue {
|
|
105
105
|
issueMessage?: string | null;
|
|
106
106
|
severity?: string | null;
|
|
107
107
|
}
|
|
108
|
-
interface RichResultsItem {
|
|
108
|
+
export interface RichResultsItem {
|
|
109
109
|
issues?: RichResultsIssue[];
|
|
110
110
|
name?: string | null;
|
|
111
111
|
}
|
|
112
|
-
interface RichResultsDetectedItem {
|
|
112
|
+
export interface RichResultsDetectedItem {
|
|
113
113
|
items?: RichResultsItem[];
|
|
114
114
|
richResultType?: string | null;
|
|
115
115
|
}
|
|
116
|
-
interface RichResultsResult {
|
|
116
|
+
export interface RichResultsResult {
|
|
117
117
|
detectedItems?: RichResultsDetectedItem[];
|
|
118
118
|
verdict?: string | null;
|
|
119
119
|
}
|
|
120
120
|
/** URL inspection payload returned by Search Console. */
|
|
121
|
-
interface UrlInspectionResult {
|
|
121
|
+
export interface UrlInspectionResult {
|
|
122
122
|
ampResult?: AmpInspectionResult;
|
|
123
123
|
indexStatusResult?: IndexStatusResult;
|
|
124
124
|
inspectionResultLink?: string | null;
|
|
@@ -126,37 +126,37 @@ interface UrlInspectionResult {
|
|
|
126
126
|
mobileUsabilityResult?: MobileUsabilityResult;
|
|
127
127
|
richResultsResult?: RichResultsResult;
|
|
128
128
|
}
|
|
129
|
-
interface InspectUrlIndexResponse {
|
|
129
|
+
export interface InspectUrlIndexResponse {
|
|
130
130
|
inspectionResult?: UrlInspectionResult;
|
|
131
131
|
}
|
|
132
132
|
/** A single Indexing API notification. */
|
|
133
|
-
interface UrlNotification {
|
|
133
|
+
export interface UrlNotification {
|
|
134
134
|
notifyTime?: string | null;
|
|
135
135
|
type?: string | null;
|
|
136
136
|
url?: string | null;
|
|
137
137
|
}
|
|
138
138
|
/** Latest Indexing API notifications recorded for a URL. */
|
|
139
|
-
interface UrlNotificationMetadata {
|
|
139
|
+
export interface UrlNotificationMetadata {
|
|
140
140
|
latestRemove?: UrlNotification;
|
|
141
141
|
latestUpdate?: UrlNotification;
|
|
142
142
|
url?: string | null;
|
|
143
143
|
}
|
|
144
|
-
interface PublishUrlNotificationResponse {
|
|
144
|
+
export interface PublishUrlNotificationResponse {
|
|
145
145
|
urlNotificationMetadata?: UrlNotificationMetadata;
|
|
146
146
|
}
|
|
147
|
-
type RequiredNonNullable<T> = Required<Exclude<T, null | undefined>>;
|
|
148
|
-
interface Site extends Required<Omit<ApiSite, 'siteUrl'>> {
|
|
147
|
+
export type RequiredNonNullable<T> = Required<Exclude<T, null | undefined>>;
|
|
148
|
+
export interface Site extends Required<Omit<ApiSite, 'siteUrl'>> {
|
|
149
149
|
siteUrl: string;
|
|
150
150
|
}
|
|
151
|
-
interface Period {
|
|
151
|
+
export interface Period {
|
|
152
152
|
start: Date | string;
|
|
153
153
|
end: Date | string;
|
|
154
154
|
}
|
|
155
|
-
interface ResolvedAnalyticsRange {
|
|
155
|
+
export interface ResolvedAnalyticsRange {
|
|
156
156
|
period: Period;
|
|
157
157
|
prevPeriod?: Period;
|
|
158
158
|
}
|
|
159
|
-
interface SiteAnalytics {
|
|
159
|
+
export interface SiteAnalytics {
|
|
160
160
|
analytics: {
|
|
161
161
|
period: {
|
|
162
162
|
totalClicks: number;
|
|
@@ -194,5 +194,4 @@ interface SiteAnalytics {
|
|
|
194
194
|
clicks: number;
|
|
195
195
|
impressions: number;
|
|
196
196
|
}[];
|
|
197
|
-
}
|
|
198
|
-
export { AmpInspectionResult, AmpIssue, ApiSite, ApiSitemap, ApiSitemapContent, DataRow, DimensionFilter, DimensionFilterGroup, IndexStatusResult, InspectUrlIndexResponse, MobileUsabilityIssue, MobileUsabilityResult, Period, PublishUrlNotificationResponse, RequiredNonNullable, ResolvedAnalyticsRange, RichResultsDetectedItem, RichResultsIssue, RichResultsItem, RichResultsResult, SearchAnalyticsMetadata, SearchAnalyticsQuery, SearchAnalyticsResponse, Site, SiteAnalytics, UrlInspectionResult, UrlNotification, UrlNotificationMetadata };
|
|
197
|
+
}
|
package/dist/core/window.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
type WindowPreset = 'last-7d' | 'last-28d' | 'last-30d' | 'last-90d' | 'last-180d' | 'last-365d' | 'mtd' | 'ytd' | 'custom';
|
|
2
|
-
type ComparisonMode = 'none' | 'prev-period' | 'yoy';
|
|
3
|
-
interface ResolveWindowOptions {
|
|
1
|
+
export type WindowPreset = 'last-7d' | 'last-28d' | 'last-30d' | 'last-90d' | 'last-180d' | 'last-365d' | 'mtd' | 'ytd' | 'custom';
|
|
2
|
+
export type ComparisonMode = 'none' | 'prev-period' | 'yoy';
|
|
3
|
+
export interface ResolveWindowOptions {
|
|
4
4
|
preset: WindowPreset;
|
|
5
5
|
comparison?: ComparisonMode;
|
|
6
6
|
anchor?: string;
|
|
7
7
|
start?: string;
|
|
8
8
|
end?: string;
|
|
9
9
|
}
|
|
10
|
-
interface ResolvedWindow {
|
|
10
|
+
export interface ResolvedWindow {
|
|
11
11
|
start: string;
|
|
12
12
|
end: string;
|
|
13
13
|
days: number;
|
|
@@ -16,5 +16,4 @@ interface ResolvedWindow {
|
|
|
16
16
|
end: string;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
declare function resolveWindow(opts: ResolveWindowOptions): ResolvedWindow;
|
|
20
|
-
export { ComparisonMode, ResolveWindowOptions, ResolvedWindow, WindowPreset, resolveWindow };
|
|
19
|
+
export declare function resolveWindow(opts: ResolveWindowOptions): ResolvedWindow;
|
package/dist/normalize.d.mts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function normalizeUrl(input: string): string;
|
|
2
|
-
export { normalizeUrl };
|
|
1
|
+
export declare function normalizeUrl(input: string): string;
|
package/dist/query/builder.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { GscAggregationType, GscDataState, GscSearchAnalyticsRequest, GscSearchType } from "../contracts.mjs";
|
|
2
2
|
import { BuilderState, Column, Dimension, Filter, Metric, MetricColumn } from "./types.mjs";
|
|
3
|
-
type SelectableColumn = Column<Dimension> | MetricColumn<Metric>;
|
|
4
|
-
type OrderableColumn = MetricColumn<Metric> | Column<'date'>;
|
|
3
|
+
export type SelectableColumn = Column<Dimension> | MetricColumn<Metric>;
|
|
4
|
+
export type OrderableColumn = MetricColumn<Metric> | Column<'date'>;
|
|
5
5
|
type ExtractDimensions<T extends SelectableColumn[]> = { [K in keyof T]: T[K] extends Column<infer D> ? D : never; }[number] extends (infer U) ? Exclude<U, never>[] : never;
|
|
6
|
-
interface GSCQueryBuilder<D extends Dimension[] = [], C = object> {
|
|
6
|
+
export interface GSCQueryBuilder<D extends Dimension[] = [], C = object> {
|
|
7
7
|
select: {
|
|
8
8
|
<T extends Dimension[]>(...dims: T): GSCQueryBuilder<T, C>;
|
|
9
9
|
<T extends SelectableColumn[]>(...cols: T): GSCQueryBuilder<ExtractDimensions<T> & Dimension[], C>;
|
|
@@ -20,5 +20,4 @@ interface GSCQueryBuilder<D extends Dimension[] = [], C = object> {
|
|
|
20
20
|
toBody: () => GscSearchAnalyticsRequest;
|
|
21
21
|
getState: () => BuilderState;
|
|
22
22
|
}
|
|
23
|
-
declare const gsc: GSCQueryBuilder<[], object>;
|
|
24
|
-
export { GSCQueryBuilder, OrderableColumn, SelectableColumn, gsc };
|
|
23
|
+
export declare const gsc: GSCQueryBuilder<[], object>;
|
package/dist/query/columns.d.mts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { Column, MetricColumn, QueryParam } from "./types.mjs";
|
|
2
|
-
declare const page: Column<"page">;
|
|
3
|
-
declare const query: Column<"query">;
|
|
4
|
-
declare const queryCanonical: Column<"queryCanonical">;
|
|
5
|
-
declare const device: Column<"device">;
|
|
6
|
-
declare const country: Column<"country">;
|
|
7
|
-
declare const searchAppearance: Column<"searchAppearance">;
|
|
8
|
-
declare const date: Column<"date">;
|
|
9
|
-
declare const hour: Column<"hour">;
|
|
10
|
-
declare const clicks: MetricColumn<"clicks">;
|
|
11
|
-
declare const impressions: MetricColumn<"impressions">;
|
|
12
|
-
declare const ctr: MetricColumn<"ctr">;
|
|
13
|
-
declare const position: MetricColumn<"position">;
|
|
14
|
-
declare const searchType: QueryParam<"searchType">;
|
|
15
|
-
export { clicks, country, ctr, date, device, hour, impressions, page, position, query, queryCanonical, searchAppearance, searchType };
|
|
2
|
+
export declare const page: Column<"page">;
|
|
3
|
+
export declare const query: Column<"query">;
|
|
4
|
+
export declare const queryCanonical: Column<"queryCanonical">;
|
|
5
|
+
export declare const device: Column<"device">;
|
|
6
|
+
export declare const country: Column<"country">;
|
|
7
|
+
export declare const searchAppearance: Column<"searchAppearance">;
|
|
8
|
+
export declare const date: Column<"date">;
|
|
9
|
+
export declare const hour: Column<"hour">;
|
|
10
|
+
export declare const clicks: MetricColumn<"clicks">;
|
|
11
|
+
export declare const impressions: MetricColumn<"impressions">;
|
|
12
|
+
export declare const ctr: MetricColumn<"ctr">;
|
|
13
|
+
export declare const position: MetricColumn<"position">;
|
|
14
|
+
export declare const searchType: QueryParam<"searchType">;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _default from "./utils/countries.mjs";
|
|
2
2
|
import { GSC_SEARCH_TYPES as SearchTypes, GscSearchType as SearchType } from "@gscdump/contracts/search-types";
|
|
3
|
-
declare const Devices: {
|
|
3
|
+
export declare const Devices: {
|
|
4
4
|
readonly MOBILE: "MOBILE";
|
|
5
5
|
readonly DESKTOP: "DESKTOP";
|
|
6
6
|
readonly TABLET: "TABLET";
|
|
7
7
|
};
|
|
8
|
-
type Device = typeof Devices[keyof typeof Devices];
|
|
9
|
-
declare const Countries: { [K in (typeof _default)[number]["alpha-3"]]: Lowercase<K>; };
|
|
10
|
-
type Country = typeof Countries[keyof typeof Countries];
|
|
11
|
-
export {
|
|
8
|
+
export type Device = typeof Devices[keyof typeof Devices];
|
|
9
|
+
export declare const Countries: { [K in (typeof _default)[number]["alpha-3"]]: Lowercase<K>; };
|
|
10
|
+
export type Country = typeof Countries[keyof typeof Countries];
|
|
11
|
+
export { type SearchType, SearchTypes };
|
package/dist/query/errors.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dimension } from "./types.mjs";
|
|
2
|
-
type QueryErrorKind = 'missing-date-range' | 'invalid-row-limit' | 'invalid-start-row' | 'invalid-data-state' | 'invalid-aggregation-type' | 'invalid-builder-state' | 'invalid-filter' | 'unsupported-capability' | 'unresolvable-dataset';
|
|
3
|
-
type QueryError = {
|
|
2
|
+
export type QueryErrorKind = 'missing-date-range' | 'invalid-row-limit' | 'invalid-start-row' | 'invalid-data-state' | 'invalid-aggregation-type' | 'invalid-builder-state' | 'invalid-filter' | 'unsupported-capability' | 'unresolvable-dataset';
|
|
3
|
+
export type QueryError = {
|
|
4
4
|
kind: 'missing-date-range';
|
|
5
5
|
message: string;
|
|
6
6
|
} | {
|
|
@@ -35,7 +35,7 @@ type QueryError = {
|
|
|
35
35
|
filterDims: readonly Dimension[];
|
|
36
36
|
message: string;
|
|
37
37
|
};
|
|
38
|
-
declare const queryErrors: {
|
|
38
|
+
export declare const queryErrors: {
|
|
39
39
|
readonly missingDateRange: () => QueryError;
|
|
40
40
|
readonly invalidRowLimit: (value: unknown) => QueryError;
|
|
41
41
|
readonly invalidStartRow: (value: unknown) => QueryError;
|
|
@@ -51,14 +51,14 @@ declare const queryErrors: {
|
|
|
51
51
|
readonly unsupportedCapability: (capability: string, context: string) => QueryError;
|
|
52
52
|
readonly unresolvableDataset: (dimensions: readonly Dimension[], filterDims?: readonly Dimension[]) => QueryError;
|
|
53
53
|
};
|
|
54
|
-
declare function isQueryError(value: unknown): value is QueryError;
|
|
54
|
+
export declare function isQueryError(value: unknown): value is QueryError;
|
|
55
55
|
/**
|
|
56
56
|
* Thrown when a query needs a planner capability (regex pushdown, comparison
|
|
57
57
|
* joins, multi-dataset reads) the target engine lacks. Engines catch it to fall
|
|
58
58
|
* back to the live GSC API. Carries the typed `queryError` value so a caller can
|
|
59
59
|
* read the modelled failure instead of parsing the message.
|
|
60
60
|
*/
|
|
61
|
-
declare class UnsupportedLogicalCapabilityError extends Error {
|
|
61
|
+
export declare class UnsupportedLogicalCapabilityError extends Error {
|
|
62
62
|
readonly queryError: Extract<QueryError, {
|
|
63
63
|
kind: 'unsupported-capability';
|
|
64
64
|
}>;
|
|
@@ -69,7 +69,7 @@ declare class UnsupportedLogicalCapabilityError extends Error {
|
|
|
69
69
|
* dataset. Replaces the resolver's raw "unknown column" error so hosts can map
|
|
70
70
|
* it to a 4xx instead of leaking an opaque 500. Carries the typed `queryError`.
|
|
71
71
|
*/
|
|
72
|
-
declare class UnresolvableDatasetError extends Error {
|
|
72
|
+
export declare class UnresolvableDatasetError extends Error {
|
|
73
73
|
readonly queryError: Extract<QueryError, {
|
|
74
74
|
kind: 'unresolvable-dataset';
|
|
75
75
|
}>;
|
|
@@ -81,5 +81,4 @@ declare class UnresolvableDatasetError extends Error {
|
|
|
81
81
|
* `UnsupportedLogicalCapabilityError`). Pairs with `unwrapResult` so a
|
|
82
82
|
* `fooResult(): Result<A, QueryError>` core can back a throwing `foo()`.
|
|
83
83
|
*/
|
|
84
|
-
declare function queryErrorToException(error: QueryError): Error;
|
|
85
|
-
export { QueryError, QueryErrorKind, UnresolvableDatasetError, UnsupportedLogicalCapabilityError, isQueryError, queryErrorToException, queryErrors };
|
|
84
|
+
export declare function queryErrorToException(error: QueryError): Error;
|
package/dist/query/errors.mjs
CHANGED
|
@@ -72,7 +72,7 @@ const queryErrors = {
|
|
|
72
72
|
malformedFilterLeaf() {
|
|
73
73
|
return {
|
|
74
74
|
kind: "invalid-filter",
|
|
75
|
-
message: "
|
|
75
|
+
message: "Invalid filter. Check group structure, dimension and operator names, and string expression values."
|
|
76
76
|
};
|
|
77
77
|
},
|
|
78
78
|
unsupportedCapability(capability, context) {
|
package/dist/query/index.d.mts
CHANGED
|
@@ -7,6 +7,6 @@ import { QueryError, QueryErrorKind, UnresolvableDatasetError, UnsupportedLogica
|
|
|
7
7
|
import { and, between, contains, eq, gt, gte, inArray, like, lt, lte, ne, not, notRegex, or, regex, topLevel } from "./operators.mjs";
|
|
8
8
|
import { ComparisonFilter, LogicalComparisonPlan, LogicalDataset, LogicalDimensionFilter, LogicalMetricFilter, LogicalQueryPlan, PlannerCapabilities, buildLogicalComparisonPlan, buildLogicalComparisonPlanResult, buildLogicalPlan, buildLogicalPlanResult } from "./plan.mjs";
|
|
9
9
|
import { extractDateRange, extractMetricFilters, extractSearchType, extractSpecialOperatorFilters, normalizeBuilderState, normalizeBuilderStateResult, normalizeFilter, resolveToBody, resolveToBodyResult } from "./resolver.mjs";
|
|
10
|
-
declare function today(): string;
|
|
11
|
-
declare function daysAgo(n: number): string;
|
|
12
|
-
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, QueryError, QueryErrorKind, type QueryParam, type QueryParamName, type QueryParamValueMap, type SearchType, SearchTypes, UnresolvableDatasetError, UnsupportedLogicalCapabilityError, and, between, buildLogicalComparisonPlan, buildLogicalComparisonPlanResult, buildLogicalPlan, buildLogicalPlanResult, clicks, contains, country, ctr, currentPstDate, date,
|
|
10
|
+
export declare function today(): string;
|
|
11
|
+
export declare function daysAgo(n: number): string;
|
|
12
|
+
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, QueryError, QueryErrorKind, type QueryParam, type QueryParamName, type QueryParamValueMap, type SearchType, SearchTypes, UnresolvableDatasetError, UnsupportedLogicalCapabilityError, and, between, buildLogicalComparisonPlan, buildLogicalComparisonPlanResult, buildLogicalPlan, buildLogicalPlanResult, clicks, contains, country, ctr, currentPstDate, date, device, eq, extractDateRange, extractMetricFilters, extractSearchType, extractSpecialOperatorFilters, gsc, gt, gte, hour, impressions, inArray, isQueryError, like, lt, lte, ne, normalizeBuilderState, normalizeBuilderStateResult, normalizeFilter, not, notRegex, or, page, position, query, queryCanonical, queryErrorToException, queryErrors, regex, resolveToBody, resolveToBodyResult, searchAppearance, searchType, topLevel };
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { Column, Dimension, DimensionValueMap, Filter, MergeConstraints, Metric, MetricColumn, QueryParam, QueryParamName, QueryParamValueMap } from "./types.mjs";
|
|
2
|
-
declare function eq<D extends Dimension, V extends DimensionValueMap[D]>(column: Column<D>, value: V): Filter<Record<D, V>>;
|
|
3
|
-
declare function eq<P extends QueryParamName, V extends QueryParamValueMap[P]>(param: QueryParam<P>, value: V): Filter<Record<P, V>>;
|
|
4
|
-
declare function ne<D extends Dimension>(column: Column<D>, value: DimensionValueMap[D]): Filter<object>;
|
|
5
|
-
declare function inArray<D extends Dimension, V extends DimensionValueMap[D]>(column: Column<D>, values: readonly V[]): Filter<Record<D, V>>;
|
|
6
|
-
declare function contains<D extends Dimension>(column: Column<D>, pattern: string): Filter<object>;
|
|
7
|
-
declare function like<D extends Dimension>(column: Column<D>, pattern: string): Filter<object>;
|
|
8
|
-
declare function regex<D extends Dimension>(column: Column<D>, pattern: RegExp | string): Filter<object>;
|
|
9
|
-
declare function notRegex<D extends Dimension>(column: Column<D>, pattern: RegExp | string): Filter<object>;
|
|
10
|
-
declare function and<F extends Filter<any>[]>(...filters: F): Filter<MergeConstraints<F>>;
|
|
11
|
-
declare function or<F extends Filter<any>[]>(...filters: F): Filter<object>;
|
|
12
|
-
declare function not<F extends Filter<any>>(filter: F): Filter<object>;
|
|
13
|
-
declare function gte<M extends Metric>(column: MetricColumn<M>, value: number): Filter<object>;
|
|
14
|
-
declare function gte(column: Column<'date'>, value: string): Filter<object>;
|
|
15
|
-
declare function gt<M extends Metric>(column: MetricColumn<M>, value: number): Filter<object>;
|
|
16
|
-
declare function gt(column: Column<'date'>, value: string): Filter<object>;
|
|
17
|
-
declare function lte<M extends Metric>(column: MetricColumn<M>, value: number): Filter<object>;
|
|
18
|
-
declare function lte(column: Column<'date'>, value: string): Filter<object>;
|
|
19
|
-
declare function lt<M extends Metric>(column: MetricColumn<M>, value: number): Filter<object>;
|
|
20
|
-
declare function lt(column: Column<'date'>, value: string): Filter<object>;
|
|
21
|
-
declare function between<M extends Metric>(column: MetricColumn<M>, start: number, end: number): Filter<object>;
|
|
22
|
-
declare function between(column: Column<'date'>, start: string, end: string): Filter<object>;
|
|
23
|
-
declare function topLevel(column: Column<'page'>): Filter<object>;
|
|
24
|
-
export { and, between, contains, eq, gt, gte, inArray, like, lt, lte, ne, not, notRegex, or, regex, topLevel };
|
|
2
|
+
export declare function eq<D extends Dimension, V extends DimensionValueMap[D]>(column: Column<D>, value: V): Filter<Record<D, V>>;
|
|
3
|
+
export declare function eq<P extends QueryParamName, V extends QueryParamValueMap[P]>(param: QueryParam<P>, value: V): Filter<Record<P, V>>;
|
|
4
|
+
export declare function ne<D extends Dimension>(column: Column<D>, value: DimensionValueMap[D]): Filter<object>;
|
|
5
|
+
export declare function inArray<D extends Dimension, V extends DimensionValueMap[D]>(column: Column<D>, values: readonly V[]): Filter<Record<D, V>>;
|
|
6
|
+
export declare function contains<D extends Dimension>(column: Column<D>, pattern: string): Filter<object>;
|
|
7
|
+
export declare function like<D extends Dimension>(column: Column<D>, pattern: string): Filter<object>;
|
|
8
|
+
export declare function regex<D extends Dimension>(column: Column<D>, pattern: RegExp | string): Filter<object>;
|
|
9
|
+
export declare function notRegex<D extends Dimension>(column: Column<D>, pattern: RegExp | string): Filter<object>;
|
|
10
|
+
export declare function and<F extends Filter<any>[]>(...filters: F): Filter<MergeConstraints<F>>;
|
|
11
|
+
export declare function or<F extends Filter<any>[]>(...filters: F): Filter<object>;
|
|
12
|
+
export declare function not<F extends Filter<any>>(filter: F): Filter<object>;
|
|
13
|
+
export declare function gte<M extends Metric>(column: MetricColumn<M>, value: number): Filter<object>;
|
|
14
|
+
export declare function gte(column: Column<'date'>, value: string): Filter<object>;
|
|
15
|
+
export declare function gt<M extends Metric>(column: MetricColumn<M>, value: number): Filter<object>;
|
|
16
|
+
export declare function gt(column: Column<'date'>, value: string): Filter<object>;
|
|
17
|
+
export declare function lte<M extends Metric>(column: MetricColumn<M>, value: number): Filter<object>;
|
|
18
|
+
export declare function lte(column: Column<'date'>, value: string): Filter<object>;
|
|
19
|
+
export declare function lt<M extends Metric>(column: MetricColumn<M>, value: number): Filter<object>;
|
|
20
|
+
export declare function lt(column: Column<'date'>, value: string): Filter<object>;
|
|
21
|
+
export declare function between<M extends Metric>(column: MetricColumn<M>, start: number, end: number): Filter<object>;
|
|
22
|
+
export declare function between(column: Column<'date'>, start: string, end: string): Filter<object>;
|
|
23
|
+
export declare function topLevel(column: Column<'page'>): Filter<object>;
|