@qodalis/cli-curl 0.0.4 → 2.0.0-beta.10

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/package.json CHANGED
@@ -1,44 +1,37 @@
1
1
  {
2
2
  "name": "@qodalis/cli-curl",
3
- "version": "0.0.4",
4
- "description": "Provide utility functions for the library curl",
3
+ "version": "2.0.0-beta.10",
4
+ "description": "@qodalis/cli extension for making HTTP requests via a curl-like interface.",
5
5
  "author": "Nicolae Lupei, Qodalis Solutions",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/qodalis-solutions/angular-web-cli"
9
+ "url": "https://github.com/qodalis-solutions/web-cli"
10
10
  },
11
11
  "homepage": "https://qodalis.com",
12
12
  "keywords": [
13
- "angular",
14
13
  "cli",
15
14
  "qodalis",
16
15
  "terminal",
17
- "curl"
16
+ "curl",
17
+ "http",
18
+ "requests",
19
+ "fetch"
18
20
  ],
19
- "umd": "./umd/index.js",
20
- "unpkg": "./umd/index.js",
21
- "peerDependencies": {
22
- "@angular/common": "^16.2.0",
23
- "@angular/core": "^16.2.0"
24
- },
21
+ "umd": "./umd/index.global.js",
22
+ "unpkg": "./umd/index.global.js",
25
23
  "dependencies": {
26
- "tslib": "^2.3.0",
27
- "@qodalis/cli-core": "^0.0.16",
28
- "@qodalis/angular-cli": "^1.0.37"
24
+ "@qodalis/cli-core": "2.0.0-beta.10"
29
25
  },
30
26
  "sideEffects": false,
31
- "module": "fesm2022/qodalis-cli-curl.mjs",
32
- "typings": "index.d.ts",
27
+ "main": "./public-api.js",
28
+ "module": "./public-api.mjs",
29
+ "types": "./public-api.d.ts",
33
30
  "exports": {
34
- "./package.json": {
35
- "default": "./package.json"
36
- },
37
31
  ".": {
38
- "types": "./index.d.ts",
39
- "esm2022": "./esm2022/qodalis-cli-curl.mjs",
40
- "esm": "./esm2022/qodalis-cli-curl.mjs",
41
- "default": "./fesm2022/qodalis-cli-curl.mjs"
32
+ "types": "./public-api.d.ts",
33
+ "import": "./public-api.mjs",
34
+ "require": "./public-api.js"
42
35
  }
43
36
  }
