@fetchbrain.com/sdk 0.6.0 → 0.7.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 +37 -18
- package/dist/index.d.mts +36 -6
- package/dist/index.d.ts +36 -6
- package/dist/index.js +251 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +251 -56
- package/dist/index.mjs.map +1 -1
- package/dist/mock/index.d.mts +1 -1
- package/dist/mock/index.d.ts +1 -1
- package/dist/{types-B1MFygnZ.d.mts → types-CSG4BekA.d.mts} +13 -7
- package/dist/{types-B1MFygnZ.d.ts → types-CSG4BekA.d.ts} +13 -7
- package/package.json +1 -1
package/dist/mock/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RawRequest, a as RecallResult,
|
|
1
|
+
import { R as RawRequest, a as RecallResult, b as LearnResponse, S as StatsResponse, A as AskResponse, F as FetchBrainConfig } from '../types-CSG4BekA.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Mock FetchBrain for unit testing
|
package/dist/mock/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RawRequest, a as RecallResult,
|
|
1
|
+
import { R as RawRequest, a as RecallResult, b as LearnResponse, S as StatsResponse, A as AskResponse, F as FetchBrainConfig } from '../types-CSG4BekA.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Mock FetchBrain for unit testing
|
|
@@ -89,7 +89,7 @@ interface FetchBrainConfig {
|
|
|
89
89
|
* Default: false
|
|
90
90
|
*/
|
|
91
91
|
refreshOnRebuild?: boolean;
|
|
92
|
-
/** Request timeout in ms (default:
|
|
92
|
+
/** Request timeout in ms (default: 1500ms; see DEFAULT_TIMEOUT in client.ts) */
|
|
93
93
|
timeout?: number;
|
|
94
94
|
/** Enable debug logging */
|
|
95
95
|
debug?: boolean;
|
|
@@ -113,12 +113,18 @@ interface FetchBrainConfig {
|
|
|
113
113
|
*/
|
|
114
114
|
telemetry?: TelemetryConfig;
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* What one remembered request holds: the record the page pushed, or every
|
|
118
|
+
* record when the page pushed several (a listing page). Recalled arrays are
|
|
119
|
+
* pushed as-is — Crawlee's pushData accepts both shapes.
|
|
120
|
+
*/
|
|
121
|
+
type LearnedData = Record<string, unknown> | Record<string, unknown>[];
|
|
116
122
|
/** Info passed to `onRecalled` when remembered data is delivered in place of a live scrape */
|
|
117
123
|
interface RecalledEvent {
|
|
118
124
|
url: string;
|
|
119
125
|
label?: string;
|
|
120
126
|
userData?: Record<string, unknown>;
|
|
121
|
-
data:
|
|
127
|
+
data: LearnedData;
|
|
122
128
|
}
|
|
123
129
|
/** The raw request the SDK forwards; the API derives identity from a subset. */
|
|
124
130
|
interface RawRequest {
|
|
@@ -142,13 +148,13 @@ interface RecallRequest {
|
|
|
142
148
|
/** Single recall result (matched by ref) */
|
|
143
149
|
interface RecallResultItem {
|
|
144
150
|
ref: string;
|
|
145
|
-
data?:
|
|
151
|
+
data?: LearnedData;
|
|
146
152
|
}
|
|
147
153
|
/** Recall response from the API */
|
|
148
154
|
interface RecallResponse {
|
|
149
155
|
known: {
|
|
150
156
|
ref: string;
|
|
151
|
-
data:
|
|
157
|
+
data: LearnedData;
|
|
152
158
|
}[];
|
|
153
159
|
unknown: string[];
|
|
154
160
|
}
|
|
@@ -156,7 +162,7 @@ interface RecallResponse {
|
|
|
156
162
|
interface LearnRequest {
|
|
157
163
|
entries: {
|
|
158
164
|
request: RawRequest;
|
|
159
|
-
data:
|
|
165
|
+
data: LearnedData;
|
|
160
166
|
}[];
|
|
161
167
|
build?: string;
|
|
162
168
|
}
|
|
@@ -177,7 +183,7 @@ interface StatsResponse {
|
|
|
177
183
|
/** Result of a recall */
|
|
178
184
|
interface RecallResult {
|
|
179
185
|
known: boolean;
|
|
180
|
-
data?:
|
|
186
|
+
data?: LearnedData;
|
|
181
187
|
fallback?: boolean;
|
|
182
188
|
}
|
|
183
189
|
/** Response from a natural-language ask, answered from everything the account has learned */
|
|
@@ -280,4 +286,4 @@ interface TelemetryResponse {
|
|
|
280
286
|
status: "success" | "partial" | "error";
|
|
281
287
|
}
|
|
282
288
|
|
|
283
|
-
export type { AskResponse as A, BatchConfig as B, CircuitState as C, FetchBrainConfig as F,
|
|
289
|
+
export type { AskResponse as A, BatchConfig as B, CircuitState as C, FetchBrainConfig as F, LearnedData as L, MemoryDepth as M, RawRequest as R, StatsResponse as S, TelemetryData as T, RecallResult as a, LearnResponse as b, TelemetryConfig as c, CircuitBreakerConfig as d, Logger as e, LogLevel as f, RecallRequest as g, RecallResponse as h, RecallResultItem as i, LearnRequest as j, RecalledEvent as k, TelemetryRequest as l, TelemetryResponse as m };
|
|
@@ -89,7 +89,7 @@ interface FetchBrainConfig {
|
|
|
89
89
|
* Default: false
|
|
90
90
|
*/
|
|
91
91
|
refreshOnRebuild?: boolean;
|
|
92
|
-
/** Request timeout in ms (default:
|
|
92
|
+
/** Request timeout in ms (default: 1500ms; see DEFAULT_TIMEOUT in client.ts) */
|
|
93
93
|
timeout?: number;
|
|
94
94
|
/** Enable debug logging */
|
|
95
95
|
debug?: boolean;
|
|
@@ -113,12 +113,18 @@ interface FetchBrainConfig {
|
|
|
113
113
|
*/
|
|
114
114
|
telemetry?: TelemetryConfig;
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* What one remembered request holds: the record the page pushed, or every
|
|
118
|
+
* record when the page pushed several (a listing page). Recalled arrays are
|
|
119
|
+
* pushed as-is — Crawlee's pushData accepts both shapes.
|
|
120
|
+
*/
|
|
121
|
+
type LearnedData = Record<string, unknown> | Record<string, unknown>[];
|
|
116
122
|
/** Info passed to `onRecalled` when remembered data is delivered in place of a live scrape */
|
|
117
123
|
interface RecalledEvent {
|
|
118
124
|
url: string;
|
|
119
125
|
label?: string;
|
|
120
126
|
userData?: Record<string, unknown>;
|
|
121
|
-
data:
|
|
127
|
+
data: LearnedData;
|
|
122
128
|
}
|
|
123
129
|
/** The raw request the SDK forwards; the API derives identity from a subset. */
|
|
124
130
|
interface RawRequest {
|
|
@@ -142,13 +148,13 @@ interface RecallRequest {
|
|
|
142
148
|
/** Single recall result (matched by ref) */
|
|
143
149
|
interface RecallResultItem {
|
|
144
150
|
ref: string;
|
|
145
|
-
data?:
|
|
151
|
+
data?: LearnedData;
|
|
146
152
|
}
|
|
147
153
|
/** Recall response from the API */
|
|
148
154
|
interface RecallResponse {
|
|
149
155
|
known: {
|
|
150
156
|
ref: string;
|
|
151
|
-
data:
|
|
157
|
+
data: LearnedData;
|
|
152
158
|
}[];
|
|
153
159
|
unknown: string[];
|
|
154
160
|
}
|
|
@@ -156,7 +162,7 @@ interface RecallResponse {
|
|
|
156
162
|
interface LearnRequest {
|
|
157
163
|
entries: {
|
|
158
164
|
request: RawRequest;
|
|
159
|
-
data:
|
|
165
|
+
data: LearnedData;
|
|
160
166
|
}[];
|
|
161
167
|
build?: string;
|
|
162
168
|
}
|
|
@@ -177,7 +183,7 @@ interface StatsResponse {
|
|
|
177
183
|
/** Result of a recall */
|
|
178
184
|
interface RecallResult {
|
|
179
185
|
known: boolean;
|
|
180
|
-
data?:
|
|
186
|
+
data?: LearnedData;
|
|
181
187
|
fallback?: boolean;
|
|
182
188
|
}
|
|
183
189
|
/** Response from a natural-language ask, answered from everything the account has learned */
|
|
@@ -280,4 +286,4 @@ interface TelemetryResponse {
|
|
|
280
286
|
status: "success" | "partial" | "error";
|
|
281
287
|
}
|
|
282
288
|
|
|
283
|
-
export type { AskResponse as A, BatchConfig as B, CircuitState as C, FetchBrainConfig as F,
|
|
289
|
+
export type { AskResponse as A, BatchConfig as B, CircuitState as C, FetchBrainConfig as F, LearnedData as L, MemoryDepth as M, RawRequest as R, StatsResponse as S, TelemetryData as T, RecallResult as a, LearnResponse as b, TelemetryConfig as c, CircuitBreakerConfig as d, Logger as e, LogLevel as f, RecallRequest as g, RecallResponse as h, RecallResultItem as i, LearnRequest as j, RecalledEvent as k, TelemetryRequest as l, TelemetryResponse as m };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fetchbrain.com/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "FetchBrain SDK — make your Crawlee scrapers smarter with every run; recall before you fetch, teach what you learn.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|