@scalar/snippetz 0.2.11 → 0.2.12

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/dist/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export { snippetz } from './snippetz.js';
2
+ export { AVAILABLE_CLIENTS } from './types/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"http11.d.ts","sourceRoot":"","sources":["../../../../src/plugins/http/http11/http11.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAQxB,CAAA"}
1
+ {"version":3,"file":"http11.d.ts","sourceRoot":"","sources":["../../../../src/plugins/http/http11/http11.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAqIxB,CAAA"}
@@ -1,6 +1,3 @@
1
- import { http11 } from '../../../httpsnippet-lite/esm/targets/http/http1.1/client.js';
2
- import { convertWithHttpSnippetLite } from '../../../utils/convertWithHttpSnippetLite.js';
3
-
4
1
  /**
5
2
  * http/http1.1
6
3
  */
@@ -9,8 +6,105 @@ const httpHttp11 = {
9
6
  client: 'http1.1',
10
7
  title: 'HTTP/1.1',
11
8
  generate(request) {
12
- // TODO: Write an own converter
13
- return convertWithHttpSnippetLite(http11, request);
9
+ // Defaults
10
+ const normalizedRequest = {
11
+ method: 'GET',
12
+ headers: [],
13
+ queryString: [],
14
+ ...request,
15
+ };
16
+ // Normalize method
17
+ normalizedRequest.method = normalizedRequest.method.toUpperCase();
18
+ // Parse URL with error handling
19
+ let url;
20
+ let path;
21
+ try {
22
+ url = new URL(normalizedRequest.url || 'http://');
23
+ path = url.pathname + (url.search || '');
24
+ }
25
+ catch (error) {
26
+ // Oops, got an invalid URL, use the provided URL directly.
27
+ path = normalizedRequest.url || '/';
28
+ }
29
+ const hostname = url?.hostname || 'UNKNOWN_HOSTNAME';
30
+ // Start building the request
31
+ let requestString = `${normalizedRequest.method} ${path} HTTP/1.1\r\n`;
32
+ // Handle query string parameters
33
+ if (normalizedRequest.queryString.length) {
34
+ const queryString = normalizedRequest.queryString
35
+ .map((param) => `${encodeURIComponent(param.name)}=${encodeURIComponent(param.value)}`)
36
+ .join('&');
37
+ // Append query string to the path
38
+ requestString = `${normalizedRequest.method} ${path}?${queryString} HTTP/1.1\r\n`;
39
+ }
40
+ // Store all headers
41
+ const headers = new Map();
42
+ // Host header
43
+ headers.set('Host', hostname);
44
+ // Passed headers
45
+ normalizedRequest.headers.forEach((header) => {
46
+ if (headers.has(header.name)) {
47
+ headers.set(header.name, `${headers.get(header.name)}, ${header.value}`);
48
+ }
49
+ else {
50
+ headers.set(header.name, header.value);
51
+ }
52
+ });
53
+ // Query string parameters
54
+ if (normalizedRequest.queryString.length) {
55
+ const queryString = normalizedRequest.queryString
56
+ .map((param) => `${encodeURIComponent(param.name)}=${encodeURIComponent(param.value)}`)
57
+ .join('&');
58
+ // Append query string to the path
59
+ requestString = `${normalizedRequest.method} ${path}?${queryString} HTTP/1.1\r\n`;
60
+ }
61
+ // Request body
62
+ let body = '';
63
+ if (normalizedRequest.postData) {
64
+ // Always set the Content-Type header based on postData.mimeType
65
+ if (normalizedRequest.postData.mimeType === 'application/json' &&
66
+ normalizedRequest.postData.text) {
67
+ headers.set('Content-Type', 'application/json');
68
+ body = normalizedRequest.postData.text;
69
+ }
70
+ else if (normalizedRequest.postData.mimeType === 'application/octet-stream' &&
71
+ normalizedRequest.postData.text) {
72
+ headers.set('Content-Type', 'application/octet-stream');
73
+ body = normalizedRequest.postData.text;
74
+ }
75
+ else if (normalizedRequest.postData.mimeType ===
76
+ 'application/x-www-form-urlencoded' &&
77
+ normalizedRequest.postData.params) {
78
+ const formData = normalizedRequest.postData.params
79
+ .map((param) => `${encodeURIComponent(param.name)}=${encodeURIComponent(param.value ?? '')}`)
80
+ .join('&');
81
+ headers.set('Content-Type', 'application/x-www-form-urlencoded');
82
+ body = formData;
83
+ }
84
+ else if (normalizedRequest.postData.mimeType === 'multipart/form-data' &&
85
+ normalizedRequest.postData.params) {
86
+ const boundary = '----WebKitFormBoundary7MA4YWxkTrZu0gW';
87
+ headers.set('Content-Type', `multipart/form-data; boundary=${boundary}`);
88
+ body =
89
+ normalizedRequest.postData.params
90
+ .map((param) => {
91
+ if (param.fileName) {
92
+ return `--${boundary}\r\nContent-Disposition: form-data; name="${param.name}"; filename="${param.fileName}"\r\n\r\n`;
93
+ }
94
+ else {
95
+ return `--${boundary}\r\nContent-Disposition: form-data; name="${param.name}"\r\n\r\n${param.value}\r\n`;
96
+ }
97
+ })
98
+ .join('') + `--${boundary}--\r\n`;
99
+ }
100
+ }
101
+ // Add headers to requestString
102
+ headers.forEach((value, name) => {
103
+ requestString += `${name}: ${value}\r\n`;
104
+ });
105
+ // Add body to requestString
106
+ requestString += `\r\n${body}`;
107
+ return requestString;
14
108
  },
15
109
  };
16
110
 
@@ -3,43 +3,8 @@ export type { Request as HarRequest } from 'har-format';
3
3
  /**
4
4
  * List of available clients
5
5
  */
6
- export type AvailableClients = [
7
- 'c/libcurl',
8
- 'clojure/clj_http',
9
- 'csharp/httpclient',
10
- 'csharp/restsharp',
11
- 'go/native',
12
- 'http/http1.1',
13
- 'java/asynchttp',
14
- 'java/nethttp',
15
- 'java/okhttp',
16
- 'java/unirest',
17
- 'js/axios',
18
- 'js/fetch',
19
- 'js/jquery',
20
- 'js/ofetch',
21
- 'js/xhr',
22
- 'kotlin/okhttp',
23
- 'node/axios',
24
- 'node/fetch',
25
- 'node/ofetch',
26
- 'node/undici',
27
- 'objc/nsurlsession',
28
- 'ocaml/cohttp',
29
- 'php/curl',
30
- 'php/guzzle',
31
- 'powershell/restmethod',
32
- 'powershell/webrequest',
33
- 'python/python3',
34
- 'python/requests',
35
- 'r/httr',
36
- 'ruby/native',
37
- 'shell/curl',
38
- 'shell/httpie',
39
- 'shell/wget',
40
- 'swift/nsurlsession',
41
- 'dart/http'
42
- ];
6
+ export declare const AVAILABLE_CLIENTS: readonly ["c/libcurl", "clojure/clj_http", "csharp/httpclient", "csharp/restsharp", "go/native", "http/http1.1", "java/asynchttp", "java/nethttp", "java/okhttp", "java/unirest", "js/axios", "js/fetch", "js/jquery", "js/ofetch", "js/xhr", "kotlin/okhttp", "node/axios", "node/fetch", "node/ofetch", "node/undici", "objc/nsurlsession", "ocaml/cohttp", "php/curl", "php/guzzle", "powershell/restmethod", "powershell/webrequest", "python/python3", "python/requests", "r/httr", "ruby/native", "shell/curl", "shell/httpie", "shell/wget", "swift/nsurlsession", "dart/http"];
7
+ export type AvailableClients = typeof AVAILABLE_CLIENTS;
43
8
  /** Programming language */
44
9
  export type TargetId = AvailableClients[number] extends `${infer T}/${string}` ? T : never;
45
10
  /** Configuration for a target */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD,YAAY,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW;IACX,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,WAAW;IACX,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,aAAa;IACb,cAAc;IACd,UAAU;IACV,UAAU;IACV,WAAW;IACX,WAAW;IACX,QAAQ;IACR,eAAe;IACf,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,aAAa;IACb,mBAAmB;IACnB,cAAc;IACd,UAAU;IACV,YAAY;IACZ,uBAAuB;IACvB,uBAAuB;IACvB,gBAAgB;IAChB,iBAAiB;IACjB,QAAQ;IACR,aAAa;IACb,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,oBAAoB;IACpB,WAAW;CACZ,CA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AAA;CACZ,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,mDAAmD;IACnD,IAAI,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAC9C,CAAA"}
@@ -1 +1,42 @@
1
+ /**
2
+ * List of available clients
3
+ */
4
+ const AVAILABLE_CLIENTS = [
5
+ 'c/libcurl',
6
+ 'clojure/clj_http',
7
+ 'csharp/httpclient',
8
+ 'csharp/restsharp',
9
+ 'go/native',
10
+ 'http/http1.1',
11
+ 'java/asynchttp',
12
+ 'java/nethttp',
13
+ 'java/okhttp',
14
+ 'java/unirest',
15
+ 'js/axios',
16
+ 'js/fetch',
17
+ 'js/jquery',
18
+ 'js/ofetch',
19
+ 'js/xhr',
20
+ 'kotlin/okhttp',
21
+ 'node/axios',
22
+ 'node/fetch',
23
+ 'node/ofetch',
24
+ 'node/undici',
25
+ 'objc/nsurlsession',
26
+ 'ocaml/cohttp',
27
+ 'php/curl',
28
+ 'php/guzzle',
29
+ 'powershell/restmethod',
30
+ 'powershell/webrequest',
31
+ 'python/python3',
32
+ 'python/requests',
33
+ 'r/httr',
34
+ 'ruby/native',
35
+ 'shell/curl',
36
+ 'shell/httpie',
37
+ 'shell/wget',
38
+ 'swift/nsurlsession',
39
+ 'dart/http',
40
+ ];
1
41
 
42
+ export { AVAILABLE_CLIENTS };
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "url": "git+https://github.com/scalar/scalar.git",
10
10
  "directory": "packages/snippetz"
11
11
  },