44
- }
37
+ }
@@ -0,0 +1,87 @@
1
+ import * as _qodalis_cli_core from '@qodalis/cli-core';
2
+ import { ICliCommandProcessor, CliProcessorMetadata, ICliConfigurationOption, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
3
+
4
+ interface CurlRequestOptions {
5
+ method: string;
6
+ headers: Record<string, string>;
7
+ body?: string;
8
+ followRedirects: boolean;
9
+ }
10
+ interface CurlResponse {
11
+ status: number;
12
+ statusText: string;
13
+ headers: Record<string, string>;
14
+ body: string;
15
+ timing: number;
16
+ url: string;
17
+ redirected: boolean;
18
+ }
19
+ declare function inferMethod(explicitMethod?: string, hasBody?: boolean): string;
20
+ declare function parseHeaders(headerArgs: string | string[] | undefined): Record<string, string>;
21
+ declare function resolveBody(data?: string, dataRaw?: string): string | undefined;
22
+ declare function isJsonBody(body?: string): boolean;
23
+ declare function buildFetchOptions(options: CurlRequestOptions): RequestInit;
24
+ declare function formatResponseBody(body: string, pretty: boolean): string;
25
+ declare function rewriteUrlToProxy(originalUrl: string): string;
26
+ declare function buildCurlEquivalent(url: string, method: string, headers: Record<string, string>, body?: string): string;
27
+ declare function extractResponseHeaders(response: Response): Record<string, string>;
28
+
29
+ declare class CliCurlCommandProcessor implements ICliCommandProcessor {
30
+ command: string;
31
+ description: string;
32
+ author: _qodalis_cli_core.ICliCommandAuthor;
33
+ version: string;
34
+ valueRequired: boolean;
35
+ metadata?: CliProcessorMetadata;
36
+ configurationOptions?: ICliConfigurationOption[];
37
+ parameters: ({
38
+ name: string;
39
+ aliases: string[];
40
+ type: "string";
41
+ description: string;
42
+ required: boolean;
43
+ defaultValue?: undefined;
44
+ } | {
45
+ name: string;
46
+ aliases: string[];
47
+ type: "array";
48
+ description: string;
49
+ required: boolean;
50
+ defaultValue?: undefined;
51
+ } | {
52
+ name: string;
53
+ type: "string";
54
+ description: string;
55
+ required: boolean;
56
+ aliases?: undefined;
57
+ defaultValue?: undefined;
58
+ } | {
59
+ name: string;
60
+ aliases: string[];
61
+ type: "boolean";
62
+ description: string;
63
+ required: boolean;
64
+ defaultValue?: undefined;
65
+ } | {
66
+ name: string;
67
+ type: "boolean";
68
+ description: string;
69
+ required: boolean;
70
+ aliases?: undefined;
71
+ defaultValue?: undefined;
72
+ } | {
73
+ name: string;
74
+ type: "number";
75
+ description: string;
76
+ required: boolean;
77
+ defaultValue: string;
78
+ aliases?: undefined;
79
+ })[];
80
+ processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
81
+ writeDescription(context: ICliExecutionContext): void;
82
+ initialize(_context: ICliExecutionContext): Promise<void>;
83
+ }
84
+
85
+ declare const curlModule: ICliModule;
86
+
87
+ export { CliCurlCommandProcessor, type CurlRequestOptions, type CurlResponse, buildCurlEquivalent, buildFetchOptions, curlModule, extractResponseHeaders, formatResponseBody, inferMethod, isJsonBody, parseHeaders, resolveBody, rewriteUrlToProxy };
package/public-api.d.ts CHANGED
@@ -1,2 +1,87 @@
1
- export * from './lib/cli-curl.module';
2
- export * from './lib/processors/cli-curl-command-processor';
1
+ import * as _qodalis_cli_core from '@qodalis/cli-core';
2
+ import { ICliCommandProcessor, CliProcessorMetadata, ICliConfigurationOption, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
3
+
4
+ interface CurlRequestOptions {
5
+ method: string;
6
+ headers: Record<string, string>;
7
+ body?: string;
8
+ followRedirects: boolean;
9
+ }
10
+ interface CurlResponse {
11
+ status: number;
12
+ statusText: string;
13
+ headers: Record<string, string>;
14
+ body: string;
15
+ timing: number;
16
+ url: string;
17
+ redirected: boolean;
18
+ }
19
+ declare function inferMethod(explicitMethod?: string, hasBody?: boolean): string;
20
+ declare function parseHeaders(headerArgs: string | string[] | undefined): Record<string, string>;
21
+ declare function resolveBody(data?: string, dataRaw?: string): string | undefined;
22
+ declare function isJsonBody(body?: string): boolean;
23
+ declare function buildFetchOptions(options: CurlRequestOptions): RequestInit;
24
+ declare function formatResponseBody(body: string, pretty: boolean): string;
25
+ declare function rewriteUrlToProxy(originalUrl: string): string;
26
+ declare function buildCurlEquivalent(url: string, method: string, headers: Record<string, string>, body?: string): string;
27
+ declare function extractResponseHeaders(response: Response): Record<string, string>;
28
+
29
+ declare class CliCurlCommandProcessor implements ICliCommandProcessor {
30
+ command: string;
31
+ description: string;
32
+ author: _qodalis_cli_core.ICliCommandAuthor;
33
+ version: string;
34
+ valueRequired: boolean;
35
+ metadata?: CliProcessorMetadata;
36
+ configurationOptions?: ICliConfigurationOption[];
37
+ parameters: ({
38
+ name: string;
39
+ aliases: string[];
40
+ type: "string";
41
+ description: string;
42
+ required: boolean;
43
+ defaultValue?: undefined;
44
+ } | {
45
+ name: string;
46
+ aliases: string[];
47
+ type: "array";
48
+ description: string;
49
+ required: boolean;
50
+ defaultValue?: undefined;
51
+ } | {
52
+ name: string;
53
+ type: "string";
54
+ description: string;
55
+ required: boolean;
56
+ aliases?: undefined;
57
+ defaultValue?: undefined;
58
+ } | {
59
+ name: string;
60
+ aliases: string[];
61
+ type: "boolean";
62
+ description: string;
63
+ required: boolean;
64
+ defaultValue?: undefined;
65
+ } | {
66
+ name: string;
67
+ type: "boolean";
68
+ description: string;
69
+ required: boolean;
70
+ aliases?: undefined;
71
+ defaultValue?: undefined;
72
+ } | {
73
+ name: string;
74
+ type: "number";
75
+ description: string;
76
+ required: boolean;
77
+ defaultValue: string;
78
+ aliases?: undefined;
79
+ })[];
80
+ processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
81
+ writeDescription(context: ICliExecutionContext): void;
82
+ initialize(_context: ICliExecutionContext): Promise<void>;
83
+ }
84
+
85
+ declare const curlModule: ICliModule;
86
+
87
+ export { CliCurlCommandProcessor, type CurlRequestOptions, type CurlResponse, buildCurlEquivalent, buildFetchOptions, curlModule, extractResponseHeaders, formatResponseBody, inferMethod, isJsonBody, parseHeaders, resolveBody, rewriteUrlToProxy };
package/public-api.js ADDED
@@ -0,0 +1,399 @@
1
+ 'use strict';
2
+
3
+ var cliCore = require('@qodalis/cli-core');
4
+
5
+ // src/lib/utilities/index.ts
6
+ var VALID_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"];
7
+ function inferMethod(explicitMethod, hasBody) {
8
+ if (explicitMethod) {
9
+ const upper = explicitMethod.toUpperCase();
10
+ if (!VALID_METHODS.includes(upper)) {
11
+ throw new Error(`Invalid HTTP method: ${explicitMethod}. Valid methods: ${VALID_METHODS.join(", ")}`);
12
+ }
13
+ return upper;
14
+ }
15
+ return hasBody ? "POST" : "GET";
16
+ }
17
+ function parseHeaders(headerArgs) {
18
+ if (!headerArgs) return {};
19
+ const arr = Array.isArray(headerArgs) ? headerArgs : [headerArgs];
20
+ const result = {};
21
+ for (const header of arr) {
22
+ const colonIndex = header.indexOf(":");
23
+ if (colonIndex === -1) continue;
24
+ const key = header.substring(0, colonIndex).trim();
25
+ const value = header.substring(colonIndex + 1).trim();
26
+ if (key) result[key] = value;
27
+ }
28
+ return result;
29
+ }
30
+ function resolveBody(data, dataRaw) {
31
+ if (dataRaw != null) return dataRaw;
32
+ if (data == null) return void 0;
33
+ try {
34
+ return JSON.stringify(JSON.parse(data));
35
+ } catch {
36
+ return data;
37
+ }
38
+ }
39
+ function isJsonBody(body) {
40
+ if (!body) return false;
41
+ try {
42
+ JSON.parse(body);
43
+ return true;
44
+ } catch {
45
+ return false;
46
+ }
47
+ }
48
+ function buildFetchOptions(options) {
49
+ const headers = { ...options.headers };
50
+ if (options.body && !headers["Content-Type"] && isJsonBody(options.body)) {
51
+ headers["Content-Type"] = "application/json";
52
+ }
53
+ const init = {
54
+ method: options.method,
55
+ headers
56
+ };
57
+ if (options.body && options.method !== "GET" && options.method !== "HEAD") {
58
+ init.body = options.body;
59
+ }
60
+ if (!options.followRedirects) {
61
+ init.redirect = "manual";
62
+ }
63
+ return init;
64
+ }
65
+ function formatResponseBody(body, pretty) {
66
+ if (!pretty) return body;
67
+ try {
68
+ return JSON.stringify(JSON.parse(body), null, 2);
69
+ } catch {
70
+ return body;
71
+ }
72
+ }
73
+ function rewriteUrlToProxy(originalUrl) {
74
+ const match = originalUrl.match(/^(https?):\/\/([^\/]+)(\/.*)?$/i);
75
+ if (!match) {
76
+ throw new Error(`Invalid URL: ${originalUrl}`);
77
+ }
78
+ const scheme = match[1];
79
+ const domain = match[2];
80
+ const path = match[3] || "/";
81
+ return `https://proxy.qodalis.com/proxy/${scheme}/${domain}${path}`;
82
+ }
83
+ function buildCurlEquivalent(url, method, headers, body) {
84
+ const parts = ["curl"];
85
+ if (method !== "GET") {
86
+ parts.push(`-X ${method}`);
87
+ }
88
+ for (const [key, value] of Object.entries(headers)) {
89
+ parts.push(`-H '${key}: ${value}'`);
90
+ }
91
+ if (body) {
92
+ parts.push(`-d '${body}'`);
93
+ }
94
+ parts.push(`'${url}'`);
95
+ return parts.join(" ");
96
+ }
97
+ function extractResponseHeaders(response) {
98
+ const headers = {};
99
+ response.headers.forEach((value, key) => {
100
+ headers[key] = value;
101
+ });
102
+ return headers;
103
+ }
104
+
105
+ // src/lib/version.ts
106
+ var LIBRARY_VERSION = "2.0.0-beta.10";
107
+ var API_VERSION = 2;
108
+
109
+ // src/lib/processors/cli-curl-command-processor.ts
110
+ var CliCurlCommandProcessor = class {
111
+ constructor() {
112
+ this.command = "curl";
113
+ this.description = "Make HTTP requests from the terminal. Supports all HTTP methods, custom headers, request bodies, timeouts, and more.";
114
+ this.author = cliCore.DefaultLibraryAuthor;
115
+ this.version = LIBRARY_VERSION;
116
+ this.valueRequired = true;
117
+ this.metadata = {
118
+ icon: "\u{1F310}",
119
+ requiredCoreVersion: ">=2.0.0 <3.0.0",
120
+ requiredCliVersion: ">=2.0.0 <3.0.0"
121
+ };
122
+ this.configurationOptions = [
123
+ {
124
+ key: "defaultTimeout",
125
+ label: "Default Timeout",
126
+ description: "Default request timeout in milliseconds",
127
+ type: "number",
128
+ defaultValue: 3e4,
129
+ validator: (v) => ({
130
+ valid: typeof v === "number" && v >= 1e3 && v <= 3e5,
131
+ message: "Must be between 1000 and 300000 ms"
132
+ })
133
+ },
134
+ {
135
+ key: "prettyPrint",
136
+ label: "Pretty-Print JSON",
137
+ description: "Pretty-print JSON responses by default",
138
+ type: "boolean",
139
+ defaultValue: false
140
+ },
141
+ {
142
+ key: "verbose",
143
+ label: "Verbose Output",
144
+ description: "Show request/response headers by default",
145
+ type: "boolean",
146
+ defaultValue: false
147
+ }
148
+ ];
149
+ this.parameters = [
150
+ {
151
+ name: "request",
152
+ aliases: ["X"],
153
+ type: "string",
154
+ description: "HTTP method (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS)",
155
+ required: false
156
+ },
157
+ {
158
+ name: "header",
159
+ aliases: ["H"],
160
+ type: "array",
161
+ description: "Add header, e.g. -H 'Content-Type: application/json' (repeatable)",
162
+ required: false
163
+ },
164
+ {
165
+ name: "data",
166
+ aliases: ["d"],
167
+ type: "string",
168
+ description: "Request body (auto-detects JSON, sets method to POST if -X not given)",
169
+ required: false
170
+ },
171
+ {
172
+ name: "data-raw",
173
+ type: "string",
174
+ description: "Request body sent as-is without JSON parsing",
175
+ required: false
176
+ },
177
+ {
178
+ name: "verbose",
179
+ aliases: ["v"],
180
+ type: "boolean",
181
+ description: "Show request/response headers and timing",
182
+ required: false
183
+ },
184
+ {
185
+ name: "pretty",
186
+ type: "boolean",
187
+ description: "Pretty-print JSON response body",
188
+ required: false
189
+ },
190
+ {
191
+ name: "timeout",
192
+ type: "number",
193
+ description: "Request timeout in milliseconds (default: 30000)",
194
+ required: false,
195
+ defaultValue: "30000"
196
+ },
197
+ {
198
+ name: "location",
199
+ aliases: ["L"],
200
+ type: "boolean",
201
+ description: "Follow redirects (default: true)",
202
+ required: false
203
+ },
204
+ {
205
+ name: "proxy",
206
+ type: "boolean",
207
+ description: "Route request through proxy.qodalis.com (bypasses CORS)",
208
+ required: false
209
+ },
210
+ {
211
+ name: "silent",
212
+ aliases: ["s"],
213
+ type: "boolean",
214
+ description: "Only output response body (no status line)",
215
+ required: false
216
+ }
217
+ ];
218
+ }
219
+ async processCommand(command, context) {
220
+ const url = command.value;
221
+ if (!url) {
222
+ context.writer.writeError("URL is required. Usage: curl <url> [options]");
223
+ context.process.exit(1);
224
+ return;
225
+ }
226
+ const args = command.args;
227
+ const cfgTimeout = cliCore.getPluginConfigValue(context, "curl", "defaultTimeout", 3e4);
228
+ const cfgPretty = cliCore.getPluginConfigValue(context, "curl", "prettyPrint", false);
229
+ const cfgVerbose = cliCore.getPluginConfigValue(context, "curl", "verbose", false);
230
+ const explicitMethod = args["request"] || args["X"];
231
+ const data = args["data"] || args["d"];
232
+ const dataRaw = args["data-raw"];
233
+ const hasBody = data != null || dataRaw != null;
234
+ const verbose = args["verbose"] != null || args["v"] != null ? !!args["verbose"] || !!args["v"] : cfgVerbose;
235
+ const pretty = args["pretty"] != null ? !!args["pretty"] : cfgPretty;
236
+ const silent = !!args["silent"] || !!args["s"];
237
+ const useProxy = !!args["proxy"];
238
+ const timeout = parseInt(args["timeout"] || String(cfgTimeout), 10);
239
+ const followRedirects = args["location"] !== false && args["L"] !== false;
240
+ let method;
241
+ try {
242
+ method = inferMethod(explicitMethod, hasBody);
243
+ } catch (e) {
244
+ context.writer.writeError(e.message);
245
+ context.process.exit(1);
246
+ return;
247
+ }
248
+ const headers = parseHeaders(args["header"] || args["H"]);
249
+ const body = resolveBody(data, dataRaw);
250
+ const requestUrl = useProxy ? rewriteUrlToProxy(url) : url;
251
+ const fetchOptions = buildFetchOptions({
252
+ method,
253
+ headers,
254
+ body,
255
+ followRedirects
256
+ });
257
+ if (verbose) {
258
+ context.writer.writeln(
259
+ `> ${context.writer.wrapInColor(`${method} ${url}`, cliCore.CliForegroundColor.Cyan)}`
260
+ );
261
+ for (const [key, value] of Object.entries(headers)) {
262
+ context.writer.writeln(
263
+ `> ${context.writer.wrapInColor(`${key}: ${value}`, cliCore.CliForegroundColor.Yellow)}`
264
+ );
265
+ }
266
+ if (body) {
267
+ context.writer.writeln(`> Body: ${body}`);
268
+ }
269
+ context.writer.writeln();
270
+ }
271
+ const controller = new AbortController();
272
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
273
+ fetchOptions.signal = controller.signal;
274
+ const startTime = performance.now();
275
+ try {
276
+ const response = await fetch(requestUrl, fetchOptions);
277
+ const elapsed = Math.round(performance.now() - startTime);
278
+ const responseText = await response.text();
279
+ const responseHeaders = extractResponseHeaders(response);
280
+ const curlResponse = {
281
+ status: response.status,
282
+ statusText: response.statusText,
283
+ headers: responseHeaders,
284
+ body: responseText,
285
+ timing: elapsed,
286
+ url: response.url,
287
+ redirected: response.redirected
288
+ };
289
+ if (!silent) {
290
+ const statusColor = response.ok ? cliCore.CliForegroundColor.Green : cliCore.CliForegroundColor.Red;
291
+ context.writer.writeln(
292
+ context.writer.wrapInColor(
293
+ `HTTP ${response.status} ${response.statusText}`,
294
+ statusColor
295
+ )
296
+ );
297
+ }
298
+ if (verbose) {
299
+ context.writer.writeln();
300
+ for (const [key, value] of Object.entries(responseHeaders)) {
301
+ context.writer.writeln(
302
+ `< ${context.writer.wrapInColor(`${key}: ${value}`, cliCore.CliForegroundColor.Yellow)}`
303
+ );
304
+ }
305
+ context.writer.writeln(
306
+ `< ${context.writer.wrapInColor(`Time: ${elapsed}ms`, cliCore.CliForegroundColor.Magenta)}`
307
+ );
308
+ if (response.redirected) {
309
+ context.writer.writeln(
310
+ `< ${context.writer.wrapInColor(`Redirected to: ${response.url}`, cliCore.CliForegroundColor.Cyan)}`
311
+ );
312
+ }
313
+ context.writer.writeln();
314
+ }
315
+ const formattedBody = formatResponseBody(responseText, pretty);
316
+ if (formattedBody) {
317
+ context.writer.writeln(formattedBody);
318
+ }
319
+ if (verbose) {
320
+ context.writer.writeln();
321
+ context.writer.writeInfo("Equivalent curl command:");
322
+ context.writer.writeln(buildCurlEquivalent(url, method, headers, body));
323
+ }
324
+ context.process.output(curlResponse);
325
+ } catch (error) {
326
+ if (error.name === "AbortError") {
327
+ context.writer.writeError(`Request timed out after ${timeout}ms`);
328
+ } else {
329
+ context.writer.writeError(`Request failed: ${error.message}`);
330
+ }
331
+ context.process.exit(1);
332
+ } finally {
333
+ clearTimeout(timeoutId);
334
+ }
335
+ }
336
+ writeDescription(context) {
337
+ const { writer } = context;
338
+ writer.writeln(this.description);
339
+ writer.writeln();
340
+ writer.writeln(writer.wrapInColor("Usage:", cliCore.CliForegroundColor.Yellow));
341
+ writer.writeln(` curl <url> [options]`);
342
+ writer.writeln();
343
+ writer.writeln(writer.wrapInColor("Options:", cliCore.CliForegroundColor.Yellow));
344
+ writer.writeln(` ${writer.wrapInColor("-X, --request <METHOD>", cliCore.CliForegroundColor.Cyan)} HTTP method (default: GET, or POST if -d given)`);
345
+ writer.writeln(` ${writer.wrapInColor("-H, --header <header>", cliCore.CliForegroundColor.Cyan)} Add header (repeatable)`);
346
+ writer.writeln(` ${writer.wrapInColor("-d, --data <body>", cliCore.CliForegroundColor.Cyan)} Request body (auto-detects JSON)`);
347
+ writer.writeln(` ${writer.wrapInColor("--data-raw <body>", cliCore.CliForegroundColor.Cyan)} Request body as-is`);
348
+ writer.writeln(` ${writer.wrapInColor("-v, --verbose", cliCore.CliForegroundColor.Cyan)} Show headers and timing`);
349
+ writer.writeln(` ${writer.wrapInColor("--pretty", cliCore.CliForegroundColor.Cyan)} Pretty-print JSON response`);
350
+ writer.writeln(` ${writer.wrapInColor("--timeout <ms>", cliCore.CliForegroundColor.Cyan)} Timeout in ms (default: 30000)`);
351
+ writer.writeln(` ${writer.wrapInColor("-L, --location", cliCore.CliForegroundColor.Cyan)} Follow redirects (default: true)`);
352
+ writer.writeln(` ${writer.wrapInColor("--proxy", cliCore.CliForegroundColor.Cyan)} Route through CORS proxy`);
353
+ writer.writeln(` ${writer.wrapInColor("-s, --silent", cliCore.CliForegroundColor.Cyan)} Only output body`);
354
+ writer.writeln();
355
+ writer.writeln(writer.wrapInColor("Examples:", cliCore.CliForegroundColor.Yellow));
356
+ writer.writeln(` curl https://api.example.com/users`);
357
+ writer.writeln(` curl https://api.example.com/users -X POST -d '{"name":"John"}' -H 'Content-Type: application/json'`);
358
+ writer.writeln(` curl https://api.example.com/users -v --pretty`);
359
+ writer.writeln(` curl https://api.example.com/status -X HEAD`);
360
+ writer.writeln(` curl https://api.example.com/data --proxy --timeout 5000`);
361
+ writer.writeln();
362
+ writer.writeWarning("The server must allow CORS for this tool to work. Use --proxy to bypass CORS restrictions.");
363
+ }
364
+ async initialize(_context) {
365
+ }
366
+ };
367
+
368
+ // src/public-api.ts
369
+ var curlModule = {
370
+ apiVersion: API_VERSION,
371
+ name: "@qodalis/cli-curl",
372
+ processors: [new CliCurlCommandProcessor()],
373
+ translations: {
374
+ es: { "cli.curl.description": "Realizar solicitudes HTTP desde la terminal" },
375
+ fr: { "cli.curl.description": "Effectuer des requ\xEAtes HTTP depuis le terminal" },
376
+ de: { "cli.curl.description": "HTTP-Anfragen vom Terminal ausf\xFChren" },
377
+ pt: { "cli.curl.description": "Fazer requisi\xE7\xF5es HTTP pelo terminal" },
378
+ it: { "cli.curl.description": "Eseguire richieste HTTP dal terminale" },
379
+ ja: { "cli.curl.description": "\u30BF\u30FC\u30DF\u30CA\u30EB\u304B\u3089HTTP\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u5B9F\u884C" },
380
+ ko: { "cli.curl.description": "\uD130\uBBF8\uB110\uC5D0\uC11C HTTP \uC694\uCCAD \uC218\uD589" },
381
+ zh: { "cli.curl.description": "\u4ECE\u7EC8\u7AEF\u53D1\u9001 HTTP \u8BF7\u6C42" },
382
+ ru: { "cli.curl.description": "\u0412\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435 HTTP-\u0437\u0430\u043F\u0440\u043E\u0441\u043E\u0432 \u0438\u0437 \u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B\u0430" },
383
+ ro: { "cli.curl.description": "Efectueaz\u0103 cereri HTTP din terminal" }
384
+ }
385
+ };
386
+
387
+ exports.CliCurlCommandProcessor = CliCurlCommandProcessor;
388
+ exports.buildCurlEquivalent = buildCurlEquivalent;
389
+ exports.buildFetchOptions = buildFetchOptions;
390
+ exports.curlModule = curlModule;
391
+ exports.extractResponseHeaders = extractResponseHeaders;
392
+ exports.formatResponseBody = formatResponseBody;
393
+ exports.inferMethod = inferMethod;
394
+ exports.isJsonBody = isJsonBody;
395
+ exports.parseHeaders = parseHeaders;
396
+ exports.resolveBody = resolveBody;
397
+ exports.rewriteUrlToProxy = rewriteUrlToProxy;
398
+ //# sourceMappingURL=public-api.js.map
399
+ //# sourceMappingURL=public-api.js.map