recker 1.0.73 → 1.0.75-next.2e5a94f
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 +5 -18
- package/dist/browser/core/client.d.ts +14 -8
- package/dist/browser/core/client.js +199 -17
- package/dist/browser/core/errors.d.ts +15 -1
- package/dist/browser/core/errors.js +140 -9
- package/dist/browser/core/request.d.ts +5 -0
- package/dist/browser/core/request.js +33 -2
- package/dist/browser/core-runtime/plugin-manifest.d.ts +24 -0
- package/dist/browser/core-runtime/plugin-manifest.js +159 -0
- package/dist/browser/core-runtime/request-context.d.ts +13 -0
- package/dist/browser/core-runtime/request-context.js +24 -0
- package/dist/browser/core-runtime/typed-events.d.ts +89 -0
- package/dist/browser/core-runtime/typed-events.js +34 -0
- package/dist/browser/index.iife.min.js +79 -79
- package/dist/browser/index.min.js +79 -79
- package/dist/browser/index.mini.iife.js +913 -97
- package/dist/browser/index.mini.iife.min.js +46 -46
- package/dist/browser/index.mini.min.js +46 -46
- package/dist/browser/index.mini.umd.js +913 -97
- package/dist/browser/index.mini.umd.min.js +46 -46
- package/dist/browser/index.umd.min.js +79 -79
- package/dist/browser/plugins/auth/aws-sigv4.d.ts +1 -0
- package/dist/browser/plugins/auth/aws-sigv4.js +19 -2
- package/dist/browser/plugins/retry.js +29 -1
- package/dist/browser/presets/aws.d.ts +1 -0
- package/dist/browser/presets/aws.js +62 -1
- package/dist/browser/runner/request-runner.d.ts +15 -5
- package/dist/browser/runner/request-runner.js +164 -30
- package/dist/browser/scrape/parser/nodes/html.d.ts +6 -0
- package/dist/browser/scrape/parser/nodes/html.js +70 -18
- package/dist/browser/scrape/parser/nodes/node.d.ts +1 -0
- package/dist/browser/scrape/parser/nodes/node.js +5 -0
- package/dist/browser/scrape/spider.d.ts +1 -0
- package/dist/browser/scrape/spider.js +39 -26
- package/dist/browser/seo/analyzer.d.ts +1 -1
- package/dist/browser/seo/analyzer.js +73 -42
- package/dist/browser/seo/index.d.ts +1 -1
- package/dist/browser/seo/rules/types.d.ts +2 -0
- package/dist/browser/seo/seo-spider.d.ts +2 -3
- package/dist/browser/seo/seo-spider.js +26 -202
- package/dist/browser/seo/types.d.ts +4 -0
- package/dist/browser/seo/validators/sitemap.js +9 -2
- package/dist/browser/transport/fetch.js +38 -5
- package/dist/browser/transport/undici.js +73 -11
- package/dist/browser/transport/worker.d.ts +0 -1
- package/dist/browser/transport/worker.js +1 -3
- package/dist/browser/types/index.d.ts +24 -0
- package/dist/cli/commands/mcp.js +5 -3
- package/dist/core/client.d.ts +14 -8
- package/dist/core/client.js +199 -17
- package/dist/core/errors.d.ts +15 -1
- package/dist/core/errors.js +140 -9
- package/dist/core/request.d.ts +5 -0
- package/dist/core/request.js +33 -2
- package/dist/core-runtime/plugin-manifest.d.ts +24 -0
- package/dist/core-runtime/plugin-manifest.js +159 -0
- package/dist/core-runtime/request-context.d.ts +13 -0
- package/dist/core-runtime/request-context.js +24 -0
- package/dist/core-runtime/typed-events.d.ts +89 -0
- package/dist/core-runtime/typed-events.js +34 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/mcp/cli.js +10 -8
- package/dist/mcp/profiles.d.ts +1 -1
- package/dist/mcp/profiles.js +31 -6
- package/dist/mcp/tools/categories.js +0 -1
- package/dist/plugins/auth/aws-sigv4.d.ts +1 -0
- package/dist/plugins/auth/aws-sigv4.js +19 -2
- package/dist/plugins/retry.js +29 -1
- package/dist/presets/aws.d.ts +1 -0
- package/dist/presets/aws.js +62 -1
- package/dist/recker.d.ts +3 -0
- package/dist/recker.js +5 -0
- package/dist/runner/request-runner.d.ts +15 -5
- package/dist/runner/request-runner.js +164 -30
- package/dist/scrape/parser/nodes/html.d.ts +6 -0
- package/dist/scrape/parser/nodes/html.js +70 -18
- package/dist/scrape/parser/nodes/node.d.ts +1 -0
- package/dist/scrape/parser/nodes/node.js +5 -0
- package/dist/scrape/spider.d.ts +1 -0
- package/dist/scrape/spider.js +39 -26
- package/dist/search/google.d.ts +67 -0
- package/dist/search/google.js +480 -0
- package/dist/search/index.d.ts +3 -0
- package/dist/search/index.js +1 -0
- package/dist/seo/analyzer.d.ts +1 -1
- package/dist/seo/analyzer.js +73 -42
- package/dist/seo/index.d.ts +1 -1
- package/dist/seo/rules/types.d.ts +2 -0
- package/dist/seo/seo-spider.d.ts +2 -3
- package/dist/seo/seo-spider.js +26 -202
- package/dist/seo/types.d.ts +4 -0
- package/dist/seo/validators/sitemap.js +9 -2
- package/dist/transport/fetch.js +38 -5
- package/dist/transport/undici.js +73 -11
- package/dist/transport/worker.d.ts +0 -1
- package/dist/transport/worker.js +1 -3
- package/dist/types/index.d.ts +24 -0
- package/dist/version.js +1 -1
- package/package.json +9 -1
package/dist/mcp/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { RekCommand as Command } from '../cli/router.js';
|
|
3
3
|
import { MCPServer } from './server.js';
|
|
4
|
-
import { listCategories, validateCategories, estimateCategoryTokens, } from './profiles.js';
|
|
4
|
+
import { listCategories, DEFAULT_CATEGORY, validateCategories, estimateCategoryTokens, } from './profiles.js';
|
|
5
5
|
import { LEGACY_TOOL_GROUPS } from './legacy-tool-groups.js';
|
|
6
6
|
const program = new Command('recker-mcp');
|
|
7
7
|
program
|
|
@@ -13,7 +13,7 @@ program
|
|
|
13
13
|
.option('--docs-path <path>', 'Path to documentation directory')
|
|
14
14
|
.option('--examples-path <path>', 'Path to examples directory')
|
|
15
15
|
.option('--src-path <path>', 'Path to source directory')
|
|
16
|
-
.option('-c, --category <categories>', 'Tool categories to enable (comma-separated): minimal, docs, network, dns, seo, security, scrape, video, ai, protocols, parsing, streaming, full')
|
|
16
|
+
.option('-c, --category <categories>', 'Tool categories to enable (comma-separated): minimal, docs, network, dns, seo, security, scrape, video, ai, protocols, parsing, streaming, template, full')
|
|
17
17
|
.option('--list-categories', 'List available categories and exit')
|
|
18
18
|
.option('--no-docs', 'Disable documentation tools (search, get, examples, schema, suggest)')
|
|
19
19
|
.option('--no-http', 'Disable HTTP request tool')
|
|
@@ -50,6 +50,7 @@ program
|
|
|
50
50
|
console.log('');
|
|
51
51
|
process.exit(0);
|
|
52
52
|
}
|
|
53
|
+
const useExplicitCategory = Boolean(opts.category);
|
|
53
54
|
if (opts.category) {
|
|
54
55
|
const categoryNames = opts.category.split(',').map((p) => p.trim());
|
|
55
56
|
const validation = validateCategories(categoryNames);
|
|
@@ -99,6 +100,7 @@ program
|
|
|
99
100
|
console.error(`Invalid transport mode: ${transport}. Use: stdio, http, or sse`);
|
|
100
101
|
process.exit(1);
|
|
101
102
|
}
|
|
103
|
+
const effectiveCategory = useExplicitCategory ? opts.category : (!opts.only && !opts.filter ? DEFAULT_CATEGORY : undefined);
|
|
102
104
|
const server = new MCPServer({
|
|
103
105
|
transport,
|
|
104
106
|
port,
|
|
@@ -106,8 +108,8 @@ program
|
|
|
106
108
|
docsPath: opts.docsPath,
|
|
107
109
|
examplesPath: opts.examplesPath,
|
|
108
110
|
srcPath: opts.srcPath,
|
|
109
|
-
category:
|
|
110
|
-
toolsFilter: !
|
|
111
|
+
category: effectiveCategory,
|
|
112
|
+
toolsFilter: !effectiveCategory && toolsFilter.length > 0 ? toolsFilter : undefined,
|
|
111
113
|
});
|
|
112
114
|
if (transport !== 'stdio') {
|
|
113
115
|
console.log('╔═══════════════════════════════════════════════════════════════════╗');
|
|
@@ -117,15 +119,15 @@ program
|
|
|
117
119
|
console.log(` Transport: ${transport}`);
|
|
118
120
|
console.log(` Port: ${port}`);
|
|
119
121
|
console.log(` Debug: ${opts.debug ? 'enabled' : 'disabled'}`);
|
|
120
|
-
if (
|
|
121
|
-
const tokens = estimateCategoryTokens(
|
|
122
|
-
console.log(` Category: ${
|
|
122
|
+
if (effectiveCategory) {
|
|
123
|
+
const tokens = estimateCategoryTokens(effectiveCategory);
|
|
124
|
+
console.log(` Category: ${effectiveCategory} (~${tokens} tokens)`);
|
|
123
125
|
}
|
|
124
126
|
else if (toolsFilter.length > 0) {
|
|
125
127
|
console.log(` Filters: ${toolsFilter.join(', ')}`);
|
|
126
128
|
}
|
|
127
129
|
else {
|
|
128
|
-
console.log(` Category:
|
|
130
|
+
console.log(` Category: minimal (default)`);
|
|
129
131
|
}
|
|
130
132
|
console.log('');
|
|
131
133
|
console.log(' Available tools:');
|
package/dist/mcp/profiles.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CategoryName = 'minimal' | 'docs' | 'network' | 'dns' | 'seo' | 'security' | 'scrape' | 'video' | 'ai' | 'protocols' | 'parsing' | 'streaming' | 'full';
|
|
1
|
+
export type CategoryName = 'minimal' | 'docs' | 'network' | 'dns' | 'seo' | 'security' | 'scrape' | 'video' | 'ai' | 'protocols' | 'parsing' | 'streaming' | 'template' | 'full';
|
|
2
2
|
export interface Category {
|
|
3
3
|
name: CategoryName;
|
|
4
4
|
description: string;
|
package/dist/mcp/profiles.js
CHANGED
|
@@ -118,11 +118,10 @@ export const categories = {
|
|
|
118
118
|
},
|
|
119
119
|
ai: {
|
|
120
120
|
name: 'ai',
|
|
121
|
-
description: 'Multi-provider AI chat
|
|
121
|
+
description: 'Multi-provider AI chat and comparison',
|
|
122
122
|
icon: '🤖',
|
|
123
123
|
tools: [
|
|
124
124
|
'rek_ai_chat',
|
|
125
|
-
'rek_ai_embed',
|
|
126
125
|
'rek_ai_providers',
|
|
127
126
|
'rek_ai_tokens',
|
|
128
127
|
'rek_ai_compare',
|
|
@@ -173,14 +172,39 @@ export const categories = {
|
|
|
173
172
|
],
|
|
174
173
|
estimatedTokens: 900,
|
|
175
174
|
},
|
|
175
|
+
template: {
|
|
176
|
+
name: 'template',
|
|
177
|
+
description: 'Template rendering, validation, parsing, and helper metadata',
|
|
178
|
+
icon: '📝',
|
|
179
|
+
tools: [
|
|
180
|
+
'rek_template_render',
|
|
181
|
+
'rek_template_validate',
|
|
182
|
+
'rek_template_parse',
|
|
183
|
+
'rek_template_variables',
|
|
184
|
+
'rek_template_check',
|
|
185
|
+
'rek_template_helpers',
|
|
186
|
+
],
|
|
187
|
+
estimatedTokens: 1800,
|
|
188
|
+
},
|
|
176
189
|
full: {
|
|
177
190
|
name: 'full',
|
|
178
191
|
description: 'All available tools (high context cost)',
|
|
179
192
|
icon: '🌟',
|
|
180
193
|
tools: ['*'],
|
|
181
|
-
estimatedTokens:
|
|
194
|
+
estimatedTokens: 0,
|
|
182
195
|
},
|
|
183
196
|
};
|
|
197
|
+
function getAllConcreteProfileTools() {
|
|
198
|
+
const toolNames = new Set();
|
|
199
|
+
for (const category of Object.values(categories)) {
|
|
200
|
+
for (const tool of category.tools) {
|
|
201
|
+
if (tool !== '*') {
|
|
202
|
+
toolNames.add(tool);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return toolNames;
|
|
207
|
+
}
|
|
184
208
|
export const DEFAULT_CATEGORY = 'minimal';
|
|
185
209
|
export const profiles = categories;
|
|
186
210
|
export const DEFAULT_PROFILE = DEFAULT_CATEGORY;
|
|
@@ -226,7 +250,7 @@ export function estimateCategoryTokens(categoryNames) {
|
|
|
226
250
|
if (!category)
|
|
227
251
|
continue;
|
|
228
252
|
if (category.tools.includes('*')) {
|
|
229
|
-
return
|
|
253
|
+
return getAllConcreteProfileTools().size * 300;
|
|
230
254
|
}
|
|
231
255
|
for (const tool of category.tools) {
|
|
232
256
|
if (!seenTools.has(tool)) {
|
|
@@ -239,12 +263,13 @@ export function estimateCategoryTokens(categoryNames) {
|
|
|
239
263
|
}
|
|
240
264
|
export const estimateProfileTokens = estimateCategoryTokens;
|
|
241
265
|
export function listCategories() {
|
|
266
|
+
const toolCount = getAllConcreteProfileTools().size;
|
|
242
267
|
return Object.values(categories).map((p) => ({
|
|
243
268
|
name: p.name,
|
|
244
269
|
description: p.description,
|
|
245
270
|
icon: p.icon,
|
|
246
|
-
toolCount: p.tools.includes('*') ?
|
|
247
|
-
estimatedTokens: p.estimatedTokens,
|
|
271
|
+
toolCount: p.tools.includes('*') ? toolCount : p.tools.length,
|
|
272
|
+
estimatedTokens: p.estimatedTokens || (p.tools.includes('*') ? toolCount * 300 : p.tools.length * 300),
|
|
248
273
|
}));
|
|
249
274
|
}
|
|
250
275
|
export const listProfiles = listCategories;
|
|
@@ -8,3 +8,4 @@ export interface AWSSignatureV4Options {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function awsSignatureV4(options: AWSSignatureV4Options): Middleware;
|
|
10
10
|
export declare function awsSignatureV4Plugin(options: AWSSignatureV4Options): Plugin;
|
|
11
|
+
export declare function clearAwsSigV4PluginCache(): void;
|
|
@@ -81,8 +81,25 @@ export function awsSignatureV4(options) {
|
|
|
81
81
|
return next(newReq);
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
+
const awsSigV4PluginCache = new Map();
|
|
84
85
|
export function awsSignatureV4Plugin(options) {
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
const cacheKey = [
|
|
87
|
+
options.accessKeyId,
|
|
88
|
+
options.secretAccessKey,
|
|
89
|
+
options.region,
|
|
90
|
+
options.service,
|
|
91
|
+
options.sessionToken || '',
|
|
92
|
+
].join('|');
|
|
93
|
+
const cached = awsSigV4PluginCache.get(cacheKey);
|
|
94
|
+
if (cached)
|
|
95
|
+
return cached;
|
|
96
|
+
const safeOptions = { ...options };
|
|
97
|
+
const plugin = (client) => {
|
|
98
|
+
client.use(awsSignatureV4(safeOptions));
|
|
87
99
|
};
|
|
100
|
+
awsSigV4PluginCache.set(cacheKey, plugin);
|
|
101
|
+
return plugin;
|
|
102
|
+
}
|
|
103
|
+
export function clearAwsSigV4PluginCache() {
|
|
104
|
+
awsSigV4PluginCache.clear();
|
|
88
105
|
}
|
package/dist/plugins/retry.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { HttpError, NetworkError, TimeoutError } from '../core/errors.js';
|
|
1
|
+
import { HttpError, NetworkError, TimeoutError, classifyTransportError } from '../core/errors.js';
|
|
2
|
+
import { getRequestContext } from '../core-runtime/request-context.js';
|
|
2
3
|
function calculateDelay(attempt, baseDelay, maxDelay, strategy, useJitter) {
|
|
3
4
|
let calculatedDelay;
|
|
4
5
|
switch (strategy) {
|
|
@@ -54,6 +55,13 @@ export function retryPlugin(options = {}) {
|
|
|
54
55
|
if (error instanceof HttpError) {
|
|
55
56
|
return statusCodes.includes(error.status);
|
|
56
57
|
}
|
|
58
|
+
const classification = classifyTransportError(error);
|
|
59
|
+
if (classification && classification.canRetry === false) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
if (classification) {
|
|
63
|
+
return classification.canRetry;
|
|
64
|
+
}
|
|
57
65
|
if (error && typeof error === 'object' && 'code' in error) {
|
|
58
66
|
const code = error.code;
|
|
59
67
|
return code === 'ECONNRESET' || code === 'ETIMEDOUT' || code === 'ENOTFOUND';
|
|
@@ -62,6 +70,24 @@ export function retryPlugin(options = {}) {
|
|
|
62
70
|
};
|
|
63
71
|
const shouldRetry = options.shouldRetry || defaultShouldRetry;
|
|
64
72
|
return (client) => {
|
|
73
|
+
const emitRequestRetry = (error, attempt, delayMs, req) => {
|
|
74
|
+
const eventBus = client.runtimeEventBus;
|
|
75
|
+
if (!eventBus?.emit) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const context = getRequestContext(req);
|
|
79
|
+
if (!context) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const classification = classifyTransportError(error);
|
|
83
|
+
eventBus.emit('request:retry', {
|
|
84
|
+
context,
|
|
85
|
+
req,
|
|
86
|
+
attempt,
|
|
87
|
+
delayMs,
|
|
88
|
+
reason: classification?.reason || error?.message || 'retry requested'
|
|
89
|
+
});
|
|
90
|
+
};
|
|
65
91
|
const middleware = async (req, next) => {
|
|
66
92
|
let attempt = 0;
|
|
67
93
|
while (true) {
|
|
@@ -80,6 +106,7 @@ export function retryPlugin(options = {}) {
|
|
|
80
106
|
delayMs = calculateDelay(attempt, baseDelay, maxDelay, backoffStrategy, useJitter);
|
|
81
107
|
}
|
|
82
108
|
const err = new HttpError(res, req);
|
|
109
|
+
emitRequestRetry(err, attempt, delayMs, req);
|
|
83
110
|
if (onRetry) {
|
|
84
111
|
onRetry(attempt, err, delayMs);
|
|
85
112
|
}
|
|
@@ -96,6 +123,7 @@ export function retryPlugin(options = {}) {
|
|
|
96
123
|
catch (error) {
|
|
97
124
|
if (attempt < maxAttempts && shouldRetry(error)) {
|
|
98
125
|
const delayMs = calculateDelay(attempt, baseDelay, maxDelay, backoffStrategy, useJitter);
|
|
126
|
+
emitRequestRetry(error, attempt, delayMs, req);
|
|
99
127
|
if (onRetry) {
|
|
100
128
|
onRetry(attempt, error, delayMs);
|
|
101
129
|
}
|
package/dist/presets/aws.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface AWSPresetOptions {
|
|
|
10
10
|
export type AWSService = 's3' | 'dynamodb' | 'lambda' | 'sqs' | 'sns' | 'ses' | 'secretsmanager' | 'ssm' | 'sts' | 'iam' | 'ec2' | 'ecs' | 'eks' | 'cloudwatch' | 'logs' | 'events' | 'kinesis' | 'firehose' | 'apigateway' | 'execute-api' | 'cognito-idp' | 'cognito-identity' | 'kms' | 'athena' | 'glue' | 'stepfunctions' | 'states' | 'bedrock' | 'bedrock-runtime';
|
|
11
11
|
export declare function aws(options: AWSPresetOptions): ClientOptions;
|
|
12
12
|
export declare function awsS3(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
13
|
+
export declare function s3(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
13
14
|
export declare function awsDynamoDB(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
14
15
|
export declare function awsLambda(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
15
16
|
export declare function awsSQS(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
package/dist/presets/aws.js
CHANGED
|
@@ -1,4 +1,62 @@
|
|
|
1
1
|
import { awsSignatureV4Plugin } from '../plugins/auth.js';
|
|
2
|
+
const S3_STORAGE_PRESET = {
|
|
3
|
+
timeout: {
|
|
4
|
+
lookup: 5000,
|
|
5
|
+
connect: 10000,
|
|
6
|
+
secureConnect: 10000,
|
|
7
|
+
response: 30000,
|
|
8
|
+
request: 60000,
|
|
9
|
+
},
|
|
10
|
+
http2: 'performance',
|
|
11
|
+
expectContinue: 2 * 1024 * 1024,
|
|
12
|
+
observability: false,
|
|
13
|
+
concurrency: {
|
|
14
|
+
agent: {
|
|
15
|
+
connections: 100,
|
|
16
|
+
pipelining: 10,
|
|
17
|
+
keepAlive: true,
|
|
18
|
+
keepAliveTimeout: 4000,
|
|
19
|
+
keepAliveMaxTimeout: 600000,
|
|
20
|
+
keepAliveTimeoutThreshold: 1000,
|
|
21
|
+
maxRequestsPerClient: 100,
|
|
22
|
+
clientTtl: null,
|
|
23
|
+
maxCachedSessions: 100,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
retry: {
|
|
27
|
+
maxDelay: 30000,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
function createAwsS3Preset(options) {
|
|
31
|
+
const baseConfig = aws({
|
|
32
|
+
...options,
|
|
33
|
+
service: 's3',
|
|
34
|
+
});
|
|
35
|
+
const baseConcurrency = baseConfig.concurrency;
|
|
36
|
+
let concurrency;
|
|
37
|
+
if (typeof baseConcurrency === 'number') {
|
|
38
|
+
concurrency = baseConcurrency;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const mergedConcurrency = {};
|
|
42
|
+
if (baseConcurrency && typeof baseConcurrency === 'object') {
|
|
43
|
+
Object.assign(mergedConcurrency, S3_STORAGE_PRESET.concurrency, baseConcurrency);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
Object.assign(mergedConcurrency, S3_STORAGE_PRESET.concurrency);
|
|
47
|
+
}
|
|
48
|
+
concurrency = mergedConcurrency;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
...baseConfig,
|
|
52
|
+
...S3_STORAGE_PRESET,
|
|
53
|
+
retry: {
|
|
54
|
+
...baseConfig.retry,
|
|
55
|
+
...S3_STORAGE_PRESET.retry,
|
|
56
|
+
},
|
|
57
|
+
concurrency,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
2
60
|
function getServiceEndpoint(service, region) {
|
|
3
61
|
const globalServices = ['iam', 'sts', 'cloudfront', 'route53'];
|
|
4
62
|
if (globalServices.includes(service)) {
|
|
@@ -43,7 +101,10 @@ export function aws(options) {
|
|
|
43
101
|
};
|
|
44
102
|
}
|
|
45
103
|
export function awsS3(options) {
|
|
46
|
-
return
|
|
104
|
+
return createAwsS3Preset(options);
|
|
105
|
+
}
|
|
106
|
+
export function s3(options) {
|
|
107
|
+
return createAwsS3Preset(options);
|
|
47
108
|
}
|
|
48
109
|
export function awsDynamoDB(options) {
|
|
49
110
|
return aws({ ...options, service: 'dynamodb' });
|
package/dist/recker.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { uploadFile } from './utils/upload.js';
|
|
|
10
10
|
import { VideoBuilder } from './video/builder.js';
|
|
11
11
|
import { getExtractorName, listExtractors } from './extractors/index.js';
|
|
12
12
|
import type { ExtractorResult } from './extractors/base.js';
|
|
13
|
+
import { type GoogleSearchAdvancedOptions, type GoogleSearchResponse } from './search/index.js';
|
|
13
14
|
export declare function get(url: string, options?: RequestOptions): RequestPromise;
|
|
14
15
|
export declare function post(url: string, options?: RequestOptions): RequestPromise;
|
|
15
16
|
export declare function put(url: string, options?: RequestOptions): RequestPromise;
|
|
@@ -25,6 +26,7 @@ export declare function ws(url: string, options?: WebSocketOptions): ReckerWebSo
|
|
|
25
26
|
export declare function video(url: string): VideoBuilder;
|
|
26
27
|
export declare function isVideoSupported(url: string): Promise<boolean>;
|
|
27
28
|
export declare function extractVideo(url: string): Promise<ExtractorResult>;
|
|
29
|
+
export declare function searchGoogle(query: string, options?: GoogleSearchAdvancedOptions): Promise<GoogleSearchResponse>;
|
|
28
30
|
export declare const recker: {
|
|
29
31
|
get: typeof get;
|
|
30
32
|
post: typeof post;
|
|
@@ -81,6 +83,7 @@ export declare const recker: {
|
|
|
81
83
|
XVideosQuickies: typeof import("./extractors/xvideos.js").XVideosQuickiesExtractor;
|
|
82
84
|
Generic: typeof import("./extractors/generic.js").GenericExtractor;
|
|
83
85
|
};
|
|
86
|
+
searchGoogle: typeof searchGoogle;
|
|
84
87
|
listExtractors: typeof listExtractors;
|
|
85
88
|
getExtractorName: typeof getExtractorName;
|
|
86
89
|
ai: {
|
package/dist/recker.js
CHANGED
|
@@ -8,6 +8,7 @@ import { harRecorder } from './plugins/har-recorder.js';
|
|
|
8
8
|
import { uploadFile } from './utils/upload.js';
|
|
9
9
|
import { createVideoBuilder } from './video/builder.js';
|
|
10
10
|
import { extract, extractors, isSupported, getExtractorName, listExtractors } from './extractors/index.js';
|
|
11
|
+
import { searchGoogleAdvanced } from './search/index.js';
|
|
11
12
|
let _defaultClient = null;
|
|
12
13
|
let _defaultDns = null;
|
|
13
14
|
let _defaultAi = null;
|
|
@@ -74,6 +75,9 @@ export async function isVideoSupported(url) {
|
|
|
74
75
|
export async function extractVideo(url) {
|
|
75
76
|
return extract(url, getDefaultClient());
|
|
76
77
|
}
|
|
78
|
+
export function searchGoogle(query, options) {
|
|
79
|
+
return searchGoogleAdvanced(query, options);
|
|
80
|
+
}
|
|
77
81
|
const aiNamespace = {
|
|
78
82
|
chat: (...args) => getDefaultAi().chat(...args),
|
|
79
83
|
stream: (...args) => getDefaultAi().stream(...args),
|
|
@@ -100,6 +104,7 @@ export const recker = {
|
|
|
100
104
|
isVideoSupported,
|
|
101
105
|
extractVideo,
|
|
102
106
|
extractors,
|
|
107
|
+
searchGoogle,
|
|
103
108
|
listExtractors,
|
|
104
109
|
getExtractorName,
|
|
105
110
|
ai: aiNamespace,
|
|
@@ -3,6 +3,12 @@ export interface RunnerOptions {
|
|
|
3
3
|
retries?: number;
|
|
4
4
|
retryDelay?: number;
|
|
5
5
|
}
|
|
6
|
+
export interface RunnerRunOptions {
|
|
7
|
+
priority?: number;
|
|
8
|
+
retries?: number;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
deadlineMs?: number;
|
|
11
|
+
}
|
|
6
12
|
export interface RequestTask<T = any> {
|
|
7
13
|
id: string;
|
|
8
14
|
fn: () => Promise<T>;
|
|
@@ -35,10 +41,14 @@ export declare class RequestRunner extends SimpleEmitter {
|
|
|
35
41
|
private queue;
|
|
36
42
|
private activeCount;
|
|
37
43
|
private paused;
|
|
38
|
-
private results;
|
|
39
44
|
private stats;
|
|
40
45
|
private startTime;
|
|
41
46
|
private pendingRetries;
|
|
47
|
+
private isCancelled;
|
|
48
|
+
private cancelReason;
|
|
49
|
+
private retryTimers;
|
|
50
|
+
private timeoutId?;
|
|
51
|
+
private abortUnsubscribe?;
|
|
42
52
|
constructor(options?: RunnerOptions);
|
|
43
53
|
add<T>(fn: () => Promise<T>, options?: {
|
|
44
54
|
priority?: number;
|
|
@@ -47,13 +57,13 @@ export declare class RequestRunner extends SimpleEmitter {
|
|
|
47
57
|
trackTotal?: boolean;
|
|
48
58
|
resolve?: (value: T | Error) => void;
|
|
49
59
|
}): void;
|
|
50
|
-
run<T>(items: any[], processor: (item: any, index: number) => Promise<T>, options?:
|
|
51
|
-
priority?: number;
|
|
52
|
-
retries?: number;
|
|
53
|
-
}): Promise<RunnerResult<T>>;
|
|
60
|
+
run<T>(items: any[], processor: (item: any, index: number) => Promise<T>, options?: RunnerRunOptions): Promise<RunnerResult<T>>;
|
|
54
61
|
private queueTask;
|
|
55
62
|
private scheduleRetry;
|
|
56
63
|
private processNext;
|
|
64
|
+
private cancelAll;
|
|
65
|
+
private resolveQueue;
|
|
66
|
+
private resolveTask;
|
|
57
67
|
getProgress(): {
|
|
58
68
|
total: number;
|
|
59
69
|
completed: number;
|