gscdump 4.3.0 → 4.4.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 CHANGED
@@ -134,7 +134,7 @@ sitemap membership is available through `@gscdump/sdk/v1`.
134
134
  - `gscdump/sitemap-identity`: sitemap scope and membership hashing
135
135
  - `gscdump/query`: query builder, columns, operators, Pacific date helpers, and logical query plans
136
136
  - `gscdump/query/plan`: logical query planning only
137
- - `gscdump/bing`: Bing Site, URL, traffic, and crawl evidence calls
137
+ - `gscdump/bing`: Bing Site, URL, traffic, crawl evidence, and sitemap calls
138
138
  - `gscdump/dates`: explicit UTC and Pacific Search Console date helpers
139
139
  - `gscdump/contracts`: Search Analytics request and response contracts
140
140
  - `gscdump/result`: `Result` helpers
@@ -1,5 +1,5 @@
1
1
  import { err, ok } from "../core/result.mjs";
2
- import { normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo } from "./normalize.mjs";
2
+ import { normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingFeed, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo } from "./normalize.mjs";
3
3
  const DEFAULT_BING_WEBMASTER_API_URL = "https://www.bing.com/webmaster/api.svc/json";
4
4
  const DEFAULT_BING_API_KEY_URL = "https://ssl.bing.com/webmaster/api.svc/json";
5
5
  const DEFAULT_BING_CHILD_PAGE_LIMIT = 100;
@@ -239,6 +239,18 @@ function bingWebmaster(options) {
239
239
  query: { siteUrl },
240
240
  signal: callOptions?.signal
241
241
  }),
