@scalar/snippetz 0.2.7 → 0.2.9
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/clients.d.ts +6 -0
- package/dist/clients.d.ts.map +1 -0
- package/dist/clients.js +150 -0
- package/dist/httpsnippet-lite/esm/helpers/code-builder.d.ts +8 -0
- package/dist/httpsnippet-lite/esm/helpers/code-builder.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/code-builder.js +62 -0
- package/dist/httpsnippet-lite/esm/helpers/escape.d.ts +29 -0
- package/dist/httpsnippet-lite/esm/helpers/escape.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/escape.js +74 -0
- package/dist/httpsnippet-lite/esm/helpers/form-data.d.ts +3 -0
- package/dist/httpsnippet-lite/esm/helpers/form-data.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/headers.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/helpers/headers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/headers.js +22 -0
- package/dist/httpsnippet-lite/esm/helpers/reducer.d.ts +2 -0
- package/dist/httpsnippet-lite/esm/helpers/reducer.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/shell.d.ts +7 -0
- package/dist/httpsnippet-lite/esm/helpers/shell.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/shell.js +18 -0
- package/dist/httpsnippet-lite/esm/helpers/url.d.ts +5 -0
- package/dist/httpsnippet-lite/esm/helpers/url.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/utils.d.ts +3 -0
- package/dist/httpsnippet-lite/esm/helpers/utils.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/httpsnippet.d.ts +10 -0
- package/dist/httpsnippet-lite/esm/httpsnippet.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js +45 -0
- package/dist/httpsnippet-lite/esm/targets/c/target.d.ts +26 -0
- package/dist/httpsnippet-lite/esm/targets/c/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js +189 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/target.d.ts +26 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.js +169 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js +49 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/target.d.ts +41 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/go/native/client.js +124 -0
- package/dist/httpsnippet-lite/esm/targets/go/target.d.ts +25 -0
- package/dist/httpsnippet-lite/esm/targets/go/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/http/http1.1/client.d.ts +22 -0
- package/dist/httpsnippet-lite/esm/targets/http/http1.1/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/http/http1.1/client.js +77 -0
- package/dist/httpsnippet-lite/esm/targets/http/target.d.ts +27 -0
- package/dist/httpsnippet-lite/esm/targets/http/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js +47 -0
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js +46 -0
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js +73 -0
- package/dist/httpsnippet-lite/esm/targets/java/target.d.ts +67 -0
- package/dist/httpsnippet-lite/esm/targets/java/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js +47 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js +91 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/fetch/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/fetch/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js +88 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/target.d.ts +68 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js +86 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js +73 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.d.ts +25 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.js +83 -0
- package/dist/httpsnippet-lite/esm/targets/node/fetch/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/node/fetch/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/native/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/node/native/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/request/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/node/request/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/target.d.ts +87 -0
- package/dist/httpsnippet-lite/esm/targets/node/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/unirest/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/node/unirest/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.d.ts +27 -0
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.js +58 -0
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js +132 -0
- package/dist/httpsnippet-lite/esm/targets/objc/target.d.ts +25 -0
- package/dist/httpsnippet-lite/esm/targets/objc/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js +68 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.d.ts +25 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/curl/client.d.ts +18 -0
- package/dist/httpsnippet-lite/esm/targets/php/curl/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/curl/client.js +134 -0
- package/dist/httpsnippet-lite/esm/targets/php/guzzle/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/php/guzzle/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/guzzle/client.js +126 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.d.ts +3 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js +37 -0
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/target.d.ts +75 -0
- package/dist/httpsnippet-lite/esm/targets/php/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/common.d.ts +10 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/common.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/common.js +53 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.d.ts +18 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js +15 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/target.d.ts +45 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.d.ts +18 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js +15 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.d.ts +9 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js +63 -0
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.d.ts +19 -0
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.js +95 -0
- package/dist/httpsnippet-lite/esm/targets/python/requests/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/python/requests/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/python/requests/client.js +177 -0
- package/dist/httpsnippet-lite/esm/targets/python/target.d.ts +44 -0
- package/dist/httpsnippet-lite/esm/targets/python/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.js +127 -0
- package/dist/httpsnippet-lite/esm/targets/r/target.d.ts +27 -0
- package/dist/httpsnippet-lite/esm/targets/r/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js +72 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/target.d.ts +26 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/shell/curl/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/shell/curl/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js +118 -0
- package/dist/httpsnippet-lite/esm/targets/shell/target.d.ts +57 -0
- package/dist/httpsnippet-lite/esm/targets/shell/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js +54 -0
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.js +76 -0
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js +137 -0
- package/dist/httpsnippet-lite/esm/targets/swift/target.d.ts +25 -0
- package/dist/httpsnippet-lite/esm/targets/swift/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/targets.d.ts +731 -0
- package/dist/httpsnippet-lite/esm/targets/targets.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/plugins/c/libcurl/libcurl.d.ts +1 -1
- package/dist/plugins/c/libcurl/libcurl.d.ts.map +1 -1
- package/dist/plugins/c/libcurl/libcurl.js +3 -2
- package/dist/plugins/clojure/clj_http/clj_http.d.ts +1 -1
- package/dist/plugins/clojure/clj_http/clj_http.d.ts.map +1 -1
- package/dist/plugins/clojure/clj_http/clj_http.js +3 -2
- package/dist/plugins/csharp/httpclient/httpclient.d.ts +1 -1
- package/dist/plugins/csharp/httpclient/httpclient.d.ts.map +1 -1
- package/dist/plugins/csharp/httpclient/httpclient.js +3 -2
- package/dist/plugins/csharp/restsharp/restsharp.d.ts +1 -1
- package/dist/plugins/csharp/restsharp/restsharp.d.ts.map +1 -1
- package/dist/plugins/csharp/restsharp/restsharp.js +3 -2
- package/dist/plugins/go/native/native.d.ts +1 -1
- package/dist/plugins/go/native/native.d.ts.map +1 -1
- package/dist/plugins/go/native/native.js +3 -2
- package/dist/plugins/http/http11/http11.d.ts +1 -1
- package/dist/plugins/http/http11/http11.d.ts.map +1 -1
- package/dist/plugins/http/http11/http11.js +3 -2
- package/dist/plugins/java/asynchttp/asynchttp.d.ts +1 -1
- package/dist/plugins/java/asynchttp/asynchttp.d.ts.map +1 -1
- package/dist/plugins/java/asynchttp/asynchttp.js +3 -2
- package/dist/plugins/java/nethttp/nethttp.d.ts +1 -1
- package/dist/plugins/java/nethttp/nethttp.d.ts.map +1 -1
- package/dist/plugins/java/nethttp/nethttp.js +3 -2
- package/dist/plugins/java/okhttp/okhttp.d.ts +1 -1
- package/dist/plugins/java/okhttp/okhttp.d.ts.map +1 -1
- package/dist/plugins/java/okhttp/okhttp.js +3 -2
- package/dist/plugins/java/unirest/unirest.d.ts +1 -1
- package/dist/plugins/java/unirest/unirest.d.ts.map +1 -1
- package/dist/plugins/java/unirest/unirest.js +3 -2
- package/dist/plugins/js/axios/axios.d.ts +1 -1
- package/dist/plugins/js/axios/axios.d.ts.map +1 -1
- package/dist/plugins/js/axios/axios.js +3 -2
- package/dist/plugins/js/fetch/fetch.d.ts +1 -1
- package/dist/plugins/js/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/js/fetch/fetch.js +3 -2
- package/dist/plugins/js/jquery/jquery.d.ts +1 -1
- package/dist/plugins/js/jquery/jquery.d.ts.map +1 -1
- package/dist/plugins/js/jquery/jquery.js +3 -2
- package/dist/plugins/js/ofetch/ofetch.d.ts +1 -1
- package/dist/plugins/js/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/js/ofetch/ofetch.js +3 -2
- package/dist/plugins/js/xhr/xhr.d.ts +1 -1
- package/dist/plugins/js/xhr/xhr.d.ts.map +1 -1
- package/dist/plugins/js/xhr/xhr.js +3 -2
- package/dist/plugins/kotlin/okhttp/okhttp.d.ts +1 -1
- package/dist/plugins/kotlin/okhttp/okhttp.d.ts.map +1 -1
- package/dist/plugins/kotlin/okhttp/okhttp.js +3 -2
- package/dist/plugins/node/axios/axios.d.ts +1 -1
- package/dist/plugins/node/axios/axios.d.ts.map +1 -1
- package/dist/plugins/node/axios/axios.js +3 -2
- package/dist/plugins/node/fetch/fetch.d.ts +1 -1
- package/dist/plugins/node/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/node/fetch/fetch.js +3 -2
- package/dist/plugins/node/ofetch/ofetch.d.ts +1 -1
- package/dist/plugins/node/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/node/ofetch/ofetch.js +3 -2
- package/dist/plugins/node/undici/undici.d.ts +1 -1
- package/dist/plugins/node/undici/undici.d.ts.map +1 -1
- package/dist/plugins/node/undici/undici.js +3 -2
- package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts +1 -1
- package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts.map +1 -1
- package/dist/plugins/objc/nsurlsession/nsurlsession.js +3 -2
- package/dist/plugins/ocaml/cohttp/cohttp.d.ts +1 -1
- package/dist/plugins/ocaml/cohttp/cohttp.d.ts.map +1 -1
- package/dist/plugins/ocaml/cohttp/cohttp.js +3 -2
- package/dist/plugins/php/curl/curl.d.ts +1 -1
- package/dist/plugins/php/curl/curl.d.ts.map +1 -1
- package/dist/plugins/php/curl/curl.js +3 -2
- package/dist/plugins/php/guzzle/guzzle.d.ts +1 -1
- package/dist/plugins/php/guzzle/guzzle.d.ts.map +1 -1
- package/dist/plugins/php/guzzle/guzzle.js +3 -2
- package/dist/plugins/powershell/restmethod/restmethod.d.ts +1 -1
- package/dist/plugins/powershell/restmethod/restmethod.d.ts.map +1 -1
- package/dist/plugins/powershell/restmethod/restmethod.js +3 -2
- package/dist/plugins/powershell/webrequest/webrequest.d.ts +1 -1
- package/dist/plugins/powershell/webrequest/webrequest.d.ts.map +1 -1
- package/dist/plugins/powershell/webrequest/webrequest.js +3 -2
- package/dist/plugins/python/python3/python3.d.ts +1 -1
- package/dist/plugins/python/python3/python3.d.ts.map +1 -1
- package/dist/plugins/python/python3/python3.js +3 -2
- package/dist/plugins/python/requests/requests.d.ts +1 -1
- package/dist/plugins/python/requests/requests.d.ts.map +1 -1
- package/dist/plugins/python/requests/requests.js +3 -2
- package/dist/plugins/r/httr/httr.d.ts +1 -1
- package/dist/plugins/r/httr/httr.d.ts.map +1 -1
- package/dist/plugins/r/httr/httr.js +3 -2
- package/dist/plugins/ruby/native/native.d.ts +1 -1
- package/dist/plugins/ruby/native/native.d.ts.map +1 -1
- package/dist/plugins/ruby/native/native.js +3 -2
- package/dist/plugins/shell/curl/curl.d.ts +1 -1
- package/dist/plugins/shell/curl/curl.d.ts.map +1 -1
- package/dist/plugins/shell/curl/curl.js +1 -0
- package/dist/plugins/shell/httpie/httpie.d.ts +1 -1
- package/dist/plugins/shell/httpie/httpie.d.ts.map +1 -1
- package/dist/plugins/shell/httpie/httpie.js +3 -2
- package/dist/plugins/shell/wget/wget.d.ts +1 -1
- package/dist/plugins/shell/wget/wget.d.ts.map +1 -1
- package/dist/plugins/shell/wget/wget.js +3 -2
- package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts +1 -1
- package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts.map +1 -1
- package/dist/plugins/swift/nsurlsession/nsurlsession.js +3 -2
- package/dist/snippetz.d.ts +4 -6
- package/dist/snippetz.d.ts.map +1 -1
- package/dist/snippetz.js +10 -91
- package/dist/{core/types.d.ts → types/index.d.ts} +15 -4
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.test-d.d.ts +2 -0
- package/dist/types/index.test-d.d.ts.map +1 -0
- package/dist/utils/arrayToObject.d.ts.map +1 -0
- package/dist/utils/convertWithHttpSnippetLite.d.ts +6 -0
- package/dist/utils/convertWithHttpSnippetLite.d.ts.map +1 -0
- package/dist/utils/convertWithHttpSnippetLite.js +95 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/needsQuotes.d.ts.map +1 -0
- package/dist/utils/objectToString.d.ts.map +1 -0
- package/package.json +11 -7
- package/dist/core/index.d.ts +0 -5
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -3
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.test-d.d.ts +0 -2
- package/dist/core/types.test-d.d.ts.map +0 -1
- package/dist/core/utils/arrayToObject.d.ts.map +0 -1
- package/dist/core/utils/convertWithHttpSnippetLite.d.ts +0 -7
- package/dist/core/utils/convertWithHttpSnippetLite.d.ts.map +0 -1
- package/dist/core/utils/convertWithHttpSnippetLite.js +0 -83
- package/dist/core/utils/needsQuotes.d.ts.map +0 -1
- package/dist/core/utils/objectToString.d.ts.map +0 -1
- /package/dist/{core/utils → utils}/arrayToObject.d.ts +0 -0
- /package/dist/{core/utils → utils}/arrayToObject.js +0 -0
- /package/dist/{core/utils → utils}/needsQuotes.d.ts +0 -0
- /package/dist/{core/utils → utils}/needsQuotes.js +0 -0
- /package/dist/{core/utils → utils}/objectToString.d.ts +0 -0
- /package/dist/{core/utils → utils}/objectToString.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../src/clients.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,EA6G3B,CAAA"}
|
package/dist/clients.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { cLibcurl } from './plugins/c/libcurl/libcurl.js';
|
|
2
|
+
import { javaNethttp } from './plugins/java/nethttp/nethttp.js';
|
|
3
|
+
import { javaOkhttp } from './plugins/java/okhttp/okhttp.js';
|
|
4
|
+
import { javaUnirest } from './plugins/java/unirest/unirest.js';
|
|
5
|
+
import { csharpHttpclient } from './plugins/csharp/httpclient/httpclient.js';
|
|
6
|
+
import { csharpRestsharp } from './plugins/csharp/restsharp/restsharp.js';
|
|
7
|
+
import { clojureCljhttp } from './plugins/clojure/clj_http/clj_http.js';
|
|
8
|
+
import { goNative } from './plugins/go/native/native.js';
|
|
9
|
+
import { httpHttp11 } from './plugins/http/http11/http11.js';
|
|
10
|
+
import { javaAsynchttp } from './plugins/java/asynchttp/asynchttp.js';
|
|
11
|
+
import { jsFetch } from './plugins/js/fetch/fetch.js';
|
|
12
|
+
import { jsAxios } from './plugins/js/axios/axios.js';
|
|
13
|
+
import { jsOfetch } from './plugins/js/ofetch/ofetch.js';
|
|
14
|
+
import { jsJquery } from './plugins/js/jquery/jquery.js';
|
|
15
|
+
import { jsXhr } from './plugins/js/xhr/xhr.js';
|
|
16
|
+
import { kotlinOkhttp } from './plugins/kotlin/okhttp/okhttp.js';
|
|
17
|
+
import { nodeFetch } from './plugins/node/fetch/fetch.js';
|
|
18
|
+
import { nodeAxios } from './plugins/node/axios/axios.js';
|
|
19
|
+
import { nodeOfetch } from './plugins/node/ofetch/ofetch.js';
|
|
20
|
+
import { nodeUndici } from './plugins/node/undici/undici.js';
|
|
21
|
+
import { objcNsurlsession } from './plugins/objc/nsurlsession/nsurlsession.js';
|
|
22
|
+
import { ocamlCohttp } from './plugins/ocaml/cohttp/cohttp.js';
|
|
23
|
+
import { phpCurl } from './plugins/php/curl/curl.js';
|
|
24
|
+
import { phpGuzzle } from './plugins/php/guzzle/guzzle.js';
|
|
25
|
+
import { powershellWebrequest } from './plugins/powershell/webrequest/webrequest.js';
|
|
26
|
+
import { powershellRestmethod } from './plugins/powershell/restmethod/restmethod.js';
|
|
27
|
+
import { pythonPython3 } from './plugins/python/python3/python3.js';
|
|
28
|
+
import { pythonRequests } from './plugins/python/requests/requests.js';
|
|
29
|
+
import { rHttr } from './plugins/r/httr/httr.js';
|
|
30
|
+
import { rubyNative } from './plugins/ruby/native/native.js';
|
|
31
|
+
import { shellCurl } from './plugins/shell/curl/curl.js';
|
|
32
|
+
import { shellWget } from './plugins/shell/wget/wget.js';
|
|
33
|
+
import { shellHttpie } from './plugins/shell/httpie/httpie.js';
|
|
34
|
+
import { swiftNsurlsession } from './plugins/swift/nsurlsession/nsurlsession.js';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* All available clients
|
|
38
|
+
*/
|
|
39
|
+
const clients = [
|
|
40
|
+
{
|
|
41
|
+
key: 'c',
|
|
42
|
+
title: 'C',
|
|
43
|
+
default: 'libcurl',
|
|
44
|
+
clients: [cLibcurl],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: 'csharp',
|
|
48
|
+
title: 'C#',
|
|
49
|
+
default: 'restsharp',
|
|
50
|
+
clients: [csharpHttpclient, csharpRestsharp],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: 'clojure',
|
|
54
|
+
title: 'Clojure',
|
|
55
|
+
default: 'clj_http',
|
|
56
|
+
clients: [clojureCljhttp],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
key: 'go',
|
|
60
|
+
title: 'Go',
|
|
61
|
+
default: 'native',
|
|
62
|
+
clients: [goNative],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: 'http',
|
|
66
|
+
title: 'HTTP',
|
|
67
|
+
default: 'http1.1',
|
|
68
|
+
clients: [httpHttp11],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: 'java',
|
|
72
|
+
title: 'Java',
|
|
73
|
+
default: 'unirest',
|
|
74
|
+
clients: [javaAsynchttp, javaNethttp, javaOkhttp, javaUnirest],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: 'js',
|
|
78
|
+
title: 'JavaScript',
|
|
79
|
+
default: 'fetch',
|
|
80
|
+
clients: [jsFetch, jsAxios, jsOfetch, jsJquery, jsXhr],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: 'kotlin',
|
|
84
|
+
title: 'Kotlin',
|
|
85
|
+
default: 'okhttp',
|
|
86
|
+
clients: [kotlinOkhttp],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: 'node',
|
|
90
|
+
title: 'Node.js',
|
|
91
|
+
default: 'fetch',
|
|
92
|
+
clients: [nodeFetch, nodeAxios, nodeOfetch, nodeUndici],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: 'objc',
|
|
96
|
+
title: 'Objective-C',
|
|
97
|
+
default: 'nsurlsession',
|
|
98
|
+
clients: [objcNsurlsession],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: 'ocaml',
|
|
102
|
+
title: 'OCaml',
|
|
103
|
+
default: 'cohttp',
|
|
104
|
+
clients: [ocamlCohttp],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: 'php',
|
|
108
|
+
title: 'PHP',
|
|
109
|
+
default: 'curl',
|
|
110
|
+
clients: [phpCurl, phpGuzzle],
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
key: 'powershell',
|
|
114
|
+
title: 'Powershell',
|
|
115
|
+
default: 'webrequest',
|
|
116
|
+
clients: [powershellWebrequest, powershellRestmethod],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
key: 'python',
|
|
120
|
+
title: 'Python',
|
|
121
|
+
default: 'python3',
|
|
122
|
+
clients: [pythonPython3, pythonRequests],
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
key: 'r',
|
|
126
|
+
title: 'R',
|
|
127
|
+
default: 'httr',
|
|
128
|
+
clients: [rHttr],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
key: 'ruby',
|
|
132
|
+
title: 'Ruby',
|
|
133
|
+
default: 'native',
|
|
134
|
+
clients: [rubyNative],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: 'shell',
|
|
138
|
+
title: 'Shell',
|
|
139
|
+
default: 'curl',
|
|
140
|
+
clients: [shellCurl, shellWget, shellHttpie],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
key: 'swift',
|
|
144
|
+
title: 'Swift',
|
|
145
|
+
default: 'nsurlsession',
|
|
146
|
+
clients: [swiftNsurlsession],
|
|
147
|
+
},
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
export { clients };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class CodeBuilder {
|
|
2
|
+
/**
|
|
3
|
+
* Helper object to format and aggragate lines of code.
|
|
4
|
+
* Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
|
|
5
|
+
*/
|
|
6
|
+
constructor({ indent, join }?: {});
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=code-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-builder.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/esm/helpers/code-builder.ts"],"names":[],"mappings":"AAIA,qBAAa,WAAW;IACtB;;;OAGG;gBACS,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK;CAqDlC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
const DEFAULT_INDENTATION_CHARACTER = '';
|
|
4
|
+
const DEFAULT_LINE_JOIN = '\n';
|
|
5
|
+
class CodeBuilder {
|
|
6
|
+
/**
|
|
7
|
+
* Helper object to format and aggragate lines of code.
|
|
8
|
+
* Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
|
|
9
|
+
*/
|
|
10
|
+
constructor({ indent, join } = {}) {
|
|
11
|
+
this.postProcessors = [];
|
|
12
|
+
this.code = [];
|
|
13
|
+
this.indentationCharacter = DEFAULT_INDENTATION_CHARACTER;
|
|
14
|
+
this.lineJoin = DEFAULT_LINE_JOIN;
|
|
15
|
+
/**
|
|
16
|
+
* Add given indentation level to given line of code
|
|
17
|
+
*/
|
|
18
|
+
this.indentLine = (line, indentationLevel = 0) => {
|
|
19
|
+
const whitespace = this.indentationCharacter.repeat(indentationLevel);
|
|
20
|
+
return `${whitespace}${line}`;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Add the line at the beginning of the current lines
|
|
24
|
+
*/
|
|
25
|
+
this.unshift = (line, indentationLevel) => {
|
|
26
|
+
const newLine = this.indentLine(line, indentationLevel);
|
|
27
|
+
this.code.unshift(newLine);
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Add the line at the end of the current lines
|
|
31
|
+
*/
|
|
32
|
+
this.push = (line, indentationLevel) => {
|
|
33
|
+
const newLine = this.indentLine(line, indentationLevel);
|
|
34
|
+
this.code.push(newLine);
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Add an empty line at the end of current lines
|
|
38
|
+
*/
|
|
39
|
+
this.blank = () => {
|
|
40
|
+
this.code.push('');
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added
|
|
44
|
+
*/
|
|
45
|
+
this.join = () => {
|
|
46
|
+
const unreplacedCode = this.code.join(this.lineJoin);
|
|
47
|
+
const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);
|
|
48
|
+
return replacedOutput;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.
|
|
52
|
+
* To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.
|
|
53
|
+
*/
|
|
54
|
+
this.addPostProcessor = (postProcessor) => {
|
|
55
|
+
this.postProcessors = [...this.postProcessors, postProcessor];
|
|
56
|
+
};
|
|
57
|
+
this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;
|
|
58
|
+
this.lineJoin = join !== null && join !== void 0 ? join : DEFAULT_LINE_JOIN;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { CodeBuilder };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escape characters within a value to make it safe to insert directly into a
|
|
3
|
+
* snippet. Takes options which define the escape requirements.
|
|
4
|
+
*
|
|
5
|
+
* This is closely based on the JSON-stringify string serialization algorithm,
|
|
6
|
+
* but generalized for other string delimiters (e.g. " or ') and different escape
|
|
7
|
+
* characters (e.g. Powershell uses `)
|
|
8
|
+
*
|
|
9
|
+
* See https://tc39.es/ecma262/multipage/structured-data.html#sec-quotejsonstring
|
|
10
|
+
* for the complete original algorithm.
|
|
11
|
+
*/
|
|
12
|
+
export declare function escapeString(rawValue: any, options?: {}): string;
|
|
13
|
+
/**
|
|
14
|
+
* Make a string value safe to insert literally into a snippet within single quotes,
|
|
15
|
+
* by escaping problematic characters, including single quotes inside the string,
|
|
16
|
+
* backslashes, newlines, and other special characters.
|
|
17
|
+
*
|
|
18
|
+
* If value is not a string, it will be stringified with .toString() first.
|
|
19
|
+
*/
|
|
20
|
+
export declare const escapeForSingleQuotes: (value: any) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Make a string value safe to insert literally into a snippet within double quotes,
|
|
23
|
+
* by escaping problematic characters, including double quotes inside the string,
|
|
24
|
+
* backslashes, newlines, and other special characters.
|
|
25
|
+
*
|
|
26
|
+
* If value is not a string, it will be stringified with .toString() first.
|
|
27
|
+
*/
|
|
28
|
+
export declare const escapeForDoubleQuotes: (value: any) => string;
|
|
29
|
+
//# sourceMappingURL=escape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/esm/helpers/escape.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,QAAQ,KAAA,EAAE,OAAO,KAAK,UAmClD;AACD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,wBACO,CAAA;AACzC;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,wBACO,CAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* Escape characters within a value to make it safe to insert directly into a
|
|
5
|
+
* snippet. Takes options which define the escape requirements.
|
|
6
|
+
*
|
|
7
|
+
* This is closely based on the JSON-stringify string serialization algorithm,
|
|
8
|
+
* but generalized for other string delimiters (e.g. " or ') and different escape
|
|
9
|
+
* characters (e.g. Powershell uses `)
|
|
10
|
+
*
|
|
11
|
+
* See https://tc39.es/ecma262/multipage/structured-data.html#sec-quotejsonstring
|
|
12
|
+
* for the complete original algorithm.
|
|
13
|
+
*/
|
|
14
|
+
function escapeString(rawValue, options = {}) {
|
|
15
|
+
const { delimiter = '"', escapeChar = '\\', escapeNewlines = true } = options;
|
|
16
|
+
const stringValue = rawValue.toString();
|
|
17
|
+
return [...stringValue]
|
|
18
|
+
.map((c) => {
|
|
19
|
+
if (c === '\b') {
|
|
20
|
+
return `${escapeChar}b`;
|
|
21
|
+
}
|
|
22
|
+
else if (c === '\t') {
|
|
23
|
+
return `${escapeChar}t`;
|
|
24
|
+
}
|
|
25
|
+
else if (c === '\n') {
|
|
26
|
+
if (escapeNewlines) {
|
|
27
|
+
return `${escapeChar}n`;
|
|
28
|
+
}
|
|
29
|
+
return c; // Don't just continue, or this is caught by < \u0020
|
|
30
|
+
}
|
|
31
|
+
else if (c === '\f') {
|
|
32
|
+
return `${escapeChar}f`;
|
|
33
|
+
}
|
|
34
|
+
else if (c === '\r') {
|
|
35
|
+
if (escapeNewlines) {
|
|
36
|
+
return `${escapeChar}r`;
|
|
37
|
+
}
|
|
38
|
+
return c; // Don't just continue, or this is caught by < \u0020
|
|
39
|
+
}
|
|
40
|
+
else if (c === escapeChar) {
|
|
41
|
+
return escapeChar + escapeChar;
|
|
42
|
+
}
|
|
43
|
+
else if (c === delimiter) {
|
|
44
|
+
return escapeChar + delimiter;
|
|
45
|
+
}
|
|
46
|
+
else if (c < '\u0020' || c > '\u007E') {
|
|
47
|
+
// Delegate the trickier non-ASCII cases to the normal algorithm. Some of these
|
|
48
|
+
// are escaped as \uXXXX, whilst others are represented literally. Since we're
|
|
49
|
+
// using this primarily for header values that are generally (though not 100%
|
|
50
|
+
// strictly?) ASCII-only, this should almost never happen.
|
|
51
|
+
return JSON.stringify(c).slice(1, -1);
|
|
52
|
+
}
|
|
53
|
+
return c;
|
|
54
|
+
})
|
|
55
|
+
.join('');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Make a string value safe to insert literally into a snippet within single quotes,
|
|
59
|
+
* by escaping problematic characters, including single quotes inside the string,
|
|
60
|
+
* backslashes, newlines, and other special characters.
|
|
61
|
+
*
|
|
62
|
+
* If value is not a string, it will be stringified with .toString() first.
|
|
63
|
+
*/
|
|
64
|
+
const escapeForSingleQuotes = (value) => escapeString(value, { delimiter: "'" });
|
|
65
|
+
/**
|
|
66
|
+
* Make a string value safe to insert literally into a snippet within double quotes,
|
|
67
|
+
* by escaping problematic characters, including double quotes inside the string,
|
|
68
|
+
* backslashes, newlines, and other special characters.
|
|
69
|
+
*
|
|
70
|
+
* If value is not a string, it will be stringified with .toString() first.
|
|
71
|
+
*/
|
|
72
|
+
const escapeForDoubleQuotes = (value) => escapeString(value, { delimiter: '"' });
|
|
73
|
+
|
|
74
|
+
export { escapeForDoubleQuotes, escapeForSingleQuotes, escapeString };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-data.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/esm/helpers/form-data.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,MAAM,0BAMiB,CAAA;AAapC,eAAO,MAAM,gBAAgB,kEAW5B,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given a headers object retrieve a specific header out of it via a case-insensitive key.
|
|
3
|
+
*/
|
|
4
|
+
export declare const getHeaderName: (headers: any, name: any) => string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Given a headers object retrieve the contents of a header out of it via a case-insensitive key.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getHeader: (headers: any, name: any) => any;
|
|
9
|
+
/**
|
|
10
|
+
* Determine if a given case-insensitive header exists within a header object.
|
|
11
|
+
*/
|
|
12
|
+
export declare const hasHeader: (headers: any, name: any) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Determines if a given mimetype is JSON, or a variant of such.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isMimeTypeJSON: (mimeType: any) => boolean;
|
|
17
|
+
//# sourceMappingURL=headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/esm/helpers/headers.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,aAAa,iDAGvB,CAAA;AACH;;GAEG;AACH,eAAO,MAAM,SAAS,kCAMrB,CAAA;AACD;;GAEG;AACH,eAAO,MAAM,SAAS,sCACiB,CAAA;AAQvC;;GAEG;AACH,eAAO,MAAM,cAAc,4BAC2B,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* Given a headers object retrieve a specific header out of it via a case-insensitive key.
|
|
5
|
+
*/
|
|
6
|
+
const getHeaderName = (headers, name) => Object.keys(headers).find((header) => header.toLowerCase() === name.toLowerCase());
|
|
7
|
+
/**
|
|
8
|
+
* Given a headers object retrieve the contents of a header out of it via a case-insensitive key.
|
|
9
|
+
*/
|
|
10
|
+
const getHeader = (headers, name) => {
|
|
11
|
+
const headerName = getHeaderName(headers, name);
|
|
12
|
+
if (!headerName) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return headers[headerName];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Determine if a given case-insensitive header exists within a header object.
|
|
19
|
+
*/
|
|
20
|
+
const hasHeader = (headers, name) => Boolean(getHeaderName(headers, name));
|
|
21
|
+
|
|
22
|
+
export { getHeader, getHeaderName, hasHeader };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/esm/helpers/reducer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,sCAiBnB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use 'strong quoting' using single quotes so that we only need to deal with nested single quote characters.
|
|
3
|
+
* see: http://wiki.bash-hackers.org/syntax/quoting#strong_quoting
|
|
4
|
+
*/
|
|
5
|
+
export declare const quote: (value?: string) => string;
|
|
6
|
+
export declare const escape: (value: any) => any;
|
|
7
|
+
//# sourceMappingURL=shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/esm/helpers/shell.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,KAAK,4BAQjB,CAAA;AACD,eAAO,MAAM,MAAM,qBACgC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* Use 'strong quoting' using single quotes so that we only need to deal with nested single quote characters.
|
|
5
|
+
* see: http://wiki.bash-hackers.org/syntax/quoting#strong_quoting
|
|
6
|
+
*/
|
|
7
|
+
const quote = (value = '') => {
|
|
8
|
+
const safe = /^[a-z0-9-_/.@%^=:]+$/i;
|
|
9
|
+
const isShellSafe = safe.test(value);
|
|
10
|
+
if (isShellSafe) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
// if the value is not shell safe, then quote it
|
|
14
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
15
|
+
};
|
|
16
|
+
const escape = (value) => value.replace(/\r/g, '\\r').replace(/\n/g, '\\n');
|
|
17
|
+
|
|
18
|
+
export { escape, quote };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/esm/helpers/url.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,GAAG,KAAA,mBAWjC;AACD,qBAAa,WAAY,SAAQ,GAAG;IAClC,IAAI,IAAI,WAEP;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/esm/helpers/utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,aAMxB,CAAA;AACL,eAAO,MAAM,OAAO,wBAOnB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const libcurl: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
link: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
convert: ({ method, fullUrl, headersObj, allHeaders, postData }: {
|
|
9
|
+
method: any;
|
|
10
|
+
fullUrl: any;
|
|
11
|
+
headersObj: any;
|
|
12
|
+
allHeaders: any;
|
|
13
|
+
postData: any;
|
|
14
|
+
}) => any;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/c/libcurl/client.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;CA2CnB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CodeBuilder } from '../../../helpers/code-builder.js';
|
|
2
|
+
import { escapeForDoubleQuotes } from '../../../helpers/escape.js';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
const libcurl = {
|
|
7
|
+
info: {
|
|
8
|
+
key: 'libcurl',
|
|
9
|
+
title: 'Libcurl',
|
|
10
|
+
link: 'http://curl.haxx.se/libcurl',
|
|
11
|
+
description: 'Simple REST and HTTP API Client for C',
|
|
12
|
+
},
|
|
13
|
+
convert: ({ method, fullUrl, headersObj, allHeaders, postData }) => {
|
|
14
|
+
const { push, blank, join } = new CodeBuilder();
|
|
15
|
+
push('CURL *hnd = curl_easy_init();');
|
|
16
|
+
blank();
|
|
17
|
+
push(`curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "${method.toUpperCase()}");`);
|
|
18
|
+
push(`curl_easy_setopt(hnd, CURLOPT_URL, "${fullUrl}");`);
|
|
19
|
+
// Add headers, including the cookies
|
|
20
|
+
const headers = Object.keys(headersObj);
|
|
21
|
+
// construct headers
|
|
22
|
+
if (headers.length) {
|
|
23
|
+
blank();
|
|
24
|
+
push('struct curl_slist *headers = NULL;');
|
|
25
|
+
headers.forEach((header) => {
|
|
26
|
+
push(`headers = curl_slist_append(headers, "${header}: ${escapeForDoubleQuotes(headersObj[header])}");`);
|
|
27
|
+
});
|
|
28
|
+
push('curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);');
|
|
29
|
+
}
|
|
30
|
+
// construct cookies
|
|
31
|
+
if (allHeaders.cookie) {
|
|
32
|
+
blank();
|
|
33
|
+
push(`curl_easy_setopt(hnd, CURLOPT_COOKIE, "${allHeaders.cookie}");`);
|
|
34
|
+
}
|
|
35
|
+
if (postData === null || postData === void 0 ? void 0 : postData.text) {
|
|
36
|
+
blank();
|
|
37
|
+
push(`curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, ${JSON.stringify(postData.text)});`);
|
|
38
|
+
}
|
|
39
|
+
blank();
|
|
40
|
+
push('CURLcode ret = curl_easy_perform(hnd);');
|
|
41
|
+
return join();
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { libcurl };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const c: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
extname: string;
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
clientsById: {
|
|
9
|
+
libcurl: {
|
|
10
|
+
info: {
|
|
11
|
+
key: string;
|
|
12
|
+
title: string;
|
|
13
|
+
link: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
convert: ({ method, fullUrl, headersObj, allHeaders, postData }: {
|
|
17
|
+
method: any;
|
|
18
|
+
fullUrl: any;
|
|
19
|
+
headersObj: any;
|
|
20
|
+
allHeaders: any;
|
|
21
|
+
postData: any;
|
|
22
|
+
}) => any;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/esm/targets/c/target.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAUb,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const clj_http: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
link: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
convert: ({ queryObj, method, postData, url, allHeaders }: {
|
|
9
|
+
queryObj: any;
|
|
10
|
+
method: any;
|
|
11
|
+
postData: any;
|
|
12
|
+
url: any;
|
|
13
|
+
allHeaders: any;
|
|
14
|
+
}, options: any) => any;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/clojure/clj_http/client.ts"],"names":[],"mappings":"AAwFA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;CAqGpB,CAAA"}
|