12
- "version": "0.2.11",
12
+ "version": "0.2.12",
13
13
  "engines": {
14
14
  "node": ">=18"
15
15
  },
@@ -1,10 +0,0 @@
1
- export { CodeBuilder } from './helpers/code-builder.js';
2
- export { availableTargets, extname } from './helpers/utils.js';
3
- export { isClient, isTarget } from './targets/targets.js';
4
- export { addTarget, addTargetClient, isValidTargetId, } from './targets/targets.js';
5
- export declare class HTTPSnippet {
6
- constructor(input: any);
7
- prepare(harRequest: any): Promise<any>;
8
- convert(targetId: any, clientId: any, options: any): Promise<any>;
9
- }
10
- //# sourceMappingURL=httpsnippet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"httpsnippet.d.ts","sourceRoot":"","sources":["../../../src/httpsnippet-lite/esm/httpsnippet.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EACL,SAAS,EACT,eAAe,EACf,eAAe,GAChB,MAAM,sBAAsB,CAAA;AAW7B,qBAAa,WAAW;gBACV,KAAK,KAAA;IAmCX,OAAO,CAAC,UAAU,KAAA;IAsJlB,OAAO,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA,EAAE,OAAO,KAAA;CAc1C"}
@@ -1,22 +0,0 @@
1
- /**
2
- * Request follows the request message format in accordance to RFC 7230, Section 3.
3
- * Each section is prepended with the RFC and section number.
4
- * See more at https://tools.ietf.org/html/rfc7230#section-3.
5
- */
6
- export declare const http11: {
7
- info: {
8
- key: string;
9
- title: string;
10
- link: string;
11
- description: string;
12
- };
13
- convert: ({ method, fullUrl, uriObj, httpVersion, allHeaders, postData }: {
14
- method: any;
15
- fullUrl: any;
16
- uriObj: any;
17
- httpVersion: any;
18
- allHeaders: any;
19
- postData: any;
20
- }, options: any) => string;
21
- };
22
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/http/http1.1/client.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;CA4DlB,CAAA"}
@@ -1,77 +0,0 @@
1
- import { CodeBuilder } from '../../../helpers/code-builder.js';
2
-
3
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
- // @ts-nocheck
5
- /**
6
- * @description
7
- * HTTP code snippet generator to generate raw HTTP/1.1 request strings,
8
- * in accordance to the RFC 7230 (and RFC 7231) specifications.
9
- *
10
- * @author
11
- * @irvinlim
12
- *
13
- * For any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
14
- */
15
- const CRLF = '\r\n';
16
- /**
17
- * Request follows the request message format in accordance to RFC 7230, Section 3.
18
- * Each section is prepended with the RFC and section number.
19
- * See more at https://tools.ietf.org/html/rfc7230#section-3.
20
- */
21
- const http11 = {
22
- info: {
23
- key: 'http1.1',
24
- title: 'HTTP/1.1',
25
- link: 'https://tools.ietf.org/html/rfc7230',
26
- description: 'HTTP/1.1 request string in accordance with RFC 7230',
27
- },
28
- convert: ({ method, fullUrl, uriObj, httpVersion, allHeaders, postData }, options) => {
29
- const opts = {
30
- absoluteURI: false,
31
- autoContentLength: true,
32
- autoHost: true,
33
- ...options,
34
- };
35
- // RFC 7230 Section 3. Message Format
36
- // All lines have no indentation, and should be terminated with CRLF.
37
- const { blank, push, join } = new CodeBuilder({ indent: '', join: CRLF });
38
- // RFC 7230 Section 5.3. Request Target
39
- // Determines if the Request-Line should use 'absolute-form' or 'origin-form'.
40
- // Basically it means whether the "http://domain.com" will prepend the full url.
41
- const requestUrl = opts.absoluteURI ? fullUrl : uriObj.path;
42
- // RFC 7230 Section 3.1.1. Request-Line
43
- push(`${method} ${requestUrl} ${httpVersion}`);
44
- const headerKeys = Object.keys(allHeaders);
45
- // RFC 7231 Section 5. Header Fields
46
- headerKeys.forEach((key) => {
47
- // Capitalize header keys, even though it's not required by the spec.
48
- const keyCapitalized = key
49
- .toLowerCase()
50
- .replace(/(^|-)(\w)/g, (input) => input.toUpperCase());
51
- push(`${keyCapitalized}: ${allHeaders[key]}`);
52
- });
53
- // RFC 7230 Section 5.4. Host
54
- // Automatically set Host header if option is on and on header already exists.
55
- if (opts.autoHost && !headerKeys.includes('host')) {
56
- push(`Host: ${uriObj.host}`);
57
- }
58
- // RFC 7230 Section 3.3.3. Message Body Length
59
- // Automatically set Content-Length header if option is on, postData is present and no header already exists.
60
- if (opts.autoContentLength &&
61
- (postData === null || postData === void 0 ? void 0 : postData.text) &&
62
- !headerKeys.includes('content-length')) {
63
- push(`Content-Length: ${postData.text.length}`);
64
- }
65
- // Add extra line after header section.
66
- blank();
67
- // Separate header section and message body section.
68
- const headerSection = join();
69
- // RFC 7230 Section 3.3. Message Body
70
- const messageBody = (postData === null || postData === void 0 ? void 0 : postData.text) || '';
71
- // RFC 7230 Section 3. Message Format
72
- // Extra CRLF separating the headers from the body.
73
- return `${headerSection}${CRLF}${messageBody}`;
74
- },
75
- };
76
-
77
- export { http11 };
@@ -1,27 +0,0 @@
1
- export declare const http: {
2
- info: {
3
- key: string;
4
- title: string;
5
- extname: null;
6
- default: string;
7
- };
8
- clientsById: {
9
- 'http1.1': {
10
- info: {
11
- key: string;
12
- title: string;
13
- link: string;
14
- description: string;
15
- };
16
- convert: ({ method, fullUrl, uriObj, httpVersion, allHeaders, postData }: {
17
- method: any;
18
- fullUrl: any;
19
- uriObj: any;
20
- httpVersion: any;
21
- allHeaders: any;
22
- postData: any;
23
- }, options: any) => string;
24
- };
25
- };
26
- };
27
- //# sourceMappingURL=target.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/esm/targets/http/target.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;CAUhB,CAAA"}
@@ -1,731 +0,0 @@
1
- export declare const targets: {
2
- c: {
3
- info: {
4
- key: string;
5
- title: string;
6
- extname: string;
7
- default: string;
8
- };
9
- clientsById: {
10
- libcurl: {
11
- info: {
12
- key: string;
13
- title: string;
14
- link: string;
15
- description: string;
16
- };
17
- convert: ({ method, fullUrl, headersObj, allHeaders, postData }: {
18
- method: any;
19
- fullUrl: any;
20
- headersObj: any;
21
- allHeaders: any;
22
- postData: any;
23
- }) => any;
24
- };
25
- };
26
- };
27
- clojure: {
28
- info: {
29
- key: string;
30
- title: string;
31
- extname: string;
32
- default: string;
33
- };
34
- clientsById: {
35
- clj_http: {
36
- info: {
37
- key: string;
38
- title: string;
39
- link: string;
40
- description: string;
41
- };
42
- convert: ({ queryObj, method, postData, url, allHeaders }: {
43
- queryObj: any;
44
- method: any;
45
- postData: any;
46
- url: any;
47
- allHeaders: any;
48
- }, options: any) => any;
49
- };
50
- };
51
- };
52
- csharp: {
53
- info: {
54
- key: string;
55
- title: string;
56
- extname: string;
57
- default: string;
58
- };
59
- clientsById: {
60
- httpclient: {
61
- info: {
62
- key: string;
63
- title: string;
64
- link: string;
65
- description: string;
66
- };
67
- convert: ({ allHeaders, postData, method, fullUrl }: {
68
- allHeaders: any;
69
- postData: any;
70
- method: any;
71
- fullUrl: any;
72
- }, options: any) => any;
73
- };
74
- restsharp: {
75
- info: {
76
- key: string;
77
- title: string;
78
- link: string;
79
- description: string;
80
- };
81
- convert: ({ allHeaders, method, fullUrl, headersObj, cookies, postData }: {
82
- allHeaders: any;
83
- method: any;
84
- fullUrl: any;
85
- headersObj: any;
86
- cookies: any;
87
- postData: any;
88
- }) => any;
89
- };
90
- };
91
- };
92
- go: {
93
- info: {
94
- key: string;
95
- title: string;
96
- extname: string;
97
- default: string;
98
- };
99
- clientsById: {
100
- native: {
101
- info: {
102
- key: string;
103
- title: string;
104
- link: string;
105
- description: string;
106
- };
107
- convert: ({ postData, method, allHeaders, fullUrl }: {
108
- postData: any;
109
- method: any;
110
- allHeaders: any;
111
- fullUrl: any;
112
- }, options?: {}) => any;
113
- };
114
- };
115
- };
116
- http: {
117
- info: {
118
- key: string;
119
- title: string;
120
- extname: null;
121
- default: string;
122
- };
123
- clientsById: {
124
- 'http1.1': {
125
- info: {
126
- key: string;
127
- title: string;
128
- link: string;
129
- description: string;
130
- };
131
- convert: ({ method, fullUrl, uriObj, httpVersion, allHeaders, postData }: {
132
- method: any;
133
- fullUrl: any;
134
- uriObj: any;
135
- httpVersion: any;
136
- allHeaders: any;
137
- postData: any;
138
- }, options: any) => string;
139
- };
140
- };
141
- };
142
- java: {
143
- info: {
144
- key: string;
145
- title: string;
146
- extname: string;
147
- default: string;
148
- };
149
- clientsById: {
150
- asynchttp: {
151
- info: {
152
- key: string;
153
- title: string;
154
- link: string;
155
- description: string;
156
- };
157
- convert: ({ method, allHeaders, postData, fullUrl }: {
158
- method: any;
159
- allHeaders: any;
160
- postData: any;
161
- fullUrl: any;
162
- }, options: any) => any;
163
- };
164
- nethttp: {
165
- info: {
166
- key: string;
167
- title: string;
168
- link: string;
169
- description: string;
170
- };
171
- convert: ({ allHeaders, fullUrl, method, postData }: {
172
- allHeaders: any;
173
- fullUrl: any;
174
- method: any;
175
- postData: any;
176
- }, options: any) => any;
177
- };
178
- okhttp: {
179
- info: {
180
- key: string;
181
- title: string;
182
- link: string;
183
- description: string;
184
- };
185
- convert: ({ postData, method, fullUrl, allHeaders }: {
186
- postData: any;
187
- method: any;
188
- fullUrl: any;
189
- allHeaders: any;
190
- }, options: any) => any;
191
- };
192
- unirest: {
193
- info: {
194
- key: string;
195
- title: string;
196
- link: string;
197
- description: string;
198
- };
199
- convert: ({ method, allHeaders, postData, fullUrl }: {
200
- method: any;
201
- allHeaders: any;
202
- postData: any;
203
- fullUrl: any;
204
- }, options: any) => any;
205
- };
206
- };
207
- };
208
- javascript: {
209
- info: {
210
- key: string;
211
- title: string;
212
- extname: string;
213
- default: string;
214
- };
215
- clientsById: {
216
- xhr: {
217
- info: {
218
- key: string;
219
- title: string;
220
- link: string;
221
- description: string;
222
- };
223
- convert: ({ postData, allHeaders, method, fullUrl }: {
224
- postData: any;
225
- allHeaders: any;
226
- method: any;
227
- fullUrl: any;
228
- }, options: any) => any;
229
- };
230
- axios: {
231
- info: {
232
- key: string;
233
- title: string;
234
- link: string;
235
- description: string;
236
- };
237
- convert: ({ allHeaders, method, url, queryObj, postData }: {
238
- allHeaders: any;
239
- method: any;
240
- url: any;
241
- queryObj: any;
242
- postData: any;
243
- }, options: any) => any;
244
- };
245
- fetch: {
246
- info: {
247
- key: string;
248
- title: string;
249
- link: string;
250
- description: string;
251
- };
252
- convert: ({ method, allHeaders, postData, fullUrl }: {
253
- method: any;
254
- allHeaders: any;
255
- postData: any;
256
- fullUrl: any;
257
- }, inputOpts: any) => any;
258
- };
259
- jquery: {
260
- info: {
261
- key: string;
262
- title: string;
263
- link: string;
264
- description: string;
265
- };
266
- convert: ({ fullUrl, method, allHeaders, postData }: {
267
- fullUrl: any;
268
- method: any;
269
- allHeaders: any;
270
- postData: any;
271
- }, options: any) => any;
272
- };
273
- };
274
- };
275
- kotlin: {
276
- info: {
277
- key: string;
278
- title: string;
279
- extname: string;
280
- default: string;
281
- };
282
- clientsById: {
283
- okhttp: {
284
- info: {
285
- key: string;
286
- title: string;
287
- link: string;
288
- description: string;
289
- };
290
- convert: ({ postData, fullUrl, method, allHeaders }: {
291
- postData: any;
292
- fullUrl: any;
293
- method: any;
294
- allHeaders: any;
295
- }, options: any) => any;
296
- };
297
- };
298
- };
299
- node: {
300
- info: {
301
- key: string;
302
- title: string;
303
- extname: string;
304
- default: string;
305
- };
306
- clientsById: {
307
- native: {
308
- info: {
309
- key: string;
310
- title: string;
311
- link: string;
312
- description: string;
313
- };
314
- convert: ({ uriObj, method, allHeaders, postData }: {
315
- uriObj: any;
316
- method: any;
317
- allHeaders: any;
318
- postData: any;
319
- }, options?: {}) => any;
320
- };
321
- request: {
322
- info: {
323
- key: string;
324
- title: string;
325
- link: string;
326
- description: string;
327
- };
328
- convert: ({ method, url, queryObj, postData, headersObj, cookies }: {
329
- method: any;
330
- url: any;
331
- queryObj: any;
332
- postData: any;
333
- headersObj: any;
334
- cookies: any;
335
- }, options: any) => any;
336
- };
337
- unirest: {
338
- info: {
339
- key: string;
340
- title: string;
341
- link: string;
342
- description: string;
343
- };
344
- convert: ({ method, url, cookies, queryObj, postData, headersObj }: {
345
- method: any;
346
- url: any;
347
- cookies: any;
348
- queryObj: any;
349
- postData: any;
350
- headersObj: any;
351
- }, options: any) => any;
352
- };
353
- axios: {
354
- info: {
355
- key: string;
356
- title: string;
357
- link: string;
358
- description: string;
359
- };
360
- convert: ({ method, url, queryObj, allHeaders, postData }: {
361
- method: any;
362
- url: any;
363
- queryObj: any;
364
- allHeaders: any;
365
- postData: any;
366
- }, options: any) => any;
367
- };
368
- fetch: {
369
- info: {
370
- key: string;
371
- title: string;
372
- link: string;
373
- description: string;
374
- };
375
- convert: ({ method, fullUrl, postData, headersObj, cookies }: {
376
- method: any;
377
- fullUrl: any;
378
- postData: any;
379
- headersObj: any;
380
- cookies: any;
381
- }, options: any) => any;
382
- };
383
- };
384
- };
385
- objc: {
386
- info: {
387
- key: string;
388
- title: string;
389
- extname: string;
390
- default: string;
391
- };
392
- clientsById: {
393
- nsurlsession: {
394
- info: {
395
- key: string;
396
- title: string;
397
- link: string;
398
- description: string;
399
- };
400
- convert: ({ allHeaders, postData, method, fullUrl }: {
401
- allHeaders: any;
402
- postData: any;
403
- method: any;
404
- fullUrl: any;
405
- }, options: any) => any;
406
- };
407
- };
408
- };
409
- ocaml: {
410
- info: {
411
- key: string;
412
- title: string;
413
- extname: string;
414
- default: string;
415
- };
416
- clientsById: {
417
- cohttp: {
418
- info: {
419
- key: string;
420
- title: string;
421
- link: string;
422
- description: string;
423
- };
424
- convert: ({ fullUrl, allHeaders, postData, method }: {
425
- fullUrl: any;
426
- allHeaders: any;
427
- postData: any;
428
- method: any;
429
- }, options: any) => any;
430
- };
431
- };
432
- };
433
- php: {
434
- info: {
435
- key: string;
436
- title: string;
437
- extname: string;
438
- default: string;
439
- };
440
- clientsById: {
441
- curl: {
442
- info: {
443
- key: string;
444
- title: string;
445
- link: string;
446
- description: string;
447
- };
448
- convert: ({ uriObj, postData, fullUrl, method, httpVersion, cookies, headersObj }: {
449
- uriObj: any;
450
- postData: any;
451
- fullUrl: any;
452
- method: any;
453
- httpVersion: any;
454
- cookies: any;
455
- headersObj: any;
456
- }, options?: {}) => any;
457
- };
458
- guzzle: {
459
- info: {
460
- key: string;
461
- title: string;
462
- link: string;
463
- description: string;
464
- };
465
- convert: ({ postData, fullUrl, method, cookies, headersObj }: {
466
- postData: any;
467
- fullUrl: any;
468
- method: any;
469
- cookies: any;
470
- headersObj: any;
471
- }, options: any) => any;
472
- };
473
- http1: {
474
- info: {
475
- key: string;
476
- title: string;
477
- link: string;
478
- description: string;
479
- };
480
- convert: ({ method, url, postData, queryObj, headersObj, cookiesObj }: {
481
- method: any;
482
- url: any;
483
- postData: any;
484
- queryObj: any;
485
- headersObj: any;
486
- cookiesObj: any;
487
- }, options?: {}) => any;
488
- };
489
- http2: {
490
- info: {
491
- key: string;
492
- title: string;
493
- link: string;
494
- description: string;
495
- };
496
- convert: ({ postData, headersObj, method, queryObj, cookiesObj, url }: {
497
- postData: any;
498
- headersObj: any;
499
- method: any;
500
- queryObj: any;
501
- cookiesObj: any;
502
- url: any;
503
- }, options?: {}) => any;
504
- };
505
- };
506
- };
507
- powershell: {
508
- info: {
509
- key: string;
510
- title: string;
511
- extname: string;
512
- default: string;
513
- };
514
- clientsById: {
515
- webrequest: {
516
- info: {
517
- key: string;
518
- title: string;
519
- link: string;
520
- description: string;
521
- };
522
- convert: ({ method, headersObj, cookies, uriObj, fullUrl, postData, allHeaders, }: {
523
- method: any;
524
- headersObj: any;
525
- cookies: any;
526
- uriObj: any;
527
- fullUrl: any;
528
- postData: any;
529
- allHeaders: any;
530
- }) => any;
531
- };
532
- restmethod: {
533
- info: {
534
- key: string;
535
- title: string;
536
- link: string;
537
- description: string;
538
- };
539
- convert: ({ method, headersObj, cookies, uriObj, fullUrl, postData, allHeaders, }: {
540
- method: any;
541
- headersObj: any;
542
- cookies: any;
543
- uriObj: any;
544
- fullUrl: any;
545
- postData: any;
546
- allHeaders: any;
547
- }) => any;
548
- };
549
- };
550
- };
551
- python: {
552
- info: {
553
- key: string;
554
- title: string;
555
- extname: string;
556
- default: string;
557
- };
558
- clientsById: {
559
- python3: {
560
- info: {
561
- key: string;
562
- title: string;
563
- link: string;
564
- description: string;
565
- };
566
- convert: ({ uriObj: { path, protocol, host }, postData, allHeaders, method }: {
567
- uriObj: {
568
- path: any;
569
- protocol: any;
570
- host: any;
571
- };
572
- postData: any;
573
- allHeaders: any;
574
- method: any;
575
- }, options?: {}) => any;
576
- };
577
- requests: {
578
- info: {
579
- key: string;
580
- title: string;
581
- link: string;
582
- description: string;
583
- };
584
- convert: ({ queryObj, url, postData, allHeaders, method }: {
585
- queryObj: any;
586
- url: any;
587
- postData: any;
588
- allHeaders: any;
589
- method: any;
590
- }, options: any) => any;
591
- };
592
- };
593
- };
594
- r: {
595
- info: {
596
- key: string;
597
- title: string;
598
- extname: string;
599
- default: string;
600
- };
601
- clientsById: {
602
- httr: {
603
- info: {
604
- key: string;
605
- title: string;
606
- link: string;
607
- description: string;
608
- };
609
- convert: ({ url, queryObj, queryString, postData, allHeaders, method }: {
610
- url: any;
611
- queryObj: any;
612
- queryString: any;
613
- postData: any;
614
- allHeaders: any;
615
- method: any;
616
- }, options?: {}) => any;
617
- };
618
- };
619
- };
620
- ruby: {
621
- info: {
622
- key: string;
623
- title: string;
624
- extname: string;
625
- default: string;
626
- };
627
- clientsById: {
628
- native: {
629
- info: {
630
- key: string;
631
- title: string;
632
- link: string;
633
- description: string;
634
- };
635
- convert: ({ uriObj, method: rawMethod, fullUrl, postData, allHeaders }: {
636
- uriObj: any;
637
- method: any;
638
- fullUrl: any;
639
- postData: any;
640
- allHeaders: any;
641
- }, options?: {}) => any;
642
- };
643
- };
644
- };
645
- shell: {
646
- info: {
647
- key: string;
648
- title: string;
649
- extname: string;
650
- default: string;
651
- };
652
- clientsById: {
653
- curl: {
654
- info: {
655
- key: string;
656
- title: string;
657
- link: string;
658
- description: string;
659
- };
660
- convert: ({ fullUrl, method, httpVersion, headersObj, allHeaders, postData }: {
661
- fullUrl: any;
662
- method: any;
663
- httpVersion: any;
664
- headersObj: any;
665
- allHeaders: any;
666
- postData: any;
667
- }, options?: {}) => any;
668
- };
669
- httpie: {
670
- info: {
671
- key: string;
672
- title: string;
673
- link: string;
674
- description: string;
675
- };
676
- convert: ({ allHeaders, postData, queryObj, fullUrl, method, url }: {
677
- allHeaders: any;
678
- postData: any;
679
- queryObj: any;
680
- fullUrl: any;
681
- method: any;
682
- url: any;
683
- }, options: any) => any;
684
- };
685
- wget: {
686
- info: {
687
- key: string;
688
- title: string;
689
- link: string;
690
- description: string;
691
- };
692
- convert: ({ method, postData, allHeaders, fullUrl }: {
693
- method: any;
694
- postData: any;
695
- allHeaders: any;
696
- fullUrl: any;
697
- }, options: any) => any;
698
- };
699
- };
700
- };
701
- swift: {
702
- info: {
703
- key: string;
704
- title: string;
705
- extname: string;
706
- default: string;
707
- };
708
- clientsById: {
709
- nsurlsession: {
710
- info: {
711
- key: string;
712
- title: string;
713
- link: string;
714
- description: string;
715
- };
716
- convert: ({ allHeaders, postData, fullUrl, method }: {
717
- allHeaders: any;
718
- postData: any;
719
- fullUrl: any;
720
- method: any;
721
- }, options: any) => any;
722
- };
723
- };
724
- };
725
- };
726
- export declare const isTarget: (target: any) => boolean;
727
- export declare function isValidTargetId(value: any): boolean;
728
- export declare const addTarget: (target: any) => void;
729
- export declare const isClient: (client: any) => boolean;
730
- export declare const addTargetClient: (targetId: any, client: any) => void;
731
- //# sourceMappingURL=targets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"targets.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/esm/targets/targets.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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