@gscdump/contracts 0.26.10 → 0.27.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/_chunks/schemas.d.mts +5376 -0
- package/dist/_chunks/schemas.mjs +1519 -0
- package/dist/_chunks/types.d.mts +1557 -0
- package/dist/_chunks/webhook-constants.d.mts +9 -0
- package/dist/analytics.d.mts +3 -0
- package/dist/analytics.mjs +2 -0
- package/dist/archetypes.d.mts +107 -0
- package/dist/archetypes.mjs +12 -0
- package/dist/index.d.mts +5 -5249
- package/dist/index.mjs +3 -1512
- package/dist/partner.d.mts +4 -0
- package/dist/partner.mjs +2 -0
- package/package.json +16 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const WEBHOOK_CONTRACT_VERSION = "2026-05-11";
|
|
2
|
+
declare const WEBHOOK_SIGNATURE_HEADER = "X-GSCDump-Signature";
|
|
3
|
+
declare const WEBHOOK_EVENT_HEADER = "X-GSCDump-Event";
|
|
4
|
+
declare const WEBHOOK_DELIVERY_HEADER = "X-GSCDump-Delivery";
|
|
5
|
+
declare const WEBHOOK_CONTRACT_VERSION_HEADER = "X-GSCDump-Contract-Version";
|
|
6
|
+
declare const WEBHOOK_TIMESTAMP_HEADER = "X-GSCDump-Timestamp";
|
|
7
|
+
declare const CANONICAL_WEBHOOK_EVENTS: readonly ["user.lifecycle.changed", "site.lifecycle.changed", "site.analytics.ready", "site.indexing.ready", "site.auth.failed", "job.failed"];
|
|
8
|
+
declare const VALID_WEBHOOK_EVENTS: readonly ["user.lifecycle.changed", "site.lifecycle.changed", "site.analytics.ready", "site.indexing.ready", "site.auth.failed", "job.failed"];
|
|
9
|
+
export { CANONICAL_WEBHOOK_EVENTS, VALID_WEBHOOK_EVENTS, WEBHOOK_CONTRACT_VERSION, WEBHOOK_CONTRACT_VERSION_HEADER, WEBHOOK_DELIVERY_HEADER, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { analyticsEndpointSchemas, analyticsRoutes } from "./_chunks/schemas.mjs";
|
|
2
|
+
import { AddPartnerTeamMemberParams, AnalysisSourcesOptions, AnalysisSourcesResponse, AnalyticsClient, BackfillRange, BackfillResponse, BindPartnerSiteTeamParams, BuilderState, BulkRegisterPartnerSiteResult, BulkRegisterPartnerSitesParams, BulkRegisterPartnerSitesResponse, CanonicalWebhookEventType, ColumnDef, ColumnType, CountriesResponse, CountryRow, CreatePartnerTeamParams, CreateWebhookEnvelopeOptions, DataDetailOptions, DataQueryOptions, DeletePartnerUserResponse, Dimension, Filter, Grain, GscApiRange, GscComparisonFilter, GscRowQueryMeta, GscRowQueryResponse, GscSearchType, GscdumpAnalysisParams, GscdumpAnalysisPreset, GscdumpAnalysisResponse, GscdumpAnalysisSourcesResponse, GscdumpAvailableSite, GscdumpCanonicalMismatchRow, GscdumpCanonicalMismatchesResponse, GscdumpDataDetailResponse, GscdumpDataResponse, GscdumpDataRow, GscdumpDateRangeParams, GscdumpHealthResponse, GscdumpIndexPercentResponse, GscdumpIndexPercentSitemap, GscdumpIndexPercentTrendPoint, GscdumpIndexingDiagnosticsResponse, GscdumpIndexingInspectRateLimited, GscdumpIndexingInspectRequest, GscdumpIndexingInspectResponse, GscdumpIndexingInspectResult, GscdumpIndexingIssueSeverity, GscdumpIndexingResponse, GscdumpIndexingTrendPoint, GscdumpIndexingUrl, GscdumpIndexingUrlStatus, GscdumpIndexingUrlsResponse, GscdumpInvisibleUrlRow, GscdumpKeywordSparklinesParams, GscdumpKeywordSparklinesResponse, GscdumpMeta, GscdumpOrphanPageRow, GscdumpPageTrendParams, GscdumpPageTrendResponse, GscdumpPerSitemapHistoryEntry, GscdumpPermissionRecovery, GscdumpQueryTrendParams, GscdumpQueryTrendResponse, GscdumpRichResultItem, GscdumpSiteRegistration, GscdumpSiteReportResponse, GscdumpSitemap, GscdumpSitemapChangesResponse, GscdumpSitemapHistory, GscdumpSitemapsResponse, GscdumpSyncJobItem, GscdumpSyncJobStatus, GscdumpSyncJobsQueueCounts, GscdumpSyncJobsResponse, GscdumpSyncProgressDateStatus, GscdumpSyncProgressPhaseCounts, GscdumpSyncProgressResponse, GscdumpSyncProgressSite, GscdumpSyncStatusResponse, GscdumpTeamMemberRow, GscdumpTeamRow, GscdumpTopAssociationParams, GscdumpTopAssociationResponse, GscdumpTotals, GscdumpUserMeResponse, GscdumpUserRegistration, GscdumpUserSettings, GscdumpUserSite, GscdumpUserStatus, GscdumpUserTokenUpdate, IndexingDiagnostics, IndexingInspectRateLimit, IndexingInspectRateLimited, IndexingInspectRequest, IndexingInspectResponse, IndexingInspectResult, IndexingIssue, IndexingIssueSeverity, IndexingUrlRow, IndexingUrlStatus, IndexingUrlsParams, IndexingUrlsResponse, InspectionHistoryRecord, InspectionHistoryResponse, InspectionIndex, InspectionRecordRaw, Metric, PartnerClient, PartnerLifecycleAccount, PartnerLifecycleResponse, PartnerLifecycleSite, PartnerRealtimeEvent, PartnerRealtimeEventType, PartnerRealtimeMessage, PartnerWebhookData, PartnerWebhookHeaders, RealtimeAuthFailedEvent, RealtimeAuthRequiredMessage, RealtimeConnectedMessage, RealtimeEnrichmentCompleteEvent, RealtimeErrorMessage, RealtimeJobFailedEvent, RealtimeNeedsReauthEvent, RealtimePongMessage, RealtimeSiteAddedEvent, RealtimeSiteRemovedEvent, RealtimeSubscribedMessage, RealtimeSyncCompleteEvent, RealtimeSyncFailedEvent, RealtimeSyncJobCompleteEvent, RealtimeSyncProgressEvent, RealtimeSyncSiteCompleteEvent, RegisterPartnerSiteParams, RegisterPartnerUserParams, RollupEnvelope, Row, ScheduleState, SearchAppearanceResponse, SearchAppearanceRow, SearchTypeOptions, SiteListItem, SitemapAddedRow, SitemapChangesResponse, SitemapHistoryRecord, SitemapHistoryResponse, SitemapIndex, SitemapRemovedRow, SourceInfoOptions, SourceInfoResponse, TableName, TableSchema, TenantCtx, UpdatePartnerUserTokensParams, WebhookEnvelope, WebhookEventType, WhoamiResponse } from "./_chunks/types.mjs";
|
|
3
|
+
export { type AddPartnerTeamMemberParams, type AnalysisSourcesOptions, type AnalysisSourcesResponse, type AnalyticsClient, type BackfillRange, type BackfillResponse, type BindPartnerSiteTeamParams, type BuilderState, type BulkRegisterPartnerSiteResult, type BulkRegisterPartnerSitesParams, type BulkRegisterPartnerSitesResponse, type CanonicalWebhookEventType, type ColumnDef, type ColumnType, type CountriesResponse, type CountryRow, type CreatePartnerTeamParams, type CreateWebhookEnvelopeOptions, type DataDetailOptions, type DataQueryOptions, type DeletePartnerUserResponse, type Dimension, type Filter, type Grain, type GscApiRange, type GscComparisonFilter, type GscRowQueryMeta, type GscRowQueryResponse, type GscSearchType, type GscdumpAnalysisParams, type GscdumpAnalysisPreset, type GscdumpAnalysisResponse, type GscdumpAnalysisSourcesResponse, type GscdumpAvailableSite, type GscdumpCanonicalMismatchRow, type GscdumpCanonicalMismatchesResponse, type GscdumpDataDetailResponse, type GscdumpDataResponse, type GscdumpDataRow, type GscdumpDateRangeParams, type GscdumpHealthResponse, type GscdumpIndexPercentResponse, type GscdumpIndexPercentSitemap, type GscdumpIndexPercentTrendPoint, type GscdumpIndexingDiagnosticsResponse, type GscdumpIndexingInspectRateLimited, type GscdumpIndexingInspectRequest, type GscdumpIndexingInspectResponse, type GscdumpIndexingInspectResult, type GscdumpIndexingIssueSeverity, type GscdumpIndexingResponse, type GscdumpIndexingTrendPoint, type GscdumpIndexingUrl, type GscdumpIndexingUrlStatus, type GscdumpIndexingUrlsResponse, type GscdumpInvisibleUrlRow, type GscdumpKeywordSparklinesParams, type GscdumpKeywordSparklinesResponse, type GscdumpMeta, type GscdumpOrphanPageRow, type GscdumpPageTrendParams, type GscdumpPageTrendResponse, type GscdumpPerSitemapHistoryEntry, type GscdumpPermissionRecovery, type GscdumpQueryTrendParams, type GscdumpQueryTrendResponse, type GscdumpRichResultItem, type GscdumpSiteRegistration, type GscdumpSiteReportResponse, type GscdumpSitemap, type GscdumpSitemapChangesResponse, type GscdumpSitemapHistory, type GscdumpSitemapsResponse, type GscdumpSyncJobItem, type GscdumpSyncJobStatus, type GscdumpSyncJobsQueueCounts, type GscdumpSyncJobsResponse, type GscdumpSyncProgressDateStatus, type GscdumpSyncProgressPhaseCounts, type GscdumpSyncProgressResponse, type GscdumpSyncProgressSite, type GscdumpSyncStatusResponse, type GscdumpTeamMemberRow, type GscdumpTeamRow, type GscdumpTopAssociationParams, type GscdumpTopAssociationResponse, type GscdumpTotals, type GscdumpUserMeResponse, type GscdumpUserRegistration, type GscdumpUserSettings, type GscdumpUserSite, type GscdumpUserStatus, type GscdumpUserTokenUpdate, type IndexingDiagnostics, type IndexingInspectRateLimit, type IndexingInspectRateLimited, type IndexingInspectRequest, type IndexingInspectResponse, type IndexingInspectResult, type IndexingIssue, type IndexingIssueSeverity, type IndexingUrlRow, type IndexingUrlStatus, type IndexingUrlsParams, type IndexingUrlsResponse, type InspectionHistoryRecord, type InspectionHistoryResponse, type InspectionIndex, type InspectionRecordRaw, type Metric, type PartnerClient, type PartnerLifecycleAccount, type PartnerLifecycleResponse, type PartnerLifecycleSite, type PartnerRealtimeEvent, type PartnerRealtimeEventType, type PartnerRealtimeMessage, type PartnerWebhookData, type PartnerWebhookHeaders, type RealtimeAuthFailedEvent, type RealtimeAuthRequiredMessage, type RealtimeConnectedMessage, type RealtimeEnrichmentCompleteEvent, type RealtimeErrorMessage, type RealtimeJobFailedEvent, type RealtimeNeedsReauthEvent, type RealtimePongMessage, type RealtimeSiteAddedEvent, type RealtimeSiteRemovedEvent, type RealtimeSubscribedMessage, type RealtimeSyncCompleteEvent, type RealtimeSyncFailedEvent, type RealtimeSyncJobCompleteEvent, type RealtimeSyncProgressEvent, type RealtimeSyncSiteCompleteEvent, type RegisterPartnerSiteParams, type RegisterPartnerUserParams, type RollupEnvelope, type Row, type ScheduleState, type SearchAppearanceResponse, type SearchAppearanceRow, type SearchTypeOptions, type SiteListItem, type SitemapAddedRow, type SitemapChangesResponse, type SitemapHistoryRecord, type SitemapHistoryResponse, type SitemapIndex, type SitemapRemovedRow, type SourceInfoOptions, type SourceInfoResponse, type TableName, type TableSchema, type TenantCtx, type UpdatePartnerUserTokensParams, type WebhookEnvelope, type WebhookEventType, type WhoamiResponse, analyticsEndpointSchemas, analyticsRoutes };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { BuilderState, Dimension, GscSearchType, Metric } from "./_chunks/types.mjs";
|
|
2
|
+
type QueryArchetype = 'site-daily-timeseries' | 'entity-daily-timeseries' | 'entity-daily-sparkline' | 'top-n-breakdown' | 'single-row-lookup' | 'multi-series-stacked-daily' | 'two-dimension-detail' | 'arbitrary-sql' | 'aux-cloud-only';
|
|
3
|
+
type ArchetypeExecutionClass = 'r2-sql' | 'r2-sql-resolved' | 'duckdb' | 'cloud-only';
|
|
4
|
+
declare const ARCHETYPE_EXECUTION_CLASS: Record<QueryArchetype, ArchetypeExecutionClass>;
|
|
5
|
+
interface DateRange {
|
|
6
|
+
start: string;
|
|
7
|
+
end: string;
|
|
8
|
+
}
|
|
9
|
+
interface ArchetypeFacet {
|
|
10
|
+
column: Dimension;
|
|
11
|
+
op: 'eq' | 'regex' | 'notRegex';
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
interface ArchetypeQueryBase {
|
|
15
|
+
archetype: QueryArchetype;
|
|
16
|
+
siteId: string;
|
|
17
|
+
searchType: GscSearchType;
|
|
18
|
+
range: DateRange;
|
|
19
|
+
compareRange?: DateRange;
|
|
20
|
+
facets?: readonly ArchetypeFacet[];
|
|
21
|
+
}
|
|
22
|
+
interface SiteDailyTimeseriesQuery extends ArchetypeQueryBase {
|
|
23
|
+
archetype: 'site-daily-timeseries';
|
|
24
|
+
metrics: readonly Metric[];
|
|
25
|
+
}
|
|
26
|
+
interface EntityDailyTimeseriesQuery extends ArchetypeQueryBase {
|
|
27
|
+
archetype: 'entity-daily-timeseries';
|
|
28
|
+
entity: {
|
|
29
|
+
dimension: Extract<Dimension, 'page' | 'query'>;
|
|
30
|
+
value: string;
|
|
31
|
+
};
|
|
32
|
+
metrics: readonly Metric[];
|
|
33
|
+
}
|
|
34
|
+
interface EntityDailySparklineQuery extends ArchetypeQueryBase {
|
|
35
|
+
archetype: 'entity-daily-sparkline';
|
|
36
|
+
dimension: Extract<Dimension, 'page' | 'query' | 'queryCanonical'>;
|
|
37
|
+
entities: readonly string[];
|
|
38
|
+
metric: Metric;
|
|
39
|
+
}
|
|
40
|
+
interface TopNBreakdownQuery extends ArchetypeQueryBase {
|
|
41
|
+
archetype: 'top-n-breakdown';
|
|
42
|
+
dimension: Dimension;
|
|
43
|
+
metrics: readonly Metric[];
|
|
44
|
+
orderBy: {
|
|
45
|
+
metric: Metric;
|
|
46
|
+
dir: 'asc' | 'desc';
|
|
47
|
+
};
|
|
48
|
+
limit: number;
|
|
49
|
+
offset?: number;
|
|
50
|
+
includeTotal?: boolean;
|
|
51
|
+
movers?: 'improving' | 'declining' | 'new' | 'lost';
|
|
52
|
+
}
|
|
53
|
+
interface SingleRowLookupQuery extends ArchetypeQueryBase {
|
|
54
|
+
archetype: 'single-row-lookup';
|
|
55
|
+
match: Partial<Record<Dimension, string>>;
|
|
56
|
+
metrics: readonly Metric[];
|
|
57
|
+
}
|
|
58
|
+
interface MultiSeriesStackedDailyQuery extends ArchetypeQueryBase {
|
|
59
|
+
archetype: 'multi-series-stacked-daily';
|
|
60
|
+
seriesDimension: Dimension;
|
|
61
|
+
metric: Metric;
|
|
62
|
+
}
|
|
63
|
+
interface TwoDimensionDetailQuery extends ArchetypeQueryBase {
|
|
64
|
+
archetype: 'two-dimension-detail';
|
|
65
|
+
metrics: readonly Metric[];
|
|
66
|
+
filter?: {
|
|
67
|
+
page?: string;
|
|
68
|
+
query?: string;
|
|
69
|
+
};
|
|
70
|
+
orderBy?: {
|
|
71
|
+
metric: Metric;
|
|
72
|
+
dir: 'asc' | 'desc';
|
|
73
|
+
};
|
|
74
|
+
limit?: number;
|
|
75
|
+
}
|
|
76
|
+
interface ArbitrarySqlQuery extends ArchetypeQueryBase {
|
|
77
|
+
archetype: 'arbitrary-sql';
|
|
78
|
+
sql: string;
|
|
79
|
+
params?: readonly unknown[];
|
|
80
|
+
}
|
|
81
|
+
interface AuxCloudOnlyQuery {
|
|
82
|
+
archetype: 'aux-cloud-only';
|
|
83
|
+
siteId: string;
|
|
84
|
+
dataset: 'canonicals' | 'sitemaps' | 'indexing';
|
|
85
|
+
params?: Record<string, unknown>;
|
|
86
|
+
}
|
|
87
|
+
type ArchetypeQuery = SiteDailyTimeseriesQuery | EntityDailyTimeseriesQuery | EntityDailySparklineQuery | TopNBreakdownQuery | SingleRowLookupQuery | MultiSeriesStackedDailyQuery | TwoDimensionDetailQuery | ArbitrarySqlQuery | AuxCloudOnlyQuery;
|
|
88
|
+
type ArchetypeResultRow = Record<string, string | number | null>;
|
|
89
|
+
type ArchetypeResultSource = 'browser' | 'server-r2-sql' | 'server-duckdb' | 'cloud';
|
|
90
|
+
interface ArchetypeResult<R extends ArchetypeResultRow = ArchetypeResultRow> {
|
|
91
|
+
archetype: QueryArchetype;
|
|
92
|
+
rows: R[];
|
|
93
|
+
source: ArchetypeResultSource;
|
|
94
|
+
meta?: {
|
|
95
|
+
rowCount: number;
|
|
96
|
+
queryMs: number;
|
|
97
|
+
totalRows?: number;
|
|
98
|
+
compareRows?: R[];
|
|
99
|
+
truncated?: boolean;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
interface ResolvedArchetypeQuery {
|
|
103
|
+
query: ArchetypeQuery;
|
|
104
|
+
builder?: BuilderState;
|
|
105
|
+
executionClass: ArchetypeExecutionClass;
|
|
106
|
+
}
|
|
107
|
+
export { ARCHETYPE_EXECUTION_CLASS, ArbitrarySqlQuery, ArchetypeExecutionClass, ArchetypeFacet, ArchetypeQuery, ArchetypeQueryBase, ArchetypeResult, ArchetypeResultRow, ArchetypeResultSource, AuxCloudOnlyQuery, DateRange, EntityDailySparklineQuery, EntityDailyTimeseriesQuery, MultiSeriesStackedDailyQuery, QueryArchetype, ResolvedArchetypeQuery, SingleRowLookupQuery, SiteDailyTimeseriesQuery, TopNBreakdownQuery, TwoDimensionDetailQuery };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const ARCHETYPE_EXECUTION_CLASS = {
|
|
2
|
+
"site-daily-timeseries": "r2-sql",
|
|
3
|
+
"entity-daily-timeseries": "r2-sql-resolved",
|
|
4
|
+
"entity-daily-sparkline": "r2-sql-resolved",
|
|
5
|
+
"top-n-breakdown": "r2-sql-resolved",
|
|
6
|
+
"single-row-lookup": "r2-sql",
|
|
7
|
+
"multi-series-stacked-daily": "r2-sql",
|
|
8
|
+
"two-dimension-detail": "r2-sql",
|
|
9
|
+
"arbitrary-sql": "duckdb",
|
|
10
|
+
"aux-cloud-only": "cloud-only"
|
|
11
|
+
};
|
|
12
|
+
export { ARCHETYPE_EXECUTION_CLASS };
|