scrapebadger 0.24.1 → 0.24.2
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/{index-CIZUd1Zr.d.cts → index-jp8WyFsJ.d.cts} +8 -0
- package/dist/{index-CIZUd1Zr.d.ts → index-jp8WyFsJ.d.ts} +8 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -3
- package/dist/index.mjs.map +1 -1
- package/dist/twitter/index.d.cts +1 -1
- package/dist/twitter/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -76,6 +76,14 @@ declare class BaseClient {
|
|
|
76
76
|
* Handle HTTP response and convert errors.
|
|
77
77
|
*/
|
|
78
78
|
private handleResponse;
|
|
79
|
+
/**
|
|
80
|
+
* Whether a failed request is worth another attempt.
|
|
81
|
+
*
|
|
82
|
+
* Retryable: transient server failures (500/502/503/504), request timeouts,
|
|
83
|
+
* rate limits, and raw network faults thrown by `fetch` itself. Everything
|
|
84
|
+
* else — auth, validation, not-found, conflict — is final.
|
|
85
|
+
*/
|
|
86
|
+
private static isRetryable;
|
|
79
87
|
/**
|
|
80
88
|
* Sleep for a given duration.
|
|
81
89
|
*/
|
|
@@ -76,6 +76,14 @@ declare class BaseClient {
|
|
|
76
76
|
* Handle HTTP response and convert errors.
|
|
77
77
|
*/
|
|
78
78
|
private handleResponse;
|
|
79
|
+
/**
|
|
80
|
+
* Whether a failed request is worth another attempt.
|
|
81
|
+
*
|
|
82
|
+
* Retryable: transient server failures (500/502/503/504), request timeouts,
|
|
83
|
+
* rate limits, and raw network faults thrown by `fetch` itself. Everything
|
|
84
|
+
* else — auth, validation, not-found, conflict — is final.
|
|
85
|
+
*/
|
|
86
|
+
private static isRetryable;
|
|
79
87
|
/**
|
|
80
88
|
* Sleep for a given duration.
|
|
81
89
|
*/
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-
|
|
2
|
-
export { e as AccountRestrictedError, a3 as ApiResponse, $ as Article, A as AuthenticationError, aj as BillingLog, ak as BillingLogList, a2 as Broadcast, j as CommunitiesClient, K as Community, F as CommunityBanner, O as CommunityMember, a0 as CommunityNote, J as CommunityRule, q as CommunityTweetType, C as ConflictError, al as ConnectOptions, ab as ConnectedEvent, a8 as CreateMonitorParams, ah as DeliveryLog, ai as DeliveryLogList, ae as ErrorEvent, ao as FilterRuleCreate, at as FilterRuleDeliveryLog, au as FilterRuleDeliveryLogListResponse, ar as FilterRuleListResponse, aq as FilterRulePricingTier, av as FilterRulePricingTiersResponse, an as FilterRuleResponse, am as FilterRuleStatus, ap as FilterRuleUpdate, as as FilterRuleValidateResponse, G as GeoClient, l as GeoSearchOptions, H as Hashtag, I as InsufficientCreditsError, g as IteratorOptions, E as List, a4 as ListResponse, L as ListsClient, Y as Location, M as Media, a5 as MonitorStatus, N as NotFoundError, P as PaginatedResponse, f as PaginationOptions, ac as PingEvent, _ as Place, Z as PlaceTrends, s as Poll, r as PollOption, Q as QueryType, b as RateLimitError, R as ResolvedConfig, a as ScrapeBadgerError, c as ServerError, a1 as Space, o as SpacesClient, m as StreamClient, n as StreamEmitter, af as StreamEvent, ag as StreamEventType, a6 as StreamMonitor, a7 as StreamMonitorList, aa as StreamTweet, d as TimeoutError, X as Trend, p as TrendCategory, k as TrendsClient, x as Tweet, ad as TweetEvent, w as TweetPlace, i as TweetsClient, a9 as UpdateMonitorParams, t as Url, y as User, z as UserAbout, D as UserIds, u as UserMention, U as UsersClient, V as ValidationError, W as WebSocketStreamError, h as collectAll, v as verifyWebhookSignature } from './index-
|
|
1
|
+
import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-jp8WyFsJ.cjs';
|
|
2
|
+
export { e as AccountRestrictedError, a3 as ApiResponse, $ as Article, A as AuthenticationError, aj as BillingLog, ak as BillingLogList, a2 as Broadcast, j as CommunitiesClient, K as Community, F as CommunityBanner, O as CommunityMember, a0 as CommunityNote, J as CommunityRule, q as CommunityTweetType, C as ConflictError, al as ConnectOptions, ab as ConnectedEvent, a8 as CreateMonitorParams, ah as DeliveryLog, ai as DeliveryLogList, ae as ErrorEvent, ao as FilterRuleCreate, at as FilterRuleDeliveryLog, au as FilterRuleDeliveryLogListResponse, ar as FilterRuleListResponse, aq as FilterRulePricingTier, av as FilterRulePricingTiersResponse, an as FilterRuleResponse, am as FilterRuleStatus, ap as FilterRuleUpdate, as as FilterRuleValidateResponse, G as GeoClient, l as GeoSearchOptions, H as Hashtag, I as InsufficientCreditsError, g as IteratorOptions, E as List, a4 as ListResponse, L as ListsClient, Y as Location, M as Media, a5 as MonitorStatus, N as NotFoundError, P as PaginatedResponse, f as PaginationOptions, ac as PingEvent, _ as Place, Z as PlaceTrends, s as Poll, r as PollOption, Q as QueryType, b as RateLimitError, R as ResolvedConfig, a as ScrapeBadgerError, c as ServerError, a1 as Space, o as SpacesClient, m as StreamClient, n as StreamEmitter, af as StreamEvent, ag as StreamEventType, a6 as StreamMonitor, a7 as StreamMonitorList, aa as StreamTweet, d as TimeoutError, X as Trend, p as TrendCategory, k as TrendsClient, x as Tweet, ad as TweetEvent, w as TweetPlace, i as TweetsClient, a9 as UpdateMonitorParams, t as Url, y as User, z as UserAbout, D as UserIds, u as UserMention, U as UsersClient, V as ValidationError, W as WebSocketStreamError, h as collectAll, v as verifyWebhookSignature } from './index-jp8WyFsJ.cjs';
|
|
3
3
|
import 'node:events';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-
|
|
2
|
-
export { e as AccountRestrictedError, a3 as ApiResponse, $ as Article, A as AuthenticationError, aj as BillingLog, ak as BillingLogList, a2 as Broadcast, j as CommunitiesClient, K as Community, F as CommunityBanner, O as CommunityMember, a0 as CommunityNote, J as CommunityRule, q as CommunityTweetType, C as ConflictError, al as ConnectOptions, ab as ConnectedEvent, a8 as CreateMonitorParams, ah as DeliveryLog, ai as DeliveryLogList, ae as ErrorEvent, ao as FilterRuleCreate, at as FilterRuleDeliveryLog, au as FilterRuleDeliveryLogListResponse, ar as FilterRuleListResponse, aq as FilterRulePricingTier, av as FilterRulePricingTiersResponse, an as FilterRuleResponse, am as FilterRuleStatus, ap as FilterRuleUpdate, as as FilterRuleValidateResponse, G as GeoClient, l as GeoSearchOptions, H as Hashtag, I as InsufficientCreditsError, g as IteratorOptions, E as List, a4 as ListResponse, L as ListsClient, Y as Location, M as Media, a5 as MonitorStatus, N as NotFoundError, P as PaginatedResponse, f as PaginationOptions, ac as PingEvent, _ as Place, Z as PlaceTrends, s as Poll, r as PollOption, Q as QueryType, b as RateLimitError, R as ResolvedConfig, a as ScrapeBadgerError, c as ServerError, a1 as Space, o as SpacesClient, m as StreamClient, n as StreamEmitter, af as StreamEvent, ag as StreamEventType, a6 as StreamMonitor, a7 as StreamMonitorList, aa as StreamTweet, d as TimeoutError, X as Trend, p as TrendCategory, k as TrendsClient, x as Tweet, ad as TweetEvent, w as TweetPlace, i as TweetsClient, a9 as UpdateMonitorParams, t as Url, y as User, z as UserAbout, D as UserIds, u as UserMention, U as UsersClient, V as ValidationError, W as WebSocketStreamError, h as collectAll, v as verifyWebhookSignature } from './index-
|
|
1
|
+
import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-jp8WyFsJ.js';
|
|
2
|
+
export { e as AccountRestrictedError, a3 as ApiResponse, $ as Article, A as AuthenticationError, aj as BillingLog, ak as BillingLogList, a2 as Broadcast, j as CommunitiesClient, K as Community, F as CommunityBanner, O as CommunityMember, a0 as CommunityNote, J as CommunityRule, q as CommunityTweetType, C as ConflictError, al as ConnectOptions, ab as ConnectedEvent, a8 as CreateMonitorParams, ah as DeliveryLog, ai as DeliveryLogList, ae as ErrorEvent, ao as FilterRuleCreate, at as FilterRuleDeliveryLog, au as FilterRuleDeliveryLogListResponse, ar as FilterRuleListResponse, aq as FilterRulePricingTier, av as FilterRulePricingTiersResponse, an as FilterRuleResponse, am as FilterRuleStatus, ap as FilterRuleUpdate, as as FilterRuleValidateResponse, G as GeoClient, l as GeoSearchOptions, H as Hashtag, I as InsufficientCreditsError, g as IteratorOptions, E as List, a4 as ListResponse, L as ListsClient, Y as Location, M as Media, a5 as MonitorStatus, N as NotFoundError, P as PaginatedResponse, f as PaginationOptions, ac as PingEvent, _ as Place, Z as PlaceTrends, s as Poll, r as PollOption, Q as QueryType, b as RateLimitError, R as ResolvedConfig, a as ScrapeBadgerError, c as ServerError, a1 as Space, o as SpacesClient, m as StreamClient, n as StreamEmitter, af as StreamEvent, ag as StreamEventType, a6 as StreamMonitor, a7 as StreamMonitorList, aa as StreamTweet, d as TimeoutError, X as Trend, p as TrendCategory, k as TrendsClient, x as Tweet, ad as TweetEvent, w as TweetPlace, i as TweetsClient, a9 as UpdateMonitorParams, t as Url, y as User, z as UserAbout, D as UserIds, u as UserMention, U as UsersClient, V as ValidationError, W as WebSocketStreamError, h as collectAll, v as verifyWebhookSignature } from './index-jp8WyFsJ.js';
|
|
3
3
|
import 'node:events';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
9
9
|
var WebSocket__default = /*#__PURE__*/_interopDefault(WebSocket);
|
|
10
10
|
|
|
11
11
|
// src/internal/version.ts
|
|
12
|
-
var SDK_VERSION = "0.24.
|
|
12
|
+
var SDK_VERSION = "0.24.2";
|
|
13
13
|
|
|
14
14
|
// src/internal/exceptions.ts
|
|
15
15
|
var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
|
|
@@ -124,7 +124,8 @@ var WebSocketStreamError = class _WebSocketStreamError extends ScrapeBadgerError
|
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
// src/internal/client.ts
|
|
127
|
-
var
|
|
127
|
+
var RETRYABLE_STATUS_CODES = [500, 502, 503, 504];
|
|
128
|
+
var BaseClient = class _BaseClient {
|
|
128
129
|
config;
|
|
129
130
|
constructor(config) {
|
|
130
131
|
this.config = config;
|
|
@@ -184,7 +185,7 @@ var BaseClient = class {
|
|
|
184
185
|
return { data, rateLimit };
|
|
185
186
|
} catch (error) {
|
|
186
187
|
lastError = error;
|
|
187
|
-
if (
|
|
188
|
+
if (!_BaseClient.isRetryable(error)) {
|
|
188
189
|
throw error;
|
|
189
190
|
}
|
|
190
191
|
if (attempt === this.config.maxRetries) {
|
|
@@ -311,6 +312,22 @@ var BaseClient = class {
|
|
|
311
312
|
throw new ScrapeBadgerError(message);
|
|
312
313
|
}
|
|
313
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Whether a failed request is worth another attempt.
|
|
317
|
+
*
|
|
318
|
+
* Retryable: transient server failures (500/502/503/504), request timeouts,
|
|
319
|
+
* rate limits, and raw network faults thrown by `fetch` itself. Everything
|
|
320
|
+
* else — auth, validation, not-found, conflict — is final.
|
|
321
|
+
*/
|
|
322
|
+
static isRetryable(error) {
|
|
323
|
+
if (error instanceof ServerError) {
|
|
324
|
+
return RETRYABLE_STATUS_CODES.includes(error.statusCode);
|
|
325
|
+
}
|
|
326
|
+
if (error instanceof RateLimitError || error instanceof TimeoutError) {
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
return !(error instanceof ScrapeBadgerError);
|
|
330
|
+
}
|
|
314
331
|
/**
|
|
315
332
|
* Sleep for a given duration.
|
|
316
333
|
*/
|