gscdump 1.3.2 → 1.4.1
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/api/batch.d.mts +12 -0
- package/dist/api/batch.mjs +29 -0
- package/dist/api/indexing.d.mts +37 -0
- package/dist/api/indexing.mjs +25 -0
- package/dist/api/inspection.d.mts +89 -0
- package/dist/api/inspection.mjs +128 -0
- package/dist/api/oauth.d.mts +48 -0
- package/dist/api/oauth.mjs +154 -0
- package/dist/api/sites.d.mts +45 -0
- package/dist/api/sites.mjs +34 -0
- package/dist/api/verification.d.mts +43 -0
- package/dist/api/verification.mjs +89 -0
- package/dist/contracts.d.mts +46 -1
- package/dist/core/cli-format.mjs +9 -0
- package/dist/core/client.d.mts +122 -0
- package/dist/core/client.mjs +246 -0
- package/dist/core/errors.d.mts +66 -0
- package/dist/core/errors.mjs +207 -0
- package/dist/core/indexing-issues.d.mts +60 -0
- package/dist/core/indexing-issues.mjs +139 -0
- package/dist/core/property.d.mts +41 -0
- package/dist/core/property.mjs +74 -0
- package/dist/core/quota.d.mts +2 -0
- package/dist/core/quota.mjs +2 -0
- package/dist/core/result.d.mts +19 -1
- package/dist/core/scope-values.d.mts +7 -0
- package/dist/core/scope-values.mjs +15 -0
- package/dist/core/scopes.d.mts +5 -0
- package/dist/core/scopes.mjs +11 -0
- package/dist/core/site-url.d.mts +25 -0
- package/dist/core/site-url.mjs +30 -0
- package/dist/core/types.d.mts +201 -0
- package/dist/core/types.mjs +1 -0
- package/dist/dates.d.mts +2 -2
- package/dist/dates.mjs +2 -2
- package/dist/index.d.mts +20 -814
- package/dist/index.mjs +19 -1243
- package/dist/onboarding.d.mts +2 -0
- package/dist/onboarding.mjs +2 -0
- package/dist/{_chunks → query}/builder.d.mts +2 -2
- package/dist/query/builder.mjs +86 -0
- package/dist/query/columns.d.mts +15 -0
- package/dist/query/columns.mjs +23 -0
- package/dist/query/constants.d.mts +19 -0
- package/dist/query/constants.mjs +16 -0
- package/dist/query/errors.d.mts +85 -0
- package/dist/query/errors.mjs +141 -0
- package/dist/query/index.d.mts +9 -75
- package/dist/query/index.mjs +7 -230
- package/dist/query/operator-meta.mjs +41 -0
- package/dist/query/operators.d.mts +24 -0
- package/dist/query/operators.mjs +124 -0
- package/dist/query/plan.d.mts +92 -2
- package/dist/query/plan.mjs +3 -1
- package/dist/query/resolver.d.mts +40 -0
- package/dist/query/resolver.mjs +243 -0
- package/dist/{_chunks → query}/types.d.mts +3 -25
- package/dist/query/utils/countries.d.mts +7 -0
- package/dist/{_chunks/resolver.mjs → query/utils/countries.mjs} +1 -434
- package/dist/{_chunks → query/utils}/dayjs.mjs +2 -4
- package/dist/sitemap.d.mts +26 -0
- package/dist/sitemap.mjs +70 -0
- package/dist/url.d.mts +9 -0
- package/dist/url.mjs +6 -0
- package/package.json +2 -3
- package/dist/_chunks/contracts.d.mts +0 -47
- package/dist/_chunks/plan.d.mts +0 -175
- package/dist/_chunks/result.d.mts +0 -20
- /package/dist/{_chunks → core}/gsc-dates.d.mts +0 -0
- /package/dist/{_chunks → core}/gsc-dates.mjs +0 -0
- /package/dist/{_chunks → query/utils}/dayjs.d.mts +0 -0
package/dist/_chunks/plan.d.mts
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { TableName } from "./contracts.mjs";
|
|
2
|
-
import { Result } from "./result.mjs";
|
|
3
|
-
import { BuilderState, Dimension, FilterOperator, Metric, MetricOperator, QueryParamName } from "./types.mjs";
|
|
4
|
-
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';
|
|
5
|
-
type QueryError = {
|
|
6
|
-
kind: 'missing-date-range';
|
|
7
|
-
message: string;
|
|
8
|
-
} | {
|
|
9
|
-
kind: 'invalid-row-limit';
|
|
10
|
-
value: unknown;
|
|
11
|
-
message: string;
|
|
12
|
-
} | {
|
|
13
|
-
kind: 'invalid-start-row';
|
|
14
|
-
value: unknown;
|
|
15
|
-
message: string;
|
|
16
|
-
} | {
|
|
17
|
-
kind: 'invalid-data-state';
|
|
18
|
-
message: string;
|
|
19
|
-
} | {
|
|
20
|
-
kind: 'invalid-aggregation-type';
|
|
21
|
-
message: string;
|
|
22
|
-
} | {
|
|
23
|
-
kind: 'invalid-builder-state';
|
|
24
|
-
message: string;
|
|
25
|
-
cause?: unknown;
|
|
26
|
-
} | {
|
|
27
|
-
kind: 'invalid-filter';
|
|
28
|
-
message: string;
|
|
29
|
-
} | {
|
|
30
|
-
kind: 'unsupported-capability';
|
|
31
|
-
capability: string;
|
|
32
|
-
context: string;
|
|
33
|
-
message: string;
|
|
34
|
-
} | {
|
|
35
|
-
kind: 'unresolvable-dataset';
|
|
36
|
-
dimensions: readonly Dimension[];
|
|
37
|
-
filterDims: readonly Dimension[];
|
|
38
|
-
message: string;
|
|
39
|
-
};
|
|
40
|
-
declare const queryErrors: {
|
|
41
|
-
readonly missingDateRange: () => QueryError;
|
|
42
|
-
readonly invalidRowLimit: (value: unknown) => QueryError;
|
|
43
|
-
readonly invalidStartRow: (value: unknown) => QueryError;
|
|
44
|
-
readonly hourDimensionRequiresHourlyState: () => QueryError;
|
|
45
|
-
readonly hourlyStateRequiresHourDimension: () => QueryError;
|
|
46
|
-
readonly byPropertyUnsupportedSearchType: () => QueryError;
|
|
47
|
-
readonly byPropertyNotAllowedWithPage: () => QueryError;
|
|
48
|
-
readonly byNewsShowcaseRequiresSearchType: () => QueryError;
|
|
49
|
-
readonly byNewsShowcaseNotAllowedWithPage: () => QueryError;
|
|
50
|
-
readonly byNewsShowcaseRequiresShowcaseFilter: () => QueryError;
|
|
51
|
-
readonly invalidBuilderState: (cause?: unknown) => QueryError;
|
|
52
|
-
readonly malformedFilterLeaf: () => QueryError;
|
|
53
|
-
readonly unsupportedCapability: (capability: string, context: string) => QueryError;
|
|
54
|
-
readonly unresolvableDataset: (dimensions: readonly Dimension[], filterDims?: readonly Dimension[]) => QueryError;
|
|
55
|
-
};
|
|
56
|
-
declare function isQueryError(value: unknown): value is QueryError;
|
|
57
|
-
/**
|
|
58
|
-
* Thrown when a query needs a planner capability (regex pushdown, comparison
|
|
59
|
-
* joins, multi-dataset reads) the target engine lacks. Engines catch it to fall
|
|
60
|
-
* back to the live GSC API. Carries the typed `queryError` value so a caller can
|
|
61
|
-
* read the modelled failure instead of parsing the message.
|
|
62
|
-
*/
|
|
63
|
-
declare class UnsupportedLogicalCapabilityError extends Error {
|
|
64
|
-
readonly queryError: Extract<QueryError, {
|
|
65
|
-
kind: 'unsupported-capability';
|
|
66
|
-
}>;
|
|
67
|
-
constructor(capability: string, context: string);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Thrown when a query's grouped + filtered dimensions span more than one stored
|
|
71
|
-
* dataset. Replaces the resolver's raw "unknown column" error so hosts can map
|
|
72
|
-
* it to a 4xx instead of leaking an opaque 500. Carries the typed `queryError`.
|
|
73
|
-
*/
|
|
74
|
-
declare class UnresolvableDatasetError extends Error {
|
|
75
|
-
readonly queryError: Extract<QueryError, {
|
|
76
|
-
kind: 'unresolvable-dataset';
|
|
77
|
-
}>;
|
|
78
|
-
constructor(dimensions: readonly Dimension[], filterDims?: readonly Dimension[]);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Re-raises a `QueryError` value as an `Error`, preserving the historical class
|
|
82
|
-
* identity for the two errors engines match on by name (`UnresolvableDatasetError`,
|
|
83
|
-
* `UnsupportedLogicalCapabilityError`). Pairs with `unwrapResult` so a
|
|
84
|
-
* `fooResult(): Result<A, QueryError>` core can back a throwing `foo()`.
|
|
85
|
-
*/
|
|
86
|
-
declare function queryErrorToException(error: QueryError): Error;
|
|
87
|
-
type LogicalDataset = TableName;
|
|
88
|
-
type ComparisonFilter = 'new' | 'lost' | 'improving' | 'declining';
|
|
89
|
-
interface PlannerCapabilities {
|
|
90
|
-
regex?: boolean;
|
|
91
|
-
multiDataset?: boolean;
|
|
92
|
-
comparisonJoin?: boolean;
|
|
93
|
-
windowTotals?: boolean;
|
|
94
|
-
}
|
|
95
|
-
interface LogicalDimensionFilter {
|
|
96
|
-
dimension: Dimension;
|
|
97
|
-
operator: FilterOperator;
|
|
98
|
-
expression: string;
|
|
99
|
-
expression2?: string;
|
|
100
|
-
}
|
|
101
|
-
interface LogicalMetricFilter {
|
|
102
|
-
metric: Metric;
|
|
103
|
-
operator: MetricOperator;
|
|
104
|
-
expression: number;
|
|
105
|
-
expression2?: number;
|
|
106
|
-
}
|
|
107
|
-
interface LogicalFilterLeaf {
|
|
108
|
-
kind: 'leaf';
|
|
109
|
-
filter: LogicalDimensionFilter;
|
|
110
|
-
}
|
|
111
|
-
interface LogicalFilterGroup {
|
|
112
|
-
kind: 'group';
|
|
113
|
-
groupType: 'and' | 'or';
|
|
114
|
-
children: LogicalFilterNode[];
|
|
115
|
-
}
|
|
116
|
-
type LogicalFilterNode = LogicalFilterLeaf | LogicalFilterGroup;
|
|
117
|
-
interface LogicalQueryPlan {
|
|
118
|
-
dataset: LogicalDataset;
|
|
119
|
-
dimensions: Dimension[];
|
|
120
|
-
groupByDimensions: Dimension[];
|
|
121
|
-
hasDate: boolean;
|
|
122
|
-
metrics: Metric[];
|
|
123
|
-
dateRange: {
|
|
124
|
-
startDate: string;
|
|
125
|
-
endDate: string;
|
|
126
|
-
};
|
|
127
|
-
dimensionFilters: LogicalDimensionFilter[];
|
|
128
|
-
dimensionFilterTree?: LogicalFilterNode;
|
|
129
|
-
metricFilters: LogicalMetricFilter[];
|
|
130
|
-
prefilters: LogicalMetricFilter[];
|
|
131
|
-
specialFilters: {
|
|
132
|
-
topLevel: boolean;
|
|
133
|
-
};
|
|
134
|
-
queryParams: Partial<Record<QueryParamName, string>>;
|
|
135
|
-
orderBy?: BuilderState['orderBy'];
|
|
136
|
-
rowLimit?: number;
|
|
137
|
-
startRow?: number;
|
|
138
|
-
}
|
|
139
|
-
interface LogicalComparisonPlan {
|
|
140
|
-
current: LogicalQueryPlan;
|
|
141
|
-
previous: LogicalQueryPlan;
|
|
142
|
-
comparisonFilter?: ComparisonFilter;
|
|
143
|
-
}
|
|
144
|
-
declare function inferDataset(dimensions: readonly Dimension[], filterDims?: readonly Dimension[]): LogicalDataset;
|
|
145
|
-
/**
|
|
146
|
-
* True when every grouped + filtered dimension fits inside one stored dataset,
|
|
147
|
-
* i.e. the query is answerable from stored Parquet/D1 tables without a live
|
|
148
|
-
* GSC call. `inferDataset` always returns *some* dataset; this predicate is
|
|
149
|
-
* how callers tell a genuine match from one that will fail at column-resolve
|
|
150
|
-
* time.
|
|
151
|
-
*/
|
|
152
|
-
declare function isDatasetResolvable(dimensions: readonly Dimension[], filterDims?: readonly Dimension[]): boolean;
|
|
153
|
-
/**
|
|
154
|
-
* `BuilderState`-level convenience for {@link isDatasetResolvable}: extracts
|
|
155
|
-
* the state's dimension filters (the same way `buildLogicalPlan` does) and
|
|
156
|
-
* checks them against the grouped dimensions. Lets routing code (e.g. the
|
|
157
|
-
* composite source) detect a cross-dimension query without rebuilding a plan.
|
|
158
|
-
*/
|
|
159
|
-
declare function isStateResolvable(state: BuilderState): boolean;
|
|
160
|
-
/**
|
|
161
|
-
* Errors-as-values core: builds the logical plan or returns a typed `QueryError`
|
|
162
|
-
* for every modelled failure (missing date range, a regex filter on an engine
|
|
163
|
-
* without regex pushdown, a cross-dimension query with no stored home).
|
|
164
|
-
* `buildLogicalPlan` is the throwing wrapper for call sites that prefer exceptions.
|
|
165
|
-
*/
|
|
166
|
-
declare function buildLogicalPlanResult(state: BuilderState, capabilities?: PlannerCapabilities): Result<LogicalQueryPlan, QueryError>;
|
|
167
|
-
declare function buildLogicalPlan(state: BuilderState, capabilities?: PlannerCapabilities): LogicalQueryPlan;
|
|
168
|
-
/**
|
|
169
|
-
* Errors-as-values core for the comparison plan: returns a typed `QueryError`
|
|
170
|
-
* when the engine lacks the comparison-join or multi-dataset capability the
|
|
171
|
-
* paired queries need, or when either side fails to plan.
|
|
172
|
-
*/
|
|
173
|
-
declare function buildLogicalComparisonPlanResult(current: BuilderState, previous: BuilderState, capabilities?: PlannerCapabilities, comparisonFilter?: ComparisonFilter): Result<LogicalComparisonPlan, QueryError>;
|
|
174
|
-
declare function buildLogicalComparisonPlan(current: BuilderState, previous: BuilderState, capabilities?: PlannerCapabilities, comparisonFilter?: ComparisonFilter): LogicalComparisonPlan;
|
|
175
|
-
export { ComparisonFilter, LogicalComparisonPlan, LogicalDataset, LogicalDimensionFilter, LogicalFilterGroup, LogicalFilterLeaf, LogicalFilterNode, LogicalMetricFilter, LogicalQueryPlan, PlannerCapabilities, QueryError, QueryErrorKind, UnresolvableDatasetError, UnsupportedLogicalCapabilityError, buildLogicalComparisonPlan, buildLogicalComparisonPlanResult, buildLogicalPlan, buildLogicalPlanResult, inferDataset, isDatasetResolvable, isQueryError, isStateResolvable, queryErrorToException, queryErrors };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface Ok<A> {
|
|
2
|
-
readonly ok: true;
|
|
3
|
-
readonly value: A;
|
|
4
|
-
}
|
|
5
|
-
interface Err<E> {
|
|
6
|
-
readonly ok: false;
|
|
7
|
-
readonly error: E;
|
|
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>;
|
|
14
|
-
/**
|
|
15
|
-
* Collapses a `Result` back into the throwing world: returns the value or throws
|
|
16
|
-
* via `toError`. Used by the throwing wrappers that sit over the `Result` core so
|
|
17
|
-
* existing call sites keep their `await`/`throw` ergonomics.
|
|
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 };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|