@scalar/snippetz 0.2.5 → 0.2.7
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 +3 -3
- package/dist/core/types.d.ts +46 -11
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/utils/convertWithHttpSnippetLite.d.ts +7 -0
- package/dist/core/utils/convertWithHttpSnippetLite.d.ts.map +1 -0
- package/dist/core/utils/convertWithHttpSnippetLite.js +83 -0
- package/dist/plugins/c/libcurl/index.d.ts +2 -0
- package/dist/plugins/c/libcurl/index.d.ts.map +1 -0
- package/dist/plugins/c/libcurl/index.js +1 -0
- package/dist/plugins/c/libcurl/libcurl.d.ts +6 -0
- package/dist/plugins/c/libcurl/libcurl.d.ts.map +1 -0
- package/dist/plugins/c/libcurl/libcurl.js +16 -0
- package/dist/plugins/clojure/clj_http/clj_http.d.ts +6 -0
- package/dist/plugins/clojure/clj_http/clj_http.d.ts.map +1 -0
- package/dist/plugins/clojure/clj_http/clj_http.js +16 -0
- package/dist/plugins/clojure/clj_http/index.d.ts +2 -0
- package/dist/plugins/clojure/clj_http/index.d.ts.map +1 -0
- package/dist/plugins/clojure/clj_http/index.js +1 -0
- package/dist/plugins/csharp/httpclient/httpclient.d.ts +6 -0
- package/dist/plugins/csharp/httpclient/httpclient.d.ts.map +1 -0
- package/dist/plugins/csharp/httpclient/httpclient.js +16 -0
- package/dist/plugins/csharp/httpclient/index.d.ts +2 -0
- package/dist/plugins/csharp/httpclient/index.d.ts.map +1 -0
- package/dist/plugins/csharp/httpclient/index.js +1 -0
- package/dist/plugins/csharp/restsharp/index.d.ts +2 -0
- package/dist/plugins/csharp/restsharp/index.d.ts.map +1 -0
- package/dist/plugins/csharp/restsharp/index.js +1 -0
- package/dist/plugins/csharp/restsharp/restsharp.d.ts +6 -0
- package/dist/plugins/csharp/restsharp/restsharp.d.ts.map +1 -0
- package/dist/plugins/csharp/restsharp/restsharp.js +16 -0
- package/dist/plugins/go/native/index.d.ts +2 -0
- package/dist/plugins/go/native/index.d.ts.map +1 -0
- package/dist/plugins/go/native/index.js +1 -0
- package/dist/plugins/go/native/native.d.ts +6 -0
- package/dist/plugins/go/native/native.d.ts.map +1 -0
- package/dist/plugins/go/native/native.js +16 -0
- package/dist/plugins/http/http11/http11.d.ts +6 -0
- package/dist/plugins/http/http11/http11.d.ts.map +1 -0
- package/dist/plugins/http/http11/http11.js +16 -0
- package/dist/plugins/http/http11/index.d.ts +2 -0
- package/dist/plugins/http/http11/index.d.ts.map +1 -0
- package/dist/plugins/http/http11/index.js +1 -0
- package/dist/plugins/java/asynchttp/asynchttp.d.ts +6 -0
- package/dist/plugins/java/asynchttp/asynchttp.d.ts.map +1 -0
- package/dist/plugins/java/asynchttp/asynchttp.js +16 -0
- package/dist/plugins/java/asynchttp/index.d.ts +2 -0
- package/dist/plugins/java/asynchttp/index.d.ts.map +1 -0
- package/dist/plugins/java/asynchttp/index.js +1 -0
- package/dist/plugins/java/nethttp/index.d.ts +2 -0
- package/dist/plugins/java/nethttp/index.d.ts.map +1 -0
- package/dist/plugins/java/nethttp/index.js +1 -0
- package/dist/plugins/java/nethttp/nethttp.d.ts +6 -0
- package/dist/plugins/java/nethttp/nethttp.d.ts.map +1 -0
- package/dist/plugins/java/nethttp/nethttp.js +16 -0
- package/dist/plugins/java/okhttp/index.d.ts +2 -0
- package/dist/plugins/java/okhttp/index.d.ts.map +1 -0
- package/dist/plugins/java/okhttp/index.js +1 -0
- package/dist/plugins/java/okhttp/okhttp.d.ts +6 -0
- package/dist/plugins/java/okhttp/okhttp.d.ts.map +1 -0
- package/dist/plugins/java/okhttp/okhttp.js +16 -0
- package/dist/plugins/java/unirest/index.d.ts +2 -0
- package/dist/plugins/java/unirest/index.d.ts.map +1 -0
- package/dist/plugins/java/unirest/index.js +1 -0
- package/dist/plugins/java/unirest/unirest.d.ts +6 -0
- package/dist/plugins/java/unirest/unirest.d.ts.map +1 -0
- package/dist/plugins/java/unirest/unirest.js +16 -0
- package/dist/plugins/js/axios/axios.d.ts +6 -0
- package/dist/plugins/js/axios/axios.d.ts.map +1 -0
- package/dist/plugins/js/axios/axios.js +16 -0
- package/dist/plugins/js/axios/index.d.ts +2 -0
- package/dist/plugins/js/axios/index.d.ts.map +1 -0
- package/dist/plugins/js/axios/index.js +1 -0
- package/dist/plugins/js/fetch/fetch.d.ts +2 -6
- package/dist/plugins/js/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/js/fetch/fetch.js +60 -59
- package/dist/plugins/js/fetch/index.js +1 -1
- package/dist/plugins/js/jquery/index.d.ts +2 -0
- package/dist/plugins/js/jquery/index.d.ts.map +1 -0
- package/dist/plugins/js/jquery/index.js +1 -0
- package/dist/plugins/js/jquery/jquery.d.ts +6 -0
- package/dist/plugins/js/jquery/jquery.d.ts.map +1 -0
- package/dist/plugins/js/jquery/jquery.js +16 -0
- package/dist/plugins/js/ofetch/index.js +1 -1
- package/dist/plugins/js/ofetch/ofetch.d.ts +2 -6
- package/dist/plugins/js/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/js/ofetch/ofetch.js +65 -64
- package/dist/plugins/js/xhr/index.d.ts +2 -0
- package/dist/plugins/js/xhr/index.d.ts.map +1 -0
- package/dist/plugins/js/xhr/index.js +1 -0
- package/dist/plugins/js/xhr/xhr.d.ts +6 -0
- package/dist/plugins/js/xhr/xhr.d.ts.map +1 -0
- package/dist/plugins/js/xhr/xhr.js +16 -0
- package/dist/plugins/kotlin/okhttp/index.d.ts +2 -0
- package/dist/plugins/kotlin/okhttp/index.d.ts.map +1 -0
- package/dist/plugins/kotlin/okhttp/index.js +1 -0
- package/dist/plugins/kotlin/okhttp/okhttp.d.ts +6 -0
- package/dist/plugins/kotlin/okhttp/okhttp.d.ts.map +1 -0
- package/dist/plugins/kotlin/okhttp/okhttp.js +16 -0
- package/dist/plugins/node/axios/axios.d.ts +6 -0
- package/dist/plugins/node/axios/axios.d.ts.map +1 -0
- package/dist/plugins/node/axios/axios.js +16 -0
- package/dist/plugins/node/axios/index.d.ts +2 -0
- package/dist/plugins/node/axios/index.d.ts.map +1 -0
- package/dist/plugins/node/axios/index.js +1 -0
- package/dist/plugins/node/fetch/fetch.d.ts +2 -6
- package/dist/plugins/node/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/node/fetch/fetch.js +60 -59
- package/dist/plugins/node/fetch/index.js +1 -1
- package/dist/plugins/node/ofetch/index.js +1 -1
- package/dist/plugins/node/ofetch/ofetch.d.ts +2 -6
- package/dist/plugins/node/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/node/ofetch/ofetch.js +65 -64
- package/dist/plugins/node/undici/index.js +1 -1
- package/dist/plugins/node/undici/undici.d.ts +2 -6
- package/dist/plugins/node/undici/undici.d.ts.map +1 -1
- package/dist/plugins/node/undici/undici.js +60 -59
- package/dist/plugins/objc/nsurlsession/index.d.ts +2 -0
- package/dist/plugins/objc/nsurlsession/index.d.ts.map +1 -0
- package/dist/plugins/objc/nsurlsession/index.js +1 -0
- package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts +6 -0
- package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts.map +1 -0
- package/dist/plugins/objc/nsurlsession/nsurlsession.js +16 -0
- package/dist/plugins/ocaml/cohttp/cohttp.d.ts +6 -0
- package/dist/plugins/ocaml/cohttp/cohttp.d.ts.map +1 -0
- package/dist/plugins/ocaml/cohttp/cohttp.js +16 -0
- package/dist/plugins/ocaml/cohttp/index.d.ts +2 -0
- package/dist/plugins/ocaml/cohttp/index.d.ts.map +1 -0
- package/dist/plugins/ocaml/cohttp/index.js +1 -0
- package/dist/plugins/php/curl/curl.d.ts +6 -0
- package/dist/plugins/php/curl/curl.d.ts.map +1 -0
- package/dist/plugins/php/curl/curl.js +16 -0
- package/dist/plugins/php/curl/index.d.ts +2 -0
- package/dist/plugins/php/curl/index.d.ts.map +1 -0
- package/dist/plugins/php/curl/index.js +1 -0
- package/dist/plugins/php/guzzle/guzzle.d.ts +6 -0
- package/dist/plugins/php/guzzle/guzzle.d.ts.map +1 -0
- package/dist/plugins/php/guzzle/guzzle.js +16 -0
- package/dist/plugins/php/guzzle/index.d.ts +2 -0
- package/dist/plugins/php/guzzle/index.d.ts.map +1 -0
- package/dist/plugins/php/guzzle/index.js +1 -0
- package/dist/plugins/powershell/restmethod/index.d.ts +2 -0
- package/dist/plugins/powershell/restmethod/index.d.ts.map +1 -0
- package/dist/plugins/powershell/restmethod/index.js +1 -0
- package/dist/plugins/powershell/restmethod/restmethod.d.ts +6 -0
- package/dist/plugins/powershell/restmethod/restmethod.d.ts.map +1 -0
- package/dist/plugins/powershell/restmethod/restmethod.js +16 -0
- package/dist/plugins/powershell/webrequest/index.d.ts +2 -0
- package/dist/plugins/powershell/webrequest/index.d.ts.map +1 -0
- package/dist/plugins/powershell/webrequest/index.js +1 -0
- package/dist/plugins/powershell/webrequest/webrequest.d.ts +6 -0
- package/dist/plugins/powershell/webrequest/webrequest.d.ts.map +1 -0
- package/dist/plugins/powershell/webrequest/webrequest.js +16 -0
- package/dist/plugins/python/python3/index.d.ts +2 -0
- package/dist/plugins/python/python3/index.d.ts.map +1 -0
- package/dist/plugins/python/python3/index.js +1 -0
- package/dist/plugins/python/python3/python3.d.ts +6 -0
- package/dist/plugins/python/python3/python3.d.ts.map +1 -0
- package/dist/plugins/python/python3/python3.js +16 -0
- package/dist/plugins/python/requests/index.d.ts +2 -0
- package/dist/plugins/python/requests/index.d.ts.map +1 -0
- package/dist/plugins/python/requests/index.js +1 -0
- package/dist/plugins/python/requests/requests.d.ts +6 -0
- package/dist/plugins/python/requests/requests.d.ts.map +1 -0
- package/dist/plugins/python/requests/requests.js +16 -0
- package/dist/plugins/r/httr/httr.d.ts +6 -0
- package/dist/plugins/r/httr/httr.d.ts.map +1 -0
- package/dist/plugins/r/httr/httr.js +16 -0
- package/dist/plugins/r/httr/index.d.ts +2 -0
- package/dist/plugins/r/httr/index.d.ts.map +1 -0
- package/dist/plugins/r/httr/index.js +1 -0
- package/dist/plugins/ruby/native/index.d.ts +2 -0
- package/dist/plugins/ruby/native/index.d.ts.map +1 -0
- package/dist/plugins/ruby/native/index.js +1 -0
- package/dist/plugins/ruby/native/native.d.ts +6 -0
- package/dist/plugins/ruby/native/native.d.ts.map +1 -0
- package/dist/plugins/ruby/native/native.js +16 -0
- package/dist/plugins/shell/curl/curl.d.ts +2 -6
- package/dist/plugins/shell/curl/curl.d.ts.map +1 -1
- package/dist/plugins/shell/curl/curl.js +95 -95
- package/dist/plugins/shell/curl/index.js +1 -1
- package/dist/plugins/shell/httpie/httpie.d.ts +6 -0
- package/dist/plugins/shell/httpie/httpie.d.ts.map +1 -0
- package/dist/plugins/shell/httpie/httpie.js +16 -0
- package/dist/plugins/shell/httpie/index.d.ts +2 -0
- package/dist/plugins/shell/httpie/index.d.ts.map +1 -0
- package/dist/plugins/shell/httpie/index.js +1 -0
- package/dist/plugins/shell/wget/index.d.ts +2 -0
- package/dist/plugins/shell/wget/index.d.ts.map +1 -0
- package/dist/plugins/shell/wget/index.js +1 -0
- package/dist/plugins/shell/wget/wget.d.ts +6 -0
- package/dist/plugins/shell/wget/wget.d.ts.map +1 -0
- package/dist/plugins/shell/wget/wget.js +16 -0
- package/dist/plugins/swift/nsurlsession/index.d.ts +2 -0
- package/dist/plugins/swift/nsurlsession/index.d.ts.map +1 -0
- package/dist/plugins/swift/nsurlsession/index.js +1 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts +6 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts.map +1 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.js +16 -0
- package/dist/snippetz.d.ts +8 -11
- package/dist/snippetz.d.ts.map +1 -1
- package/dist/snippetz.js +78 -23
- package/package.json +146 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
|
|
2
|
+
import { restmethod } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/powershell/restmethod/client.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* powershell/restmethod
|
|
6
|
+
*/
|
|
7
|
+
const powershellRestmethod = {
|
|
8
|
+
target: 'powershell',
|
|
9
|
+
client: 'restmethod',
|
|
10
|
+
generate(request) {
|
|
11
|
+
// TODO: Write an own converter
|
|
12
|
+
return convertWithHttpSnippetLite(restmethod, request);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { powershellRestmethod };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/powershell/webrequest/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { powershellWebrequest } from './webrequest.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webrequest.d.ts","sourceRoot":"","sources":["../../../../src/plugins/powershell/webrequest/webrequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAOlC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
|
|
2
|
+
import { webrequest } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/powershell/webrequest/client.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* powershell/webrequest
|
|
6
|
+
*/
|
|
7
|
+
const powershellWebrequest = {
|
|
8
|
+
target: 'powershell',
|
|
9
|
+
client: 'webrequest',
|
|
10
|
+
generate(request) {
|
|
11
|
+
// TODO: Write an own converter
|
|
12
|
+
return convertWithHttpSnippetLite(webrequest, request);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { powershellWebrequest };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/python/python3/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { pythonPython3 } from './python3.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python3.d.ts","sourceRoot":"","sources":["../../../../src/plugins/python/python3/python3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAO3B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
|
|
2
|
+
import { python3 } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/python/python3/client.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* python/python3
|
|
6
|
+
*/
|
|
7
|
+
const pythonPython3 = {
|
|
8
|
+
target: 'python',
|
|
9
|
+
client: 'python3',
|
|
10
|
+
generate(request) {
|
|
11
|
+
// TODO: Write an own converter
|
|
12
|
+
return convertWithHttpSnippetLite(python3, request);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { pythonPython3 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/python/requests/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { pythonRequests } from './requests.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/plugins/python/requests/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAO5B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
|
|
2
|
+
import { requests } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/python/requests/client.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* python/requests
|
|
6
|
+
*/
|
|
7
|
+
const pythonRequests = {
|
|
8
|
+
target: 'python',
|
|
9
|
+
client: 'requests',
|
|
10
|
+
generate(request) {
|
|
11
|
+
// TODO: Write an own converter
|
|
12
|
+
return convertWithHttpSnippetLite(requests, request);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { pythonRequests };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httr.d.ts","sourceRoot":"","sources":["../../../../src/plugins/r/httr/httr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,MAOnB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
|
|
2
|
+
import { httr } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/r/httr/client.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* r/httr
|
|
6
|
+
*/
|
|
7
|
+
const rHttr = {
|
|
8
|
+
target: 'r',
|
|
9
|
+
client: 'httr',
|
|
10
|
+
generate(request) {
|
|
11
|
+
// TODO: Write an own converter
|
|
12
|
+
return convertWithHttpSnippetLite(httr, request);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { rHttr };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/r/httr/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { rHttr } from './httr.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/ruby/native/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { rubyNative } from './native.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../../src/plugins/ruby/native/native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAOxB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
|
|
2
|
+
import { native } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/ruby/native/client.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ruby/native
|
|
6
|
+
*/
|
|
7
|
+
const rubyNative = {
|
|
8
|
+
target: 'ruby',
|
|
9
|
+
client: 'native',
|
|
10
|
+
generate(request) {
|
|
11
|
+
// TODO: Write an own converter
|
|
12
|
+
return convertWithHttpSnippetLite(native, request);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { rubyNative };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare global {
|
|
3
|
-
interface Clients extends AddClient<'shell', 'curl'> {
|
|
4
|
-
}
|
|
5
|
-
}
|
|
1
|
+
import type { Plugin } from '../../../core/index.js';
|
|
6
2
|
/**
|
|
7
3
|
* shell/curl
|
|
8
4
|
*/
|
|
9
|
-
export declare
|
|
5
|
+
export declare const shellCurl: Plugin;
|
|
10
6
|
//# sourceMappingURL=curl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/curl/curl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/curl/curl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,MAoHvB,CAAA"}
|
|
@@ -1,105 +1,105 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* shell/curl
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
parts
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
parts.push(`--user '${configuration.auth.username}:${configuration.auth.password}'`);
|
|
37
|
-
}
|
|
38
|
-
// Headers
|
|
39
|
-
if (normalizedRequest.headers?.length) {
|
|
40
|
-
normalizedRequest.headers.forEach((header) => {
|
|
41
|
-
parts.push(`--header '${header.name}: ${header.value}'`);
|
|
42
|
-
});
|
|
43
|
-
// Add compressed flag if Accept-Encoding header includes compression
|
|
44
|
-
const acceptEncoding = normalizedRequest.headers.find((header) => header.name.toLowerCase() === 'accept-encoding');
|
|
45
|
-
if (acceptEncoding && /gzip|deflate/.test(acceptEncoding.value)) {
|
|
46
|
-
parts.push('--compressed');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
// Cookies
|
|
50
|
-
if (normalizedRequest.cookies?.length) {
|
|
51
|
-
const cookieString = normalizedRequest.cookies
|
|
52
|
-
.map((cookie) => {
|
|
53
|
-
// Encode both cookie name and value to handle special characters
|
|
54
|
-
const encodedName = encodeURIComponent(cookie.name);
|
|
55
|
-
const encodedValue = encodeURIComponent(cookie.value);
|
|
56
|
-
return `${encodedName}=${encodedValue}`;
|
|
57
|
-
})
|
|
58
|
-
.join('; ');
|
|
59
|
-
parts.push(`--cookie '${cookieString}'`);
|
|
60
|
-
}
|
|
61
|
-
// Body
|
|
62
|
-
if (normalizedRequest.postData) {
|
|
63
|
-
if (normalizedRequest.postData.mimeType === 'application/json') {
|
|
64
|
-
// Pretty print JSON data
|
|
65
|
-
if (normalizedRequest.postData.text) {
|
|
66
|
-
const jsonData = JSON.parse(normalizedRequest.postData.text);
|
|
67
|
-
const prettyJson = JSON.stringify(jsonData, null, 2);
|
|
68
|
-
parts.push(`--data '${prettyJson}'`);
|
|
69
|
-
}
|
|
4
|
+
const shellCurl = {
|
|
5
|
+
target: 'shell',
|
|
6
|
+
client: 'curl',
|
|
7
|
+
generate(request, configuration) {
|
|
8
|
+
// Defaults
|
|
9
|
+
const normalizedRequest = {
|
|
10
|
+
method: 'GET',
|
|
11
|
+
...request,
|
|
12
|
+
};
|
|
13
|
+
// Normalization
|
|
14
|
+
normalizedRequest.method = normalizedRequest.method.toUpperCase();
|
|
15
|
+
// Build curl command parts
|
|
16
|
+
const parts = ['curl'];
|
|
17
|
+
// URL (quote if has query parameters or special characters)
|
|
18
|
+
const queryString = normalizedRequest.queryString?.length
|
|
19
|
+
? '?' +
|
|
20
|
+
normalizedRequest.queryString
|
|
21
|
+
.map((param) => {
|
|
22
|
+
// Ensure both name and value are fully URI encoded
|
|
23
|
+
const encodedName = encodeURIComponent(param.name);
|
|
24
|
+
const encodedValue = encodeURIComponent(param.value);
|
|
25
|
+
return `${encodedName}=${encodedValue}`;
|
|
26
|
+
})
|
|
27
|
+
.join('&')
|
|
28
|
+
: '';
|
|
29
|
+
const url = `${normalizedRequest.url}${queryString}`;
|
|
30
|
+
const hasSpecialChars = /[\s<>[\]{}|\\^%]/.test(url);
|
|
31
|
+
const urlPart = queryString || hasSpecialChars ? `'${url}'` : url;
|
|
32
|
+
parts[0] = `curl ${urlPart}`;
|
|
33
|
+
// Method
|
|
34
|
+
if (normalizedRequest.method !== 'GET') {
|
|
35
|
+
parts.push(`--request ${normalizedRequest.method}`);
|
|
70
36
|
}
|
|
71
|
-
|
|
72
|
-
|
|
37
|
+
// Basic Auth
|
|
38
|
+
if (configuration?.auth?.username && configuration?.auth?.password) {
|
|
39
|
+
parts.push(`--user '${configuration.auth.username}:${configuration.auth.password}'`);
|
|
73
40
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
normalizedRequest.
|
|
77
|
-
|
|
78
|
-
normalizedRequest.postData.params.forEach((param) => {
|
|
79
|
-
parts.push(`--data-urlencode '${encodeURIComponent(param.name)}=${param.value}'`);
|
|
41
|
+
// Headers
|
|
42
|
+
if (normalizedRequest.headers?.length) {
|
|
43
|
+
normalizedRequest.headers.forEach((header) => {
|
|
44
|
+
parts.push(`--header '${header.name}: ${header.value}'`);
|
|
80
45
|
});
|
|
46
|
+
// Add compressed flag if Accept-Encoding header includes compression
|
|
47
|
+
const acceptEncoding = normalizedRequest.headers.find((header) => header.name.toLowerCase() === 'accept-encoding');
|
|
48
|
+
if (acceptEncoding && /gzip|deflate/.test(acceptEncoding.value)) {
|
|
49
|
+
parts.push('--compressed');
|
|
50
|
+
}
|
|
81
51
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
52
|
+
// Cookies
|
|
53
|
+
if (normalizedRequest.cookies?.length) {
|
|
54
|
+
const cookieString = normalizedRequest.cookies
|
|
55
|
+
.map((cookie) => {
|
|
56
|
+
// Encode both cookie name and value to handle special characters
|
|
57
|
+
const encodedName = encodeURIComponent(cookie.name);
|
|
58
|
+
const encodedValue = encodeURIComponent(cookie.value);
|
|
59
|
+
return `${encodedName}=${encodedValue}`;
|
|
60
|
+
})
|
|
61
|
+
.join('; ');
|
|
62
|
+
parts.push(`--cookie '${cookieString}'`);
|
|
93
63
|
}
|
|
94
|
-
|
|
95
|
-
|
|
64
|
+
// Body
|
|
65
|
+
if (normalizedRequest.postData) {
|
|
66
|
+
if (normalizedRequest.postData.mimeType === 'application/json') {
|
|
67
|
+
// Pretty print JSON data
|
|
68
|
+
if (normalizedRequest.postData.text) {
|
|
69
|
+
const jsonData = JSON.parse(normalizedRequest.postData.text);
|
|
70
|
+
const prettyJson = JSON.stringify(jsonData, null, 2);
|
|
71
|
+
parts.push(`--data '${prettyJson}'`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (normalizedRequest.postData.mimeType === 'application/octet-stream') {
|
|
75
|
+
parts.push(`--data-binary '${normalizedRequest.postData.text}'`);
|
|
76
|
+
}
|
|
77
|
+
else if (normalizedRequest.postData.mimeType ===
|
|
78
|
+
'application/x-www-form-urlencoded' &&
|
|
79
|
+
normalizedRequest.postData.params) {
|
|
80
|
+
// Handle URL-encoded form data
|
|
81
|
+
normalizedRequest.postData.params.forEach((param) => {
|
|
82
|
+
parts.push(`--data-urlencode '${encodeURIComponent(param.name)}=${param.value}'`);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else if (normalizedRequest.postData.mimeType === 'multipart/form-data' &&
|
|
86
|
+
normalizedRequest.postData.params) {
|
|
87
|
+
// Handle multipart form data
|
|
88
|
+
normalizedRequest.postData.params.forEach((param) => {
|
|
89
|
+
if (param.fileName !== undefined) {
|
|
90
|
+
parts.push(`--form '${param.name}=@${param.fileName}'`);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
parts.push(`--form '${param.name}=${param.value}'`);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
parts.push(`--data "${normalizedRequest.postData.text}"`);
|
|
99
|
+
}
|
|
96
100
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
client: 'curl',
|
|
101
|
-
code: parts.join(' \\\n '),
|
|
102
|
-
};
|
|
103
|
-
}
|
|
101
|
+
return parts.join(' \\\n ');
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
104
|
|
|
105
|
-
export {
|
|
105
|
+
export { shellCurl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { shellCurl } from './curl.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpie.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/httpie/httpie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAOzB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
|
|
2
|
+
import { httpie } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/shell/httpie/client.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* shell/httpie
|
|
6
|
+
*/
|
|
7
|
+
const shellHttpie = {
|
|
8
|
+
target: 'shell',
|
|
9
|
+
client: 'httpie',
|
|
10
|
+
generate(request) {
|
|
11
|
+
// TODO: Write an own converter
|
|
12
|
+
return convertWithHttpSnippetLite(httpie, request);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { shellHttpie };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/httpie/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { shellHttpie } from './httpie.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/wget/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { shellWget } from './wget.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wget.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/wget/wget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,MAOvB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
|
|
2
|
+
import { wget } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/shell/wget/client.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* shell/wget
|
|
6
|
+
*/
|
|
7
|
+
const shellWget = {
|
|
8
|
+
target: 'shell',
|
|
9
|
+
client: 'wget',
|
|
10
|
+
generate(request) {
|
|
11
|
+
// TODO: Write an own converter
|
|
12
|
+
return convertWithHttpSnippetLite(wget, request);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { shellWget };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/swift/nsurlsession/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { swiftNsurlsession } from './nsurlsession.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nsurlsession.d.ts","sourceRoot":"","sources":["../../../../src/plugins/swift/nsurlsession/nsurlsession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAO/B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
|
|
2
|
+
import { nsurlsession } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/swift/nsurlsession/client.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* swift/nsurlsession
|
|
6
|
+
*/
|
|
7
|
+
const swiftNsurlsession = {
|
|
8
|
+
target: 'swift',
|
|
9
|
+
client: 'nsurlsession',
|
|
10
|
+
generate(request) {
|
|
11
|
+
// TODO: Write an own converter
|
|
12
|
+
return convertWithHttpSnippetLite(nsurlsession, request);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { swiftNsurlsession };
|
package/dist/snippetz.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import type { ClientId, Request, TargetId } from './core/index.js';
|
|
2
|
-
import { curl } from './plugins/shell/curl/index.js';
|
|
1
|
+
import type { ClientId, Plugin, Request, TargetId } from './core/index.js';
|
|
3
2
|
/**
|
|
4
3
|
* Generate code examples for HAR requests
|
|
5
4
|
*/
|
|
6
5
|
export declare function snippetz(): {
|
|
7
|
-
get(target: TargetId, client: ClientId<TargetId
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
targets(): ("js" | "node" | "shell")[];
|
|
12
|
-
clients(): ClientId<"js" | "node" | "shell">[];
|
|
6
|
+
get(target: TargetId, client: ClientId<TargetId>): Plugin | undefined;
|
|
7
|
+
print<T extends TargetId>(target: T, client: ClientId<T>, request: Partial<Request>): string | undefined;
|
|
8
|
+
targets(): ("c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift")[];
|
|
9
|
+
clients(): ("libcurl" | "clj_http" | "httpclient" | "restsharp" | "native" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "fetch" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "httr" | "httpie" | "wget")[];
|
|
13
10
|
plugins(): {
|
|
14
|
-
target: "js" | "node" | "shell";
|
|
15
|
-
client:
|
|
11
|
+
target: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift";
|
|
12
|
+
client: "libcurl" | "clj_http" | "httpclient" | "restsharp" | "native" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "fetch" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "httr" | "httpie" | "wget";
|
|
16
13
|
}[];
|
|
17
|
-
findPlugin<T extends TargetId>(target: T | string, client: ClientId<T> | string):
|
|
14
|
+
findPlugin<T extends TargetId>(target: T | string, client: ClientId<T> | string): Plugin | undefined;
|
|
18
15
|
hasPlugin<T extends TargetId>(target: T | string, client: ClientId<T> | string): boolean;
|
|
19
16
|
};
|
|
20
17
|
//# sourceMappingURL=snippetz.d.ts.map
|
package/dist/snippetz.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../src/snippetz.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../src/snippetz.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEjE;;GAEG;AACH,wBAAgB,QAAQ;gBAuCR,QAAQ,UAAU,QAAQ,CAAC,QAAQ,CAAC;UAG1C,CAAC,SAAS,QAAQ,UACd,CAAC,UACD,QAAQ,CAAC,CAAC,CAAC,WACV,OAAO,CAAC,OAAO,CAAC;;;;;;;eAwBhB,CAAC,SAAS,QAAQ,UACnB,CAAC,GAAG,MAAM,UACV,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM;cAMpB,CAAC,SAAS,QAAQ,UAClB,CAAC,GAAG,MAAM,UACV,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM;EAKjC"}
|