242
+ getFeeds: (siteUrl, callOptions) => request("GetFeeds", parseList(normalizeBingFeed), {
243
+ query: { siteUrl },
244
+ signal: callOptions?.signal
245
+ }),
246
+ submitFeed: (siteUrl, feedUrl, callOptions) => request("SubmitFeed", parseEmpty, {
247
+ body: {
248
+ siteUrl,
249
+ feedUrl
250
+ },
251
+ method: "POST",
252
+ signal: callOptions?.signal
253
+ }),
242
254
  verifySite: (siteUrl, callOptions) => request("VerifySite", parseBooleanAcknowledgement, {
243
255
  body: { siteUrl },
244
256
  method: "POST",
@@ -1,4 +1,4 @@
1
- import { BingCallOptions, BingChildrenFilters, BingChildrenOptions, BingCrawlDateFilter, BingCrawlEvidence, BingCrawlIssue, BingCrawlIssueWire, BingCrawlStats, BingCrawlStatsWire, BingDiscoveredDateFilter, BingDocumentFilter, BingEvidenceError, BingFetch, BingHttpCodeFilter, BingIndexingEvidence, BingOperation, BingPageStats, BingProviderError, BingQueryStats, BingQueryStatsWire, BingRankAndTrafficStats, BingRankAndTrafficStatsWire, BingSite, BingSiteWire, BingUnknownEvidence, BingUnverifiedSite, BingUrlInfo, BingUrlInfoWire, BingUrlTrafficInfo, BingUrlTrafficInfoWire, BingUrlWithCrawlIssues, BingVerifiedSite, BingWebmasterClient, BingWebmasterOptions, BingWireResponse } from "./types.mjs";
1
+ import { BingCallOptions, BingChildrenFilters, BingChildrenOptions, BingCrawlDateFilter, BingCrawlEvidence, BingCrawlIssue, BingCrawlIssueWire, BingCrawlStats, BingCrawlStatsWire, BingDiscoveredDateFilter, BingDocumentFilter, BingEvidenceError, BingFeed, BingFeedWire, BingFetch, BingHttpCodeFilter, BingIndexingEvidence, BingOperation, BingPageStats, BingProviderError, BingQueryStats, BingQueryStatsWire, BingRankAndTrafficStats, BingRankAndTrafficStatsWire, BingSite, BingSiteWire, BingUnknownEvidence, BingUnverifiedSite, BingUrlInfo, BingUrlInfoWire, BingUrlTrafficInfo, BingUrlTrafficInfoWire, BingUrlWithCrawlIssues, BingVerifiedSite, BingWebmasterClient, BingWebmasterOptions, BingWireResponse } from "./types.mjs";
2
2
  import { DEFAULT_BING_CHILD_PAGE_LIMIT, DEFAULT_BING_WEBMASTER_API_URL, bingWebmaster } from "./client.mjs";
3
- import { normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo } from "./normalize.mjs";
4
- export { type BingCallOptions, type BingChildrenFilters, type BingChildrenOptions, type BingCrawlDateFilter, type BingCrawlEvidence, type BingCrawlIssue, type BingCrawlIssueWire, type BingCrawlStats, type BingCrawlStatsWire, type BingDiscoveredDateFilter, type BingDocumentFilter, type BingEvidenceError, type BingFetch, type BingHttpCodeFilter, type BingIndexingEvidence, type BingOperation, type BingPageStats, type BingProviderError, type BingQueryStats, type BingQueryStatsWire, type BingRankAndTrafficStats, type BingRankAndTrafficStatsWire, type BingSite, type BingSiteWire, type BingUnknownEvidence, type BingUnverifiedSite, type BingUrlInfo, type BingUrlInfoWire, type BingUrlTrafficInfo, type BingUrlTrafficInfoWire, type BingUrlWithCrawlIssues, type BingVerifiedSite, type BingWebmasterClient, type BingWebmasterOptions, type BingWireResponse, DEFAULT_BING_CHILD_PAGE_LIMIT, DEFAULT_BING_WEBMASTER_API_URL, bingWebmaster, normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo };
3
+ import { normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingFeed, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo } from "./normalize.mjs";
4
+ export { type BingCallOptions, type BingChildrenFilters, type BingChildrenOptions, type BingCrawlDateFilter, type BingCrawlEvidence, type BingCrawlIssue, type BingCrawlIssueWire, type BingCrawlStats, type BingCrawlStatsWire, type BingDiscoveredDateFilter, type BingDocumentFilter, type BingEvidenceError, type BingFeed, type BingFeedWire, type BingFetch, type BingHttpCodeFilter, type BingIndexingEvidence, type BingOperation, type BingPageStats, type BingProviderError, type BingQueryStats, type BingQueryStatsWire, type BingRankAndTrafficStats, type BingRankAndTrafficStatsWire, type BingSite, type BingSiteWire, type BingUnknownEvidence, type BingUnverifiedSite, type BingUrlInfo, type BingUrlInfoWire, type BingUrlTrafficInfo, type BingUrlTrafficInfoWire, type BingUrlWithCrawlIssues, type BingVerifiedSite, type BingWebmasterClient, type BingWebmasterOptions, type BingWireResponse, DEFAULT_BING_CHILD_PAGE_LIMIT, DEFAULT_BING_WEBMASTER_API_URL, bingWebmaster, normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingFeed, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo };
@@ -1,3 +1,3 @@
1
- import { normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo } from "./normalize.mjs";
1
+ import { normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingFeed, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo } from "./normalize.mjs";
2
2
  import { DEFAULT_BING_CHILD_PAGE_LIMIT, DEFAULT_BING_WEBMASTER_API_URL, bingWebmaster } from "./client.mjs";
3
- export { DEFAULT_BING_CHILD_PAGE_LIMIT, DEFAULT_BING_WEBMASTER_API_URL, bingWebmaster, normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo };
3
+ export { DEFAULT_BING_CHILD_PAGE_LIMIT, DEFAULT_BING_WEBMASTER_API_URL, bingWebmaster, normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingFeed, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo };
@@ -1,5 +1,5 @@
1
1
  import { Result } from "../core/result.mjs";
2
- import { BingCrawlStats, BingEvidenceError, BingIndexingEvidence, BingPageStats, BingQueryStats, BingRankAndTrafficStats, BingSite, BingUrlInfo, BingUrlTrafficInfo, BingUrlWithCrawlIssues } from "./types.mjs";
2
+ import { BingCrawlStats, BingEvidenceError, BingFeed, BingIndexingEvidence, BingPageStats, BingQueryStats, BingRankAndTrafficStats, BingSite, BingUrlInfo, BingUrlTrafficInfo, BingUrlWithCrawlIssues } from "./types.mjs";
3
3
  export declare function normalizeBingSite(value: unknown): Result<BingSite, 'invalid-payload'>;
4
4
  export declare function normalizeBingUrlInfo(value: unknown): Result<BingUrlInfo, 'invalid-payload'>;
5
5
  export declare function normalizeBingUrlTrafficInfo(value: unknown): Result<BingUrlTrafficInfo, 'invalid-payload'>;
@@ -7,5 +7,6 @@ export declare function normalizeBingPageStats(value: unknown): Result<BingPageS
7
7
  export declare function normalizeBingQueryStats(value: unknown): Result<BingQueryStats, 'invalid-payload'>;
8
8
  export declare function normalizeBingRankAndTrafficStats(value: unknown): Result<BingRankAndTrafficStats, 'invalid-payload'>;
9
9
  export declare function normalizeBingCrawlStats(value: unknown): Result<BingCrawlStats, 'invalid-payload'>;
10
+ export declare function normalizeBingFeed(value: unknown): Result<BingFeed, 'invalid-payload'>;
10
11
  export declare function normalizeBingCrawlIssue(value: unknown): Result<BingUrlWithCrawlIssues, 'invalid-payload'>;
11
12
  export declare function normalizeBingIndexingEvidence(info: BingUrlInfo | null, url: string, observedAt: Date): Result<BingIndexingEvidence, BingEvidenceError>;
@@ -132,6 +132,25 @@ function normalizeBingCrawlStats(value) {
132
132
  inLinks: value.InLinks
133
133
  });
134
134
  }
