recker 1.0.37 → 1.0.39

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.
@@ -1,6 +1,7 @@
1
1
  import { ClientOptions, Middleware, ReckerRequest, ReckerResponse, RequestOptions, CacheStorage, PageResult } from '../types/index.js';
2
2
  import type { ClientAI, ClientOptionsWithAI } from '../types/ai-client.js';
3
3
  import { RequestPromise } from './request-promise.js';
4
+ import { type VersionInfo } from '../version.js';
4
5
  import { PaginationOptions } from '../plugins/pagination.js';
5
6
  import { RetryOptions } from '../plugins/retry.js';
6
7
  import { CacheOptions } from '../plugins/cache.js';
@@ -20,6 +21,9 @@ export interface ExtendedClientOptions extends ClientOptions {
20
21
  dedup?: DedupOptions;
21
22
  }
22
23
  export declare class Client {
24
+ static get version(): string;
25
+ static getVersion(): Promise<string>;
26
+ static getVersionInfo(): Promise<VersionInfo>;
23
27
  private baseUrl;
24
28
  private middlewares;
25
29
  private hooks;
@@ -9,6 +9,7 @@ import { AgentManager } from '../utils/agent-manager.js';
9
9
  import { RequestPool } from '../utils/request-pool.js';
10
10
  import { normalizeConcurrency } from '../utils/concurrency.js';
11
11
  import { getDefaultUserAgent } from '../utils/user-agent.js';
12
+ import { getVersion, getVersionSync, getVersionInfo } from '../version.js';
12
13
  import { paginate, streamPages } from '../plugins/pagination.js';
13
14
  import { retryPlugin } from '../plugins/retry.js';
14
15
  import { cachePlugin } from '../plugins/cache.js';
@@ -27,6 +28,15 @@ import { MemoryCookieJar } from '../cookies/memory-cookie-jar.js';
27
28
  import { scrape as scrapeHelper } from '../plugins/scrape.js';
28
29
  import { HlsPromise } from '../plugins/hls.js';
29
30
  export class Client {
31
+ static get version() {
32
+ return getVersionSync();
33
+ }
34
+ static getVersion() {
35
+ return getVersion();
36
+ }
37
+ static getVersionInfo() {
38
+ return getVersionInfo();
39
+ }
30
40
  baseUrl;
31
41
  middlewares;
32
42
  hooks;
@@ -0,0 +1,11 @@
1
+ export declare function getVersion(): Promise<string>;
2
+ export declare function getVersionSync(): string;
3
+ export interface VersionInfo {
4
+ version: string;
5
+ name: string;
6
+ nodeVersion: string;
7
+ platform: string;
8
+ arch: string;
9
+ }
10
+ export declare function getVersionInfo(): Promise<VersionInfo>;
11
+ export declare function formatVersionInfo(verbose?: boolean): Promise<string>;
@@ -0,0 +1,46 @@
1
+ const VERSION = '__INJECT_VERSION__';
2
+ let _version = null;
3
+ export async function getVersion() {
4
+ if (_version)
5
+ return _version;
6
+ if (VERSION !== '__INJECT_VERSION__') {
7
+ _version = VERSION;
8
+ return _version;
9
+ }
10
+ try {
11
+ const pkg = await import('../package.json', { with: { type: 'json' } });
12
+ _version = pkg.default?.version || '0.0.0-dev';
13
+ }
14
+ catch {
15
+ _version = '0.0.0-dev';
16
+ }
17
+ return _version;
18
+ }
19
+ export function getVersionSync() {
20
+ if (_version)
21
+ return _version;
22
+ if (VERSION !== '__INJECT_VERSION__')
23
+ return VERSION;
24
+ return '0.0.0-dev';
25
+ }
26
+ export async function getVersionInfo() {
27
+ const version = await getVersion();
28
+ return {
29
+ version,
30
+ name: 'recker',
31
+ nodeVersion: process.version,
32
+ platform: process.platform,
33
+ arch: process.arch,
34
+ };
35
+ }
36
+ export async function formatVersionInfo(verbose = false) {
37
+ const info = await getVersionInfo();
38
+ if (verbose) {
39
+ return [
40
+ `recker/${info.version}`,
41
+ `node/${info.nodeVersion.replace('v', '')}`,
42
+ `${info.platform}/${info.arch}`,
43
+ ].join(' ');
44
+ }
45
+ return info.version;
46
+ }
@@ -1,6 +1,6 @@
1
1
  import { classifyError as classifyErrorCore, ClassifiedError } from '../core/error-handler.js';
2
2
  export { classifyErrorCore as classifyError };
3
- import colors from 'picocolors';
3
+ import colors from '../utils/colors.js';
4
4
  export { colors };
5
5
  export declare function formatCliError(error: Error | string | unknown, context?: Record<string, unknown>): string;
6
6
  export declare function printError(error: Error | string | unknown, context?: Record<string, unknown>): void;
@@ -1,6 +1,6 @@
1
1
  import { classifyError as classifyErrorCore, formatErrorForTerminal, } from '../core/error-handler.js';
2
2
  export { classifyErrorCore as classifyError };
3
- import colors from 'picocolors';
3
+ import colors from '../utils/colors.js';
4
4
  export { colors };
5
5
  export function formatCliError(error, context) {
6
6
  const classified = classifyErrorCore(error, context);
package/dist/cli/index.js CHANGED
@@ -5,6 +5,7 @@ import { join } from 'node:path';
5
5
  import colors from '../utils/colors.js';
6
6
  import { formatColumns } from '../utils/columns.js';
7
7
  import { summarizeErrors, formatErrorSummary } from './helpers.js';
8
+ import { getVersion, formatVersionInfo } from '../version.js';
8
9
  async function readStdin() {
9
10
  if (process.stdin.isTTY) {
10
11
  return null;
@@ -69,13 +70,7 @@ async function main() {
69
70
  const { handleRequest } = await import('./handler.js');
70
71
  const { resolvePreset } = await import('./presets.js');
71
72
  const presets = await import('../presets/index.js');
72
- let version = '0.0.0';
73
- try {
74
- const pkg = await import('../../package.json', { with: { type: 'json' } });
75
- version = pkg.default?.version || '0.0.0';
76
- }
77
- catch {
78
- }
73
+ const version = await getVersion();
79
74
  function parseMixedArgs(args, hasPreset = false) {
80
75
  const headers = {};
81
76
  const data = {};
@@ -326,6 +321,27 @@ complete -F _rek_completions rek
326
321
  `;
327
322
  console.log(script);
328
323
  });
324
+ program
325
+ .command('version')
326
+ .alias('info')
327
+ .description('Show detailed version information')
328
+ .option('-s, --short', 'Show only version number')
329
+ .option('--format <type>', 'Output format: text or json', 'text')
330
+ .action(async (options) => {
331
+ if (options.short) {
332
+ console.log(version);
333
+ return;
334
+ }
335
+ if (options.format === 'json') {
336
+ const { getVersionInfo } = await import('../version.js');
337
+ const info = await getVersionInfo();
338
+ console.log(JSON.stringify(info, null, 2));
339
+ return;
340
+ }
341
+ const versionInfo = await formatVersionInfo(true);
342
+ console.log(colors.bold(colors.cyan('recker')) + ' ' + colors.green(version));
343
+ console.log(colors.gray(versionInfo));
344
+ });
329
345
  program
330
346
  .command('shell')
331
347
  .alias('interactive')
@@ -18,6 +18,7 @@ import { ScrollBuffer, parseScrollKey, parseMouseScroll, disableMouseReporting }
18
18
  import { analyzeSeo, SeoSpider } from '../../seo/index.js';
19
19
  import { resolvePreset } from '../presets.js';
20
20
  import { summarizeErrors, formatErrorSummary } from '../helpers.js';
21
+ import { getVersion } from '../../version.js';
21
22
  let highlight;
22
23
  async function initDependencies() {
23
24
  if (!highlight) {
@@ -111,8 +112,9 @@ export class RekShell {
111
112
  async start() {
112
113
  await this.ensureInitialized();
113
114
  this.setupScrollCapture();
115
+ const version = await getVersion();
114
116
  console.clear();
115
- console.log(colors.bold(colors.cyan('Rek Console')));
117
+ console.log(colors.bold(colors.cyan('Rek Console')) + ' ' + colors.gray(`v${version}`));
116
118
  console.log(colors.gray('Chat with your APIs. Type "help" for magic.'));
117
119
  console.log(colors.gray('Use Page Up/Down to view history.'));
118
120
  console.log(colors.gray('--------------------------------------------\n'));
@@ -1,6 +1,7 @@
1
1
  import { ClientOptions, Middleware, ReckerRequest, ReckerResponse, RequestOptions, CacheStorage, PageResult } from '../types/index.js';
2
2
  import type { ClientAI, ClientOptionsWithAI } from '../types/ai-client.js';
3
3
  import { RequestPromise } from './request-promise.js';
4
+ import { type VersionInfo } from '../version.js';
4
5
  import { PaginationOptions } from '../plugins/pagination.js';
5
6
  import { RetryOptions } from '../plugins/retry.js';
6
7
  import { CacheOptions } from '../plugins/cache.js';
@@ -20,6 +21,9 @@ export interface ExtendedClientOptions extends ClientOptions {
20
21
  dedup?: DedupOptions;
21
22
  }
22
23
  export declare class Client {
24
+ static get version(): string;
25
+ static getVersion(): Promise<string>;
26
+ static getVersionInfo(): Promise<VersionInfo>;
23
27
  private baseUrl;
24
28
  private middlewares;
25
29
  private hooks;
@@ -9,6 +9,7 @@ import { AgentManager } from '../utils/agent-manager.js';
9
9
  import { RequestPool } from '../utils/request-pool.js';
10
10
  import { normalizeConcurrency } from '../utils/concurrency.js';
11
11
  import { getDefaultUserAgent } from '../utils/user-agent.js';
12
+ import { getVersion, getVersionSync, getVersionInfo } from '../version.js';
12
13
  import { paginate, streamPages } from '../plugins/pagination.js';
13
14
  import { retryPlugin } from '../plugins/retry.js';
14
15
  import { cachePlugin } from '../plugins/cache.js';
@@ -27,6 +28,15 @@ import { MemoryCookieJar } from '../cookies/memory-cookie-jar.js';
27
28
  import { scrape as scrapeHelper } from '../plugins/scrape.js';
28
29
  import { HlsPromise } from '../plugins/hls.js';
29
30
  export class Client {
31
+ static get version() {
32
+ return getVersionSync();
33
+ }
34
+ static getVersion() {
35
+ return getVersion();
36
+ }
37
+ static getVersionInfo() {
38
+ return getVersionInfo();
39
+ }
30
40
  baseUrl;
31
41
  middlewares;
32
42
  hooks;
package/dist/index.d.ts CHANGED
@@ -70,6 +70,7 @@ export * as protocols from './protocols/index.js';
70
70
  export * from './mcp/client.js';
71
71
  export * from './mcp/contract.js';
72
72
  export * from './mini.js';
73
+ export * from './version.js';
73
74
  export { Client as Recker } from './core/client.js';
74
75
  export { get, post, put, patch, del, del as delete, head, options, whois, whoisAvailable, dns, dnsSecurity, ws, recker, } from './recker.js';
75
76
  export { default } from './recker.js';
package/dist/index.js CHANGED
@@ -70,6 +70,7 @@ export * as protocols from './protocols/index.js';
70
70
  export * from './mcp/client.js';
71
71
  export * from './mcp/contract.js';
72
72
  export * from './mini.js';
73
+ export * from './version.js';
73
74
  export { Client as Recker } from './core/client.js';
74
75
  export { get, post, put, patch, del, del as delete, head, options, whois, whoisAvailable, dns, dnsSecurity, ws, recker, } from './recker.js';
75
76
  export { default } from './recker.js';
package/dist/recker.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Client, type ExtendedClientOptions } from './core/client.js';
2
+ import { getVersion, getVersionInfo } from './version.js';
2
3
  import { type RequestPromise } from './core/request-promise.js';
3
4
  import type { RequestOptions } from './types/index.js';
4
5
  import { type WebSocketOptions, type ReckerWebSocket } from './websocket/client.js';
@@ -42,5 +43,8 @@ export declare const recker: {
42
43
  whoisClient: typeof createWhois;
43
44
  aiClient: (options?: AIClientConfig) => import("./types/ai.js").AIClient;
44
45
  reset: () => void;
46
+ readonly version: string;
47
+ getVersion: typeof getVersion;
48
+ getVersionInfo: typeof getVersionInfo;
45
49
  };
46
50
  export default recker;
package/dist/recker.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { createClient } from './core/client.js';
2
+ import { getVersion, getVersionSync, getVersionInfo } from './version.js';
2
3
  import { FetchTransport } from './transport/fetch.js';
3
4
  import { createWebSocket } from './websocket/client.js';
4
5
  import { whois as whoisLookup, isDomainAvailable, createWhois } from './utils/whois.js';
@@ -95,5 +96,10 @@ export const recker = {
95
96
  _defaultDns = null;
96
97
  _defaultAi = null;
97
98
  },
99
+ get version() {
100
+ return getVersionSync();
101
+ },
102
+ getVersion,
103
+ getVersionInfo,
98
104
  };
99
105
  export default recker;
@@ -0,0 +1,11 @@
1
+ export declare function getVersion(): Promise<string>;
2
+ export declare function getVersionSync(): string;
3
+ export interface VersionInfo {
4
+ version: string;
5
+ name: string;
6
+ nodeVersion: string;
7
+ platform: string;
8
+ arch: string;
9
+ }
10
+ export declare function getVersionInfo(): Promise<VersionInfo>;
11
+ export declare function formatVersionInfo(verbose?: boolean): Promise<string>;
@@ -0,0 +1,46 @@
1
+ const VERSION = '1.0.39';
2
+ let _version = null;
3
+ export async function getVersion() {
4
+ if (_version)
5
+ return _version;
6
+ if (VERSION !== '__INJECT_VERSION__') {
7
+ _version = VERSION;
8
+ return _version;
9
+ }
10
+ try {
11
+ const pkg = await import('../package.json', { with: { type: 'json' } });
12
+ _version = pkg.default?.version || '0.0.0-dev';
13
+ }
14
+ catch {
15
+ _version = '0.0.0-dev';
16
+ }
17
+ return _version;
18
+ }
19
+ export function getVersionSync() {
20
+ if (_version)
21
+ return _version;
22
+ if (VERSION !== '__INJECT_VERSION__')
23
+ return VERSION;
24
+ return '0.0.0-dev';
25
+ }
26
+ export async function getVersionInfo() {
27
+ const version = await getVersion();
28
+ return {
29
+ version,
30
+ name: 'recker',
31
+ nodeVersion: process.version,
32
+ platform: process.platform,
33
+ arch: process.arch,
34
+ };
35
+ }
36
+ export async function formatVersionInfo(verbose = false) {
37
+ const info = await getVersionInfo();
38
+ if (verbose) {
39
+ return [
40
+ `recker/${info.version}`,
41
+ `node/${info.nodeVersion.replace('v', '')}`,
42
+ `${info.platform}/${info.arch}`,
43
+ ].join(' ');
44
+ }
45
+ return info.version;
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recker",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "AI & DevX focused HTTP client for Node.js 18+",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",