recker 1.0.14-next.cd6adc2 → 1.0.15-next.3794a15
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 +78 -100
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/recker.d.ts +47 -0
- package/dist/recker.d.ts.map +1 -0
- package/dist/recker.js +99 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,158 +1,136 @@
|
|
|
1
|
-
# Recker
|
|
2
|
-
|
|
3
1
|
<div align="center">
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
# ⚡ Recker
|
|
6
4
|
|
|
7
|
-
### The
|
|
5
|
+
### The Network SDK for the AI Era
|
|
8
6
|
|
|
9
|
-
**
|
|
7
|
+
**Zero-config HTTP. Multi-protocol support. AI-native streaming. Observable to the millisecond.**
|
|
10
8
|
|
|
11
9
|
[](https://www.npmjs.com/package/recker)
|
|
12
10
|
[](https://www.npmjs.com/package/recker)
|
|
13
11
|
[](https://www.typescriptlang.org/)
|
|
14
12
|
[](https://nodejs.org/)
|
|
15
|
-
[](https://github.com/forattini-dev/recker)
|
|
16
14
|
[](https://github.com/forattini-dev/recker/blob/main/LICENSE)
|
|
17
15
|
|
|
18
|
-
[Documentation](https://forattini-dev.github.io/recker) · [
|
|
16
|
+
[Documentation](https://forattini-dev.github.io/recker) · [API Reference](./docs/reference/01-api.md) · [Examples](./docs/examples/README.md)
|
|
19
17
|
|
|
20
18
|
</div>
|
|
21
19
|
|
|
22
20
|
---
|
|
23
21
|
|
|
24
|
-
##
|
|
22
|
+
## Install
|
|
25
23
|
|
|
26
24
|
```bash
|
|
27
25
|
npm install recker
|
|
28
26
|
```
|
|
29
27
|
|
|
30
|
-
##
|
|
28
|
+
## Quick Start
|
|
31
29
|
|
|
32
30
|
```typescript
|
|
33
|
-
import {
|
|
31
|
+
import { get, post, whois, dns } from 'recker';
|
|
32
|
+
|
|
33
|
+
// HTTP - zero config
|
|
34
|
+
const users = await get('https://api.example.com/users').json();
|
|
35
|
+
await post('https://api.example.com/users', { json: { name: 'John' } });
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
// WHOIS
|
|
38
|
+
const info = await whois('github.com');
|
|
36
39
|
|
|
37
|
-
//
|
|
38
|
-
const
|
|
40
|
+
// DNS
|
|
41
|
+
const ips = await dns('google.com');
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Unified Namespace
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
```typescript
|
|
47
|
+
import { recker } from 'recker';
|
|
42
48
|
|
|
43
|
-
//
|
|
44
|
-
await
|
|
49
|
+
// Everything in one place
|
|
50
|
+
await recker.get('https://api.example.com/users').json();
|
|
51
|
+
await recker.whois('github.com');
|
|
52
|
+
await recker.dns('google.com');
|
|
53
|
+
await recker.ai.chat('Hello!');
|
|
54
|
+
|
|
55
|
+
const socket = recker.ws('wss://api.example.com/ws');
|
|
45
56
|
```
|
|
46
57
|
|
|
47
|
-
|
|
58
|
+
### With Configuration
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { createClient } from 'recker';
|
|
62
|
+
|
|
63
|
+
const api = createClient({
|
|
64
|
+
baseUrl: 'https://api.example.com',
|
|
65
|
+
headers: { 'Authorization': 'Bearer token' },
|
|
66
|
+
timeout: 10000,
|
|
67
|
+
retry: { maxAttempts: 3 }
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const user = await api.get('/users/:id', { params: { id: '123' } }).json();
|
|
71
|
+
```
|
|
48
72
|
|
|
49
|
-
|
|
73
|
+
## Features
|
|
50
74
|
|
|
51
75
|
| Feature | Description |
|
|
52
76
|
|:---|:---|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
77
|
+
| **Zero Config** | Direct functions work out of the box. No setup required. |
|
|
78
|
+
| **Multi-Protocol** | HTTP, WebSocket, DNS, WHOIS, FTP, SFTP, Telnet in one SDK. |
|
|
79
|
+
| **AI-Native** | SSE streaming, token counting, provider abstraction. |
|
|
80
|
+
| **Type-Safe** | Full TypeScript with Zod schema validation. |
|
|
81
|
+
| **Observable** | DNS/TCP/TLS/TTFB timing breakdown per request. |
|
|
82
|
+
| **Resilient** | Retry, circuit breaker, rate limiting, deduplication. |
|
|
59
83
|
|
|
60
|
-
##
|
|
84
|
+
## Highlights
|
|
61
85
|
|
|
62
|
-
###
|
|
63
|
-
Handle LLM streams effortlessly with the `.sse()` iterator.
|
|
86
|
+
### AI Streaming
|
|
64
87
|
|
|
65
88
|
```typescript
|
|
66
|
-
for await (const event of
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
89
|
+
for await (const event of recker.ai.stream({
|
|
90
|
+
model: 'gpt-4',
|
|
91
|
+
messages: [{ role: 'user', content: 'Hello!' }]
|
|
92
|
+
})) {
|
|
93
|
+
process.stdout.write(event.choices[0]?.delta?.content || '');
|
|
70
94
|
}
|
|
71
95
|
```
|
|
72
96
|
|
|
73
|
-
###
|
|
74
|
-
|
|
97
|
+
### Request Timing
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
const response = await get('https://api.example.com/data');
|
|
101
|
+
console.log(response.timings);
|
|
102
|
+
// { dns: 12, tcp: 8, tls: 45, firstByte: 23, total: 156 }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Scraping
|
|
75
106
|
|
|
76
107
|
```typescript
|
|
77
108
|
const doc = await client.scrape('https://example.com');
|
|
78
109
|
const titles = doc.selectAll('h1').map(el => el.text());
|
|
79
110
|
```
|
|
80
111
|
|
|
81
|
-
###
|
|
82
|
-
Configure advanced retry policies in declarative style.
|
|
112
|
+
### Circuit Breaker
|
|
83
113
|
|
|
84
114
|
```typescript
|
|
115
|
+
import { createClient, circuitBreaker } from 'recker';
|
|
116
|
+
|
|
85
117
|
const client = createClient({
|
|
118
|
+
baseUrl: 'https://api.example.com',
|
|
86
119
|
plugins: [
|
|
87
|
-
|
|
120
|
+
circuitBreaker({ threshold: 5, resetTimeout: 30000 })
|
|
88
121
|
]
|
|
89
122
|
});
|
|
90
123
|
```
|
|
91
124
|
|
|
92
|
-
|
|
93
|
-
Know exactly where your latency comes from.
|
|
94
|
-
|
|
95
|
-
```typescript
|
|
96
|
-
const { timings } = await client.get('/api/data');
|
|
97
|
-
console.log(timings);
|
|
98
|
-
// { dns: 12ms, tcp: 8ms, tls: 45ms, firstByte: 23ms, total: 156ms }
|
|
99
|
-
```
|
|
125
|
+
## Documentation
|
|
100
126
|
|
|
101
|
-
|
|
127
|
+
- **[Quick Start](./docs/http/01-quickstart.md)** - Get running in 2 minutes
|
|
128
|
+
- **[API Reference](./docs/reference/01-api.md)** - Complete API documentation
|
|
129
|
+
- **[Configuration](./docs/http/05-configuration.md)** - Client options
|
|
130
|
+
- **[Plugins](./docs/http/10-plugins.md)** - Extend functionality
|
|
131
|
+
- **[AI Integration](./docs/ai/01-overview.md)** - OpenAI, Anthropic, and more
|
|
132
|
+
- **[Protocols](./docs/protocols/01-websocket.md)** - WebSocket, DNS, WHOIS
|
|
102
133
|
|
|
103
|
-
|
|
104
|
-
- [Installation](./docs/getting-started/installation.md)
|
|
105
|
-
- [Quick Start](./docs/http/01-quickstart.md)
|
|
106
|
-
- [Client Configuration](./docs/http/05-configuration.md)
|
|
107
|
-
|
|
108
|
-
**Core Features**
|
|
109
|
-
- [HTTP Fundamentals](./docs/http/02-fundamentals.md)
|
|
110
|
-
- [Streaming & SSE](./docs/ai/02-streaming.md)
|
|
111
|
-
- [Retry & Resilience](./docs/http/07-resilience.md)
|
|
112
|
-
- [Caching](./docs/http/09-cache.md)
|
|
113
|
-
- [Concurrency](./docs/http/08-concurrency.md)
|
|
114
|
-
|
|
115
|
-
**Integrations**
|
|
116
|
-
- [GraphQL](./docs/http/13-graphql.md)
|
|
117
|
-
- [Scraping](./docs/http/14-scraping.md)
|
|
118
|
-
- [Plugins](./docs/http/10-plugins.md)
|
|
119
|
-
|
|
120
|
-
**Reference**
|
|
121
|
-
- [API Reference](./docs/reference/01-api.md)
|
|
122
|
-
- [Troubleshooting](./docs/reference/05-troubleshooting.md)
|
|
123
|
-
- [Examples](./docs/examples/README.md)
|
|
124
|
-
|
|
125
|
-
## ❤️ Acknowledgements
|
|
126
|
-
|
|
127
|
-
At Recker, we are passionate about these incredible open-source technologies. We are here to celebrate the past achievements that shaped the internet as we know it today, and to prepare ourselves for the future of web development.
|
|
128
|
-
|
|
129
|
-
Recker stands on the shoulders of giants. We extend our deepest gratitude to these projects:
|
|
130
|
-
|
|
131
|
-
<div align="center">
|
|
132
|
-
|
|
133
|
-
| | | |
|
|
134
|
-
|:---|:---|:---|
|
|
135
|
-
| **[Apollo Client](https://github.com/apollographql/apollo-client)** | **[Axios](https://github.com/axios/axios)** | **[Cheerio](https://github.com/cheeriojs/cheerio)** |
|
|
136
|
-
| **[Cookie](https://github.com/jshttp/cookie)** | **[Got](https://github.com/sindresorhus/got)** | **[GraphQL.js](https://github.com/graphql/graphql-js)** |
|
|
137
|
-
| **[Ky](https://github.com/sindresorhus/ky)** | **[Needle](https://github.com/tomas/needle)** | **[Node-libcurl](https://github.com/JCMais/node-libcurl)** |
|
|
138
|
-
| **[SuperAgent](https://github.com/ladjs/superagent)** | **[Undici](https://github.com/nodejs/undici)** | **[WS](https://github.com/websockets/ws)** |
|
|
139
|
-
|
|
140
|
-
</div>
|
|
141
|
-
|
|
142
|
-
## 🤝 Contributing
|
|
143
|
-
|
|
144
|
-
We welcome contributions! See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
|
145
|
-
|
|
146
|
-
## 📄 License
|
|
134
|
+
## License
|
|
147
135
|
|
|
148
136
|
MIT © [Forattini](https://github.com/forattini-dev)
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
<div align="center">
|
|
153
|
-
|
|
154
|
-
**Built for the AI era.**
|
|
155
|
-
|
|
156
|
-
[Documentation](https://forattini-dev.github.io/recker) · [GitHub](https://github.com/forattini-dev/recker) · [npm](https://www.npmjs.com/package/recker)
|
|
157
|
-
|
|
158
|
-
</div>
|
package/dist/index.d.ts
CHANGED
|
@@ -64,4 +64,6 @@ export * as protocols from './protocols/index.js';
|
|
|
64
64
|
export * from './mcp/client.js';
|
|
65
65
|
export * from './mcp/contract.js';
|
|
66
66
|
export { Client as Recker } from './core/client.js';
|
|
67
|
+
export { get, post, put, patch, del, del as delete, head, options, whois, whoisAvailable, dns, dnsSecurity, ws, recker, } from './recker.js';
|
|
68
|
+
export { default } from './recker.js';
|
|
67
69
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;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C;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAGlD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAOpD,OAAO,EACL,GAAG,EACH,IAAI,EACJ,GAAG,EACH,KAAK,EACL,GAAG,EACH,GAAG,IAAI,MAAM,EACb,IAAI,EACJ,OAAO,EACP,KAAK,EACL,cAAc,EACd,GAAG,EACH,WAAW,EACX,EAAE,EACF,MAAM,GACP,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -64,3 +64,5 @@ export * as protocols from './protocols/index.js';
|
|
|
64
64
|
export * from './mcp/client.js';
|
|
65
65
|
export * from './mcp/contract.js';
|
|
66
66
|
export { Client as Recker } from './core/client.js';
|
|
67
|
+
export { get, post, put, patch, del, del as delete, head, options, whois, whoisAvailable, dns, dnsSecurity, ws, recker, } from './recker.js';
|
|
68
|
+
export { default } from './recker.js';
|
package/dist/recker.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Client, type ExtendedClientOptions } from './core/client.js';
|
|
2
|
+
import { type RequestPromise } from './core/request-promise.js';
|
|
3
|
+
import type { RequestOptions } from './types/index.js';
|
|
4
|
+
import { type WebSocketOptions, type ReckerWebSocket } from './websocket/client.js';
|
|
5
|
+
import { createWhois, type WhoisResult, type WhoisOptions } from './utils/whois.js';
|
|
6
|
+
import { type DNSClientOptions, type DNSClient } from './dns/index.js';
|
|
7
|
+
import type { AIClientConfig } from './types/ai.js';
|
|
8
|
+
export declare function get(url: string, options?: RequestOptions): RequestPromise;
|
|
9
|
+
export declare function post(url: string, options?: RequestOptions): RequestPromise;
|
|
10
|
+
export declare function put(url: string, options?: RequestOptions): RequestPromise;
|
|
11
|
+
export declare function patch(url: string, options?: RequestOptions): RequestPromise;
|
|
12
|
+
export declare function del(url: string, options?: RequestOptions): RequestPromise;
|
|
13
|
+
export declare function head(url: string, options?: RequestOptions): RequestPromise;
|
|
14
|
+
export declare function options(url: string, options?: RequestOptions): RequestPromise;
|
|
15
|
+
export declare function whois(query: string, options?: WhoisOptions): Promise<WhoisResult>;
|
|
16
|
+
export declare function whoisAvailable(domain: string): Promise<boolean>;
|
|
17
|
+
export declare function dns(hostname: string, type?: 'A' | 'AAAA' | 'MX' | 'TXT' | 'NS' | 'CNAME'): Promise<string[]>;
|
|
18
|
+
export declare function dnsSecurity(domain: string): Promise<import("./utils/dns-toolkit.js").DnsSecurityRecords>;
|
|
19
|
+
export declare function ws(url: string, options?: WebSocketOptions): ReckerWebSocket;
|
|
20
|
+
export declare const recker: {
|
|
21
|
+
get: typeof get;
|
|
22
|
+
post: typeof post;
|
|
23
|
+
put: typeof put;
|
|
24
|
+
patch: typeof patch;
|
|
25
|
+
delete: typeof del;
|
|
26
|
+
head: typeof head;
|
|
27
|
+
options: typeof options;
|
|
28
|
+
whois: typeof whois;
|
|
29
|
+
whoisAvailable: typeof whoisAvailable;
|
|
30
|
+
dns: typeof dns;
|
|
31
|
+
dnsSecurity: typeof dnsSecurity;
|
|
32
|
+
ws: typeof ws;
|
|
33
|
+
ai: {
|
|
34
|
+
chat: (optionsOrPrompt: string | import("./types/ai.js").ChatOptions) => Promise<import("./types/ai.js").AIResponse<string>>;
|
|
35
|
+
stream: (options: import("./types/ai.js").ChatOptions) => Promise<import("./types/ai.js").AIStream>;
|
|
36
|
+
embed: (options: import("./types/ai.js").EmbedOptions) => Promise<import("./types/ai.js").EmbedResponse>;
|
|
37
|
+
extend: (defaults: Partial<import("./types/ai.js").ChatOptions>) => import("./types/ai.js").AIClient;
|
|
38
|
+
readonly metrics: import("./types/ai.js").AIMetrics;
|
|
39
|
+
};
|
|
40
|
+
client: (options?: ExtendedClientOptions) => Client;
|
|
41
|
+
dnsClient: (options?: DNSClientOptions) => DNSClient;
|
|
42
|
+
whoisClient: typeof createWhois;
|
|
43
|
+
aiClient: (options?: AIClientConfig) => import("./types/ai.js").AIClient;
|
|
44
|
+
reset: () => void;
|
|
45
|
+
};
|
|
46
|
+
export default recker;
|
|
47
|
+
//# sourceMappingURL=recker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recker.d.ts","sourceRoot":"","sources":["../src/recker.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,MAAM,EAAgB,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAmB,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrG,OAAO,EAA2C,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7H,OAAO,EAAa,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAElF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA0CpD,wBAAgB,GAAG,C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;yBAUjB,cAAc;;CAUpC,CAAC;AAGF,eAAe,MAAM,CAAC"}
|
package/dist/recker.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { createClient } from './core/client.js';
|
|
2
|
+
import { FetchTransport } from './transport/fetch.js';
|
|
3
|
+
import { createWebSocket } from './websocket/client.js';
|
|
4
|
+
import { whois as whoisLookup, isDomainAvailable, createWhois } from './utils/whois.js';
|
|
5
|
+
import { createDNS } from './dns/index.js';
|
|
6
|
+
import { createAI } from './ai/index.js';
|
|
7
|
+
let _defaultClient = null;
|
|
8
|
+
let _defaultDns = null;
|
|
9
|
+
let _defaultAi = null;
|
|
10
|
+
function getDefaultClient() {
|
|
11
|
+
if (!_defaultClient) {
|
|
12
|
+
_defaultClient = createClient({
|
|
13
|
+
transport: new FetchTransport(),
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return _defaultClient;
|
|
17
|
+
}
|
|
18
|
+
function getDefaultDns() {
|
|
19
|
+
if (!_defaultDns) {
|
|
20
|
+
_defaultDns = createDNS();
|
|
21
|
+
}
|
|
22
|
+
return _defaultDns;
|
|
23
|
+
}
|
|
24
|
+
function getDefaultAi() {
|
|
25
|
+
if (!_defaultAi) {
|
|
26
|
+
_defaultAi = createAI();
|
|
27
|
+
}
|
|
28
|
+
return _defaultAi;
|
|
29
|
+
}
|
|
30
|
+
export function get(url, options) {
|
|
31
|
+
return getDefaultClient().get(url, options);
|
|
32
|
+
}
|
|
33
|
+
export function post(url, options) {
|
|
34
|
+
return getDefaultClient().post(url, options);
|
|
35
|
+
}
|
|
36
|
+
export function put(url, options) {
|
|
37
|
+
return getDefaultClient().put(url, options);
|
|
38
|
+
}
|
|
39
|
+
export function patch(url, options) {
|
|
40
|
+
return getDefaultClient().patch(url, options);
|
|
41
|
+
}
|
|
42
|
+
export function del(url, options) {
|
|
43
|
+
return getDefaultClient().delete(url, options);
|
|
44
|
+
}
|
|
45
|
+
export function head(url, options) {
|
|
46
|
+
return getDefaultClient().head(url, options);
|
|
47
|
+
}
|
|
48
|
+
export function options(url, options) {
|
|
49
|
+
return getDefaultClient().options(url, options);
|
|
50
|
+
}
|
|
51
|
+
export async function whois(query, options) {
|
|
52
|
+
return whoisLookup(query, options);
|
|
53
|
+
}
|
|
54
|
+
export async function whoisAvailable(domain) {
|
|
55
|
+
return isDomainAvailable(domain);
|
|
56
|
+
}
|
|
57
|
+
export async function dns(hostname, type = 'A') {
|
|
58
|
+
return getDefaultDns().resolve(hostname, type);
|
|
59
|
+
}
|
|
60
|
+
export async function dnsSecurity(domain) {
|
|
61
|
+
return getDefaultDns().getSecurityRecords(domain);
|
|
62
|
+
}
|
|
63
|
+
export function ws(url, options) {
|
|
64
|
+
return createWebSocket(url, options);
|
|
65
|
+
}
|
|
66
|
+
const aiNamespace = {
|
|
67
|
+
chat: (...args) => getDefaultAi().chat(...args),
|
|
68
|
+
stream: (...args) => getDefaultAi().stream(...args),
|
|
69
|
+
embed: (...args) => getDefaultAi().embed(...args),
|
|
70
|
+
extend: (...args) => getDefaultAi().extend(...args),
|
|
71
|
+
get metrics() {
|
|
72
|
+
return getDefaultAi().metrics;
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
export const recker = {
|
|
76
|
+
get,
|
|
77
|
+
post,
|
|
78
|
+
put,
|
|
79
|
+
patch,
|
|
80
|
+
delete: del,
|
|
81
|
+
head,
|
|
82
|
+
options,
|
|
83
|
+
whois,
|
|
84
|
+
whoisAvailable,
|
|
85
|
+
dns,
|
|
86
|
+
dnsSecurity,
|
|
87
|
+
ws,
|
|
88
|
+
ai: aiNamespace,
|
|
89
|
+
client: (options) => createClient(options),
|
|
90
|
+
dnsClient: (options) => createDNS(options),
|
|
91
|
+
whoisClient: createWhois,
|
|
92
|
+
aiClient: (options) => createAI(options),
|
|
93
|
+
reset: () => {
|
|
94
|
+
_defaultClient = null;
|
|
95
|
+
_defaultDns = null;
|
|
96
|
+
_defaultAi = null;
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
export default recker;
|