135
+ function isNullableNonNegativeInteger(value) {
136
+ return value === null || isNonNegativeInteger(value);
137
+ }
138
+ function normalizeBingFeed(value) {
139
+ if (!isRecord(value) || typeof value.Compressed !== "boolean" || !isNullableNonNegativeInteger(value.FileSize) || typeof value.Status !== "string" || typeof value.Type !== "string" || typeof value.Url !== "string" || !isNullableNonNegativeInteger(value.UrlCount)) return err("invalid-payload");
140
+ const lastCrawledAt = parseBingDate(value.LastCrawled);
141
+ const submittedAt = parseBingDate(value.Submitted);
142
+ if (!lastCrawledAt.ok || !submittedAt.ok) return err("invalid-payload");
143
+ return ok({
144
+ compressed: value.Compressed,
145
+ fileSize: value.FileSize,
146
+ lastCrawledAt: lastCrawledAt.value ?? null,
147
+ status: value.Status,
148
+ submittedAt: submittedAt.value ?? null,
149
+ type: value.Type,
150
+ url: value.Url,
151
+ urlCount: value.UrlCount
152
+ });
153
+ }
135
154
  const CRAWL_ISSUES = {
136
155
  0: "none",
137
156
  1: "301",
@@ -189,4 +208,4 @@ function normalizeBingIndexingEvidence(info, url, observedAt) {
189
208
  url
190
209
  });
191
210
  }
192
- export { normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo };
211
+ export { normalizeBingCrawlIssue, normalizeBingCrawlStats, normalizeBingFeed, normalizeBingIndexingEvidence, normalizeBingPageStats, normalizeBingQueryStats, normalizeBingRankAndTrafficStats, normalizeBingSite, normalizeBingUrlInfo, normalizeBingUrlTrafficInfo };
@@ -64,6 +64,17 @@ export interface BingCrawlIssueWire {
64
64
  Issues: number;
65
65
  Url: string;
66
66
  }
67
+ export interface BingFeedWire {
68
+ __type?: string;
69
+ Compressed: boolean;
70
+ FileSize: number | null;
71
+ LastCrawled: string | null;
72
+ Status: string;
73
+ Submitted: string | null;
74
+ Type: string;
75
+ Url: string;
76
+ UrlCount: number | null;
77
+ }
67
78
  export interface BingWireResponse<T> {
68
79
  d: T;
69
80
  }
@@ -134,6 +145,16 @@ export interface BingCrawlStats {
134
145
  inIndex: number;
135
146
  inLinks: number;
136
147
  }
148
+ export interface BingFeed {
149
+ compressed: boolean;
150
+ fileSize: number | null;
151
+ lastCrawledAt: string | null;
152
+ status: string;
153
+ submittedAt: string | null;
154
+ type: string;
155
+ url: string;
156
+ urlCount: number | null;
157
+ }
137
158
  export type BingCrawlIssue = 'none' | '301' | '302' | '4xx' | '5xx' | 'blocked-by-robots-txt' | 'contains-malware' | 'important-url-blocked-by-robots-txt' | 'dns-errors' | 'timeout-errors' | 'unknown';
138
159
  export interface BingUrlWithCrawlIssues {
139
160
  httpCode: number;
@@ -206,7 +227,7 @@ export interface BingEvidenceError {
206
227
  reason: 'not-a-page';
207
228
  url: string;
208
229
  }
209
- export type BingOperation = 'AddSite' | 'GetUserSites' | 'GetUrlInfo' | 'GetUrlTrafficInfo' | 'GetChildrenUrlInfo' | 'GetPageStats' | 'GetQueryStats' | 'GetRankAndTrafficStats' | 'GetCrawlStats' | 'GetCrawlIssues' | 'VerifySite';
230
+ export type BingOperation = 'AddSite' | 'GetUserSites' | 'GetUrlInfo' | 'GetUrlTrafficInfo' | 'GetChildrenUrlInfo' | 'GetPageStats' | 'GetQueryStats' | 'GetRankAndTrafficStats' | 'GetCrawlStats' | 'GetCrawlIssues' | 'GetFeeds' | 'SubmitFeed' | 'VerifySite';
210
231
  export interface BingCallOptions {
211
232
  signal?: AbortSignal;
212
233
  }
@@ -237,6 +258,8 @@ export interface BingWebmasterClient {
237
258
  getRankAndTrafficStats: (siteUrl: string, options?: BingCallOptions) => Promise<Result<BingRankAndTrafficStats[], BingProviderError>>;
238
259
  getCrawlStats: (siteUrl: string, options?: BingCallOptions) => Promise<Result<BingCrawlStats[], BingProviderError>>;
239
260
  getCrawlIssues: (siteUrl: string, options?: BingCallOptions) => Promise<Result<BingUrlWithCrawlIssues[], BingProviderError>>;
261
+ getFeeds: (siteUrl: string, options?: BingCallOptions) => Promise<Result<BingFeed[], BingProviderError>>;
262
+ submitFeed: (siteUrl: string, feedUrl: string, options?: BingCallOptions) => Promise<Result<void, BingProviderError>>;
240
263
  verifySite: (siteUrl: string, options?: BingCallOptions) => Promise<Result<void, BingProviderError>>;
241
264
  }
242
265
  export type BingFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gscdump",
3
3
  "type": "module",
4
- "version": "4.3.0",
4
+ "version": "4.4.0",
5
5
  "description": "Direct Google Search Console and Bing Webmaster clients with typed queries and Indexing Evidence",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -113,7 +113,7 @@
113
113
  "node": ">=22.13.0"
114
114
  },
115
115
  "dependencies": {
116
- "@gscdump/contracts": "^4.3.0",
116
+ "@gscdump/contracts": "^4.4.0",
117
117
  "ofetch": "^1.5.1"
118
118
  },
119
119
  "scripts": {