@scalar/snippetz 0.5.5 → 0.6.2
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/index.js +5 -5
- package/dist/clients/index.js.map +1 -1
- package/dist/httpsnippet-lite/helpers/code-builder.d.ts +51 -0
- package/dist/httpsnippet-lite/helpers/code-builder.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/helpers → helpers}/code-builder.js +29 -0
- package/dist/httpsnippet-lite/helpers/code-builder.js.map +7 -0
- package/dist/httpsnippet-lite/{esm/helpers → helpers}/escape.d.ts +22 -3
- package/dist/httpsnippet-lite/helpers/escape.d.ts.map +1 -0
- package/dist/httpsnippet-lite/helpers/escape.js.map +7 -0
- package/dist/httpsnippet-lite/helpers/headers.d.ts +15 -0
- package/dist/httpsnippet-lite/helpers/headers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/helpers → helpers}/headers.js +2 -13
- package/dist/httpsnippet-lite/helpers/headers.js.map +7 -0
- package/dist/httpsnippet-lite/helpers/reducer.d.ts +2 -0
- package/dist/httpsnippet-lite/helpers/reducer.d.ts.map +1 -0
- package/dist/httpsnippet-lite/helpers/reducer.js +1 -0
- package/dist/httpsnippet-lite/{esm/helpers → helpers}/shell.d.ts +2 -2
- package/dist/httpsnippet-lite/helpers/shell.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/helpers → helpers}/shell.js +4 -4
- package/dist/httpsnippet-lite/helpers/shell.js.map +7 -0
- package/dist/httpsnippet-lite/helpers/snippet-request.d.ts +33 -0
- package/dist/httpsnippet-lite/helpers/snippet-request.d.ts.map +1 -0
- package/dist/httpsnippet-lite/helpers/snippet-request.js +1 -0
- package/dist/httpsnippet-lite/helpers/url.d.ts +4 -0
- package/dist/httpsnippet-lite/helpers/url.d.ts.map +1 -0
- package/dist/httpsnippet-lite/helpers/url.js +9 -0
- package/dist/httpsnippet-lite/helpers/url.js.map +7 -0
- package/dist/httpsnippet-lite/targets/c/libcurl/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/c/libcurl/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/c/libcurl/client.js +7 -13
- package/dist/httpsnippet-lite/targets/c/libcurl/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/clojure/clj_http/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/clojure/clj_http/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/clojure/clj_http/client.js +7 -3
- package/dist/httpsnippet-lite/targets/clojure/clj_http/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/csharp/restsharp/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/csharp/restsharp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/csharp/restsharp/client.js +8 -18
- package/dist/httpsnippet-lite/targets/csharp/restsharp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/go/native/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/go/native/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/go/native/client.js +14 -35
- package/dist/httpsnippet-lite/targets/go/native/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/java/asynchttp/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/java/asynchttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/java/asynchttp/client.js +1 -4
- package/dist/httpsnippet-lite/targets/java/asynchttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/java/nethttp/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/java/nethttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/java/nethttp/client.js +3 -6
- package/dist/httpsnippet-lite/targets/java/nethttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/java/okhttp/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/java/okhttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/java/okhttp/client.js +5 -8
- package/dist/httpsnippet-lite/targets/java/okhttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/java/unirest/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/java/unirest/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/java/unirest/client.js +4 -8
- package/dist/httpsnippet-lite/targets/java/unirest/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/javascript/axios/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/javascript/axios/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/javascript/axios/client.js +6 -10
- package/dist/httpsnippet-lite/targets/javascript/axios/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/javascript/jquery/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/javascript/jquery/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/javascript/jquery/client.js +5 -11
- package/dist/httpsnippet-lite/targets/javascript/jquery/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/javascript/xhr/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/javascript/xhr/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/javascript/xhr/client.js +7 -15
- package/dist/httpsnippet-lite/targets/javascript/xhr/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/kotlin/okhttp/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/kotlin/okhttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/kotlin/okhttp/client.js +6 -9
- package/dist/httpsnippet-lite/targets/kotlin/okhttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/node/axios/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/node/axios/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/node/axios/client.js +3 -5
- package/dist/httpsnippet-lite/targets/node/axios/client.js.map +7 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/objc/helpers.d.ts +5 -11
- package/dist/httpsnippet-lite/targets/objc/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/objc/helpers.js +7 -10
- package/dist/httpsnippet-lite/targets/objc/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/targets/objc/nsurlsession/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/objc/nsurlsession/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/objc/nsurlsession/client.js +14 -51
- package/dist/httpsnippet-lite/targets/objc/nsurlsession/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/ocaml/cohttp/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/ocaml/cohttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/ocaml/cohttp/client.js +3 -5
- package/dist/httpsnippet-lite/targets/ocaml/cohttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/powershell/common.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/powershell/common.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/powershell/common.js +6 -12
- package/dist/httpsnippet-lite/targets/powershell/common.js.map +7 -0
- package/dist/httpsnippet-lite/targets/powershell/restmethod/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/powershell/restmethod/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/targets/powershell/restmethod/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/powershell/webrequest/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/powershell/webrequest/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/targets/powershell/webrequest/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/python/python3/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/python/python3/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/python/python3/client.js +4 -8
- package/dist/httpsnippet-lite/targets/python/python3/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/r/httr/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/r/httr/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/r/httr/client.js +5 -12
- package/dist/httpsnippet-lite/targets/r/httr/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/ruby/native/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/ruby/native/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/ruby/native/client.js +2 -2
- package/dist/httpsnippet-lite/targets/ruby/native/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/shell/httpie/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/shell/httpie/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/shell/httpie/client.js +11 -11
- package/dist/httpsnippet-lite/targets/shell/httpie/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/shell/wget/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/shell/wget/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/shell/wget/client.js +6 -6
- package/dist/httpsnippet-lite/targets/shell/wget/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/swift/helpers.d.ts +15 -0
- package/dist/httpsnippet-lite/targets/swift/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/swift/helpers.js +9 -16
- package/dist/httpsnippet-lite/targets/swift/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/targets/swift/nsurlsession/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/swift/nsurlsession/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/swift/nsurlsession/client.js +11 -32
- package/dist/httpsnippet-lite/targets/swift/nsurlsession/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/target.d.ts +19 -0
- package/dist/httpsnippet-lite/targets/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/targets/target.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +2 -2
- package/dist/plugins/c/libcurl/index.d.ts +1 -1
- package/dist/plugins/c/libcurl/index.d.ts.map +1 -1
- package/dist/plugins/c/libcurl/index.js +4 -1
- package/dist/plugins/c/libcurl/index.js.map +2 -2
- package/dist/plugins/c/libcurl/libcurl.js +1 -1
- package/dist/plugins/c/libcurl/libcurl.js.map +1 -1
- package/dist/plugins/clojure/clj_http/clj_http.d.ts.map +1 -1
- package/dist/plugins/clojure/clj_http/clj_http.js +1 -1
- package/dist/plugins/clojure/clj_http/clj_http.js.map +2 -2
- package/dist/plugins/clojure/clj_http/index.d.ts +1 -1
- package/dist/plugins/clojure/clj_http/index.d.ts.map +1 -1
- package/dist/plugins/clojure/clj_http/index.js +4 -1
- package/dist/plugins/clojure/clj_http/index.js.map +2 -2
- package/dist/plugins/csharp/httpclient/index.d.ts +1 -1
- package/dist/plugins/csharp/httpclient/index.d.ts.map +1 -1
- package/dist/plugins/csharp/httpclient/index.js +4 -1
- package/dist/plugins/csharp/httpclient/index.js.map +2 -2
- package/dist/plugins/csharp/restsharp/index.d.ts +1 -1
- package/dist/plugins/csharp/restsharp/index.d.ts.map +1 -1
- package/dist/plugins/csharp/restsharp/index.js +4 -1
- package/dist/plugins/csharp/restsharp/index.js.map +2 -2
- package/dist/plugins/csharp/restsharp/restsharp.d.ts.map +1 -1
- package/dist/plugins/csharp/restsharp/restsharp.js +1 -1
- package/dist/plugins/csharp/restsharp/restsharp.js.map +2 -2
- package/dist/plugins/dart/http/index.d.ts +1 -1
- package/dist/plugins/dart/http/index.d.ts.map +1 -1
- package/dist/plugins/dart/http/index.js +4 -1
- package/dist/plugins/dart/http/index.js.map +2 -2
- package/dist/plugins/fsharp/httpclient/index.d.ts +1 -1
- package/dist/plugins/fsharp/httpclient/index.d.ts.map +1 -1
- package/dist/plugins/fsharp/httpclient/index.js +4 -1
- package/dist/plugins/fsharp/httpclient/index.js.map +2 -2
- package/dist/plugins/go/native/index.d.ts +1 -1
- package/dist/plugins/go/native/index.d.ts.map +1 -1
- package/dist/plugins/go/native/index.js +4 -1
- package/dist/plugins/go/native/index.js.map +2 -2
- package/dist/plugins/go/native/native.d.ts.map +1 -1
- package/dist/plugins/go/native/native.js +1 -1
- package/dist/plugins/go/native/native.js.map +2 -2
- package/dist/plugins/http/http11/index.d.ts +1 -1
- package/dist/plugins/http/http11/index.d.ts.map +1 -1
- package/dist/plugins/http/http11/index.js +4 -1
- package/dist/plugins/http/http11/index.js.map +2 -2
- package/dist/plugins/java/asynchttp/asynchttp.d.ts.map +1 -1
- package/dist/plugins/java/asynchttp/asynchttp.js +1 -1
- package/dist/plugins/java/asynchttp/asynchttp.js.map +2 -2
- package/dist/plugins/java/asynchttp/index.d.ts +1 -1
- package/dist/plugins/java/asynchttp/index.d.ts.map +1 -1
- package/dist/plugins/java/asynchttp/index.js +4 -1
- package/dist/plugins/java/asynchttp/index.js.map +2 -2
- package/dist/plugins/java/nethttp/index.d.ts +1 -1
- package/dist/plugins/java/nethttp/index.d.ts.map +1 -1
- package/dist/plugins/java/nethttp/index.js +4 -1
- package/dist/plugins/java/nethttp/index.js.map +2 -2
- package/dist/plugins/java/nethttp/nethttp.d.ts.map +1 -1
- package/dist/plugins/java/nethttp/nethttp.js +1 -1
- package/dist/plugins/java/nethttp/nethttp.js.map +2 -2
- package/dist/plugins/java/okhttp/index.d.ts +1 -1
- package/dist/plugins/java/okhttp/index.d.ts.map +1 -1
- package/dist/plugins/java/okhttp/index.js +4 -1
- package/dist/plugins/java/okhttp/index.js.map +2 -2
- package/dist/plugins/java/okhttp/okhttp.d.ts.map +1 -1
- package/dist/plugins/java/okhttp/okhttp.js +1 -1
- package/dist/plugins/java/okhttp/okhttp.js.map +2 -2
- package/dist/plugins/java/unirest/index.d.ts +1 -1
- package/dist/plugins/java/unirest/index.d.ts.map +1 -1
- package/dist/plugins/java/unirest/index.js +4 -1
- package/dist/plugins/java/unirest/index.js.map +2 -2
- package/dist/plugins/java/unirest/unirest.d.ts.map +1 -1
- package/dist/plugins/java/unirest/unirest.js +1 -1
- package/dist/plugins/java/unirest/unirest.js.map +2 -2
- package/dist/plugins/js/axios/axios.js +1 -1
- package/dist/plugins/js/axios/axios.js.map +1 -1
- package/dist/plugins/js/fetch/fetch.js +1 -1
- package/dist/plugins/js/fetch/fetch.js.map +2 -2
- package/dist/plugins/js/jquery/index.d.ts +1 -1
- package/dist/plugins/js/jquery/index.d.ts.map +1 -1
- package/dist/plugins/js/jquery/index.js +4 -1
- package/dist/plugins/js/jquery/index.js.map +2 -2
- package/dist/plugins/js/jquery/jquery.d.ts.map +1 -1
- package/dist/plugins/js/jquery/jquery.js +1 -1
- package/dist/plugins/js/jquery/jquery.js.map +2 -2
- package/dist/plugins/js/ofetch/index.d.ts +1 -1
- package/dist/plugins/js/ofetch/index.d.ts.map +1 -1
- package/dist/plugins/js/ofetch/index.js +4 -1
- package/dist/plugins/js/ofetch/index.js.map +2 -2
- package/dist/plugins/js/xhr/index.d.ts +1 -1
- package/dist/plugins/js/xhr/index.d.ts.map +1 -1
- package/dist/plugins/js/xhr/index.js +4 -1
- package/dist/plugins/js/xhr/index.js.map +2 -2
- package/dist/plugins/js/xhr/xhr.d.ts.map +1 -1
- package/dist/plugins/js/xhr/xhr.js +1 -1
- package/dist/plugins/js/xhr/xhr.js.map +2 -2
- package/dist/plugins/kotlin/okhttp/index.d.ts +1 -1
- package/dist/plugins/kotlin/okhttp/index.d.ts.map +1 -1
- package/dist/plugins/kotlin/okhttp/index.js +4 -1
- package/dist/plugins/kotlin/okhttp/index.js.map +2 -2
- package/dist/plugins/kotlin/okhttp/okhttp.d.ts.map +1 -1
- package/dist/plugins/kotlin/okhttp/okhttp.js +1 -1
- package/dist/plugins/kotlin/okhttp/okhttp.js.map +2 -2
- package/dist/plugins/node/axios/axios.js +1 -1
- package/dist/plugins/node/axios/axios.js.map +1 -1
- package/dist/plugins/node/axios/index.d.ts +1 -1
- package/dist/plugins/node/axios/index.d.ts.map +1 -1
- package/dist/plugins/node/axios/index.js +4 -1
- package/dist/plugins/node/axios/index.js.map +2 -2
- package/dist/plugins/node/fetch/fetch.js +1 -1
- package/dist/plugins/node/fetch/fetch.js.map +2 -2
- package/dist/plugins/node/fetch/index.d.ts +1 -1
- package/dist/plugins/node/fetch/index.d.ts.map +1 -1
- package/dist/plugins/node/fetch/index.js +4 -1
- package/dist/plugins/node/fetch/index.js.map +2 -2
- package/dist/plugins/node/ofetch/index.d.ts +1 -1
- package/dist/plugins/node/ofetch/index.d.ts.map +1 -1
- package/dist/plugins/node/ofetch/index.js +4 -1
- package/dist/plugins/node/ofetch/index.js.map +2 -2
- package/dist/plugins/node/undici/index.d.ts +1 -1
- package/dist/plugins/node/undici/index.d.ts.map +1 -1
- package/dist/plugins/node/undici/index.js +4 -1
- package/dist/plugins/node/undici/index.js.map +2 -2
- package/dist/plugins/node/undici/undici.js +1 -1
- package/dist/plugins/node/undici/undici.js.map +2 -2
- package/dist/plugins/objc/nsurlsession/index.d.ts +1 -1
- package/dist/plugins/objc/nsurlsession/index.d.ts.map +1 -1
- package/dist/plugins/objc/nsurlsession/index.js +4 -1
- package/dist/plugins/objc/nsurlsession/index.js.map +2 -2
- package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts.map +1 -1
- package/dist/plugins/objc/nsurlsession/nsurlsession.js +1 -1
- package/dist/plugins/objc/nsurlsession/nsurlsession.js.map +2 -2
- package/dist/plugins/ocaml/cohttp/cohttp.d.ts.map +1 -1
- package/dist/plugins/ocaml/cohttp/cohttp.js +1 -1
- package/dist/plugins/ocaml/cohttp/cohttp.js.map +2 -2
- package/dist/plugins/ocaml/cohttp/index.d.ts +1 -1
- package/dist/plugins/ocaml/cohttp/index.d.ts.map +1 -1
- package/dist/plugins/ocaml/cohttp/index.js +4 -1
- package/dist/plugins/ocaml/cohttp/index.js.map +2 -2
- package/dist/plugins/php/curl/index.d.ts +1 -1
- package/dist/plugins/php/curl/index.d.ts.map +1 -1
- package/dist/plugins/php/curl/index.js +4 -1
- package/dist/plugins/php/curl/index.js.map +2 -2
- package/dist/plugins/php/guzzle/index.d.ts +1 -1
- package/dist/plugins/php/guzzle/index.d.ts.map +1 -1
- package/dist/plugins/php/guzzle/index.js +4 -1
- package/dist/plugins/php/guzzle/index.js.map +2 -2
- package/dist/plugins/powershell/restmethod/index.d.ts +1 -1
- package/dist/plugins/powershell/restmethod/index.d.ts.map +1 -1
- package/dist/plugins/powershell/restmethod/index.js +4 -1
- package/dist/plugins/powershell/restmethod/index.js.map +2 -2
- package/dist/plugins/powershell/restmethod/restmethod.d.ts.map +1 -1
- package/dist/plugins/powershell/restmethod/restmethod.js +1 -1
- package/dist/plugins/powershell/restmethod/restmethod.js.map +2 -2
- package/dist/plugins/powershell/webrequest/index.d.ts +1 -1
- package/dist/plugins/powershell/webrequest/index.d.ts.map +1 -1
- package/dist/plugins/powershell/webrequest/index.js +4 -1
- package/dist/plugins/powershell/webrequest/index.js.map +2 -2
- package/dist/plugins/powershell/webrequest/webrequest.d.ts.map +1 -1
- package/dist/plugins/powershell/webrequest/webrequest.js +1 -1
- package/dist/plugins/powershell/webrequest/webrequest.js.map +2 -2
- package/dist/plugins/python/httpx/async.d.ts.map +1 -1
- package/dist/plugins/python/httpx/async.js.map +2 -2
- package/dist/plugins/python/httpx/index.d.ts +2 -2
- package/dist/plugins/python/httpx/index.d.ts.map +1 -1
- package/dist/plugins/python/httpx/index.js +6 -2
- package/dist/plugins/python/httpx/index.js.map +2 -2
- package/dist/plugins/python/httpx/sync.d.ts.map +1 -1
- package/dist/plugins/python/httpx/sync.js.map +2 -2
- package/dist/plugins/python/python3/index.d.ts +1 -1
- package/dist/plugins/python/python3/index.d.ts.map +1 -1
- package/dist/plugins/python/python3/index.js +4 -1
- package/dist/plugins/python/python3/index.js.map +2 -2
- package/dist/plugins/python/python3/python3.d.ts.map +1 -1
- package/dist/plugins/python/python3/python3.js +1 -1
- package/dist/plugins/python/python3/python3.js.map +2 -2
- package/dist/plugins/python/requests/index.d.ts +1 -1
- package/dist/plugins/python/requests/index.d.ts.map +1 -1
- package/dist/plugins/python/requests/index.js +4 -1
- package/dist/plugins/python/requests/index.js.map +2 -2
- package/dist/plugins/python/requests/requests.d.ts.map +1 -1
- package/dist/plugins/python/requests/requests.js.map +2 -2
- package/dist/plugins/r/httr/httr.d.ts.map +1 -1
- package/dist/plugins/r/httr/httr.js +1 -1
- package/dist/plugins/r/httr/httr.js.map +2 -2
- package/dist/plugins/r/httr/index.d.ts +1 -1
- package/dist/plugins/r/httr/index.d.ts.map +1 -1
- package/dist/plugins/r/httr/index.js +4 -1
- package/dist/plugins/r/httr/index.js.map +2 -2
- package/dist/plugins/ruby/native/index.d.ts +1 -1
- package/dist/plugins/ruby/native/index.d.ts.map +1 -1
- package/dist/plugins/ruby/native/index.js +4 -1
- package/dist/plugins/ruby/native/index.js.map +2 -2
- package/dist/plugins/ruby/native/native.d.ts.map +1 -1
- package/dist/plugins/ruby/native/native.js +1 -1
- package/dist/plugins/ruby/native/native.js.map +2 -2
- package/dist/plugins/rust/reqwest/index.d.ts +1 -1
- package/dist/plugins/rust/reqwest/index.d.ts.map +1 -1
- package/dist/plugins/rust/reqwest/index.js +4 -1
- package/dist/plugins/rust/reqwest/index.js.map +2 -2
- package/dist/plugins/shell/curl/index.d.ts +1 -1
- package/dist/plugins/shell/curl/index.d.ts.map +1 -1
- package/dist/plugins/shell/curl/index.js +4 -1
- package/dist/plugins/shell/curl/index.js.map +2 -2
- package/dist/plugins/shell/httpie/httpie.d.ts.map +1 -1
- package/dist/plugins/shell/httpie/httpie.js +1 -1
- package/dist/plugins/shell/httpie/httpie.js.map +2 -2
- package/dist/plugins/shell/httpie/index.d.ts +1 -1
- package/dist/plugins/shell/httpie/index.d.ts.map +1 -1
- package/dist/plugins/shell/httpie/index.js +4 -1
- package/dist/plugins/shell/httpie/index.js.map +2 -2
- package/dist/plugins/shell/wget/index.d.ts +1 -1
- package/dist/plugins/shell/wget/index.d.ts.map +1 -1
- package/dist/plugins/shell/wget/index.js +4 -1
- package/dist/plugins/shell/wget/index.js.map +2 -2
- package/dist/plugins/shell/wget/wget.d.ts.map +1 -1
- package/dist/plugins/shell/wget/wget.js +1 -1
- package/dist/plugins/shell/wget/wget.js.map +2 -2
- package/dist/plugins/swift/nsurlsession/index.d.ts +1 -1
- package/dist/plugins/swift/nsurlsession/index.d.ts.map +1 -1
- package/dist/plugins/swift/nsurlsession/index.js +4 -1
- package/dist/plugins/swift/nsurlsession/index.js.map +2 -2
- package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts.map +1 -1
- package/dist/plugins/swift/nsurlsession/nsurlsession.js +1 -1
- package/dist/plugins/swift/nsurlsession/nsurlsession.js.map +2 -2
- package/dist/snippetz.d.ts +2 -2
- package/dist/snippetz.d.ts.map +1 -1
- package/dist/snippetz.js.map +2 -2
- package/dist/utils/convertWithHttpSnippetLite.js +1 -1
- package/dist/utils/convertWithHttpSnippetLite.js.map +2 -2
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -1
- package/dist/utils/index.js.map +2 -2
- package/package.json +4 -3
- package/dist/httpsnippet-lite/esm/helpers/code-builder.d.ts +0 -8
- package/dist/httpsnippet-lite/esm/helpers/code-builder.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/code-builder.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/escape.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/escape.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/form-data.d.ts +0 -3
- package/dist/httpsnippet-lite/esm/helpers/form-data.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/form-data.js +0 -59
- package/dist/httpsnippet-lite/esm/helpers/form-data.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/headers.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/helpers/headers.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/headers.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/reducer.d.ts +0 -2
- package/dist/httpsnippet-lite/esm/helpers/reducer.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/reducer.js +0 -20
- package/dist/httpsnippet-lite/esm/helpers/reducer.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/shell.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/shell.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/url.d.ts +0 -5
- package/dist/httpsnippet-lite/esm/helpers/url.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/url.js +0 -20
- package/dist/httpsnippet-lite/esm/helpers/url.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/utils.d.ts +0 -3
- package/dist/httpsnippet-lite/esm/helpers/utils.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/utils.js +0 -16
- package/dist/httpsnippet-lite/esm/helpers/utils.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts +0 -16
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/c/target.d.ts +0 -26
- package/dist/httpsnippet-lite/esm/targets/c/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/c/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/c/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.d.ts +0 -16
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/clojure/target.d.ts +0 -26
- package/dist/httpsnippet-lite/esm/targets/clojure/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/clojure/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/clojure/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/csharp/target.d.ts +0 -27
- package/dist/httpsnippet-lite/esm/targets/csharp/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/csharp/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/csharp/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/go/native/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/go/target.d.ts +0 -25
- package/dist/httpsnippet-lite/esm/targets/go/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/go/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/go/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/java/target.d.ts +0 -67
- package/dist/httpsnippet-lite/esm/targets/java/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/java/target.js +0 -22
- package/dist/httpsnippet-lite/esm/targets/java/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.d.ts +0 -16
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/javascript/target.d.ts +0 -55
- package/dist/httpsnippet-lite/esm/targets/javascript/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/javascript/target.js +0 -22
- package/dist/httpsnippet-lite/esm/targets/javascript/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.d.ts +0 -25
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.d.ts +0 -16
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/node/request/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/node/request/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/node/request/client.js +0 -100
- package/dist/httpsnippet-lite/esm/targets/node/request/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/node/target.d.ts +0 -45
- package/dist/httpsnippet-lite/esm/targets/node/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/node/target.js +0 -24
- package/dist/httpsnippet-lite/esm/targets/node/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/objc/target.d.ts +0 -25
- package/dist/httpsnippet-lite/esm/targets/objc/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/objc/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/objc/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.d.ts +0 -25
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/php/helpers.d.ts +0 -3
- package/dist/httpsnippet-lite/esm/targets/php/helpers.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js +0 -72
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.js +0 -85
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.js +0 -127
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/php/target.d.ts +0 -45
- package/dist/httpsnippet-lite/esm/targets/php/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/php/target.js +0 -22
- package/dist/httpsnippet-lite/esm/targets/php/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/powershell/common.d.ts +0 -10
- package/dist/httpsnippet-lite/esm/targets/powershell/common.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/powershell/common.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.d.ts +0 -18
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/powershell/target.d.ts +0 -45
- package/dist/httpsnippet-lite/esm/targets/powershell/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/powershell/target.js +0 -18
- package/dist/httpsnippet-lite/esm/targets/powershell/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.d.ts +0 -18
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/python/helpers.d.ts +0 -9
- package/dist/httpsnippet-lite/esm/targets/python/helpers.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js +0 -68
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.d.ts +0 -19
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/python/target.d.ts +0 -29
- package/dist/httpsnippet-lite/esm/targets/python/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/python/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/python/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/r/target.d.ts +0 -27
- package/dist/httpsnippet-lite/esm/targets/r/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/r/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/r/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.d.ts +0 -16
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/ruby/target.d.ts +0 -26
- package/dist/httpsnippet-lite/esm/targets/ruby/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/ruby/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/ruby/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/shell/target.d.ts +0 -42
- package/dist/httpsnippet-lite/esm/targets/shell/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/shell/target.js +0 -20
- package/dist/httpsnippet-lite/esm/targets/shell/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/swift/target.d.ts +0 -25
- package/dist/httpsnippet-lite/esm/targets/swift/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/swift/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/swift/target.js.map +0 -7
- package/dist/httpsnippet-lite/types/helpers/code-builder.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/escape.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/form-data.d.js +0 -28
- package/dist/httpsnippet-lite/types/helpers/form-data.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/helpers/headers.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/reducer.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/reducer.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/helpers/shell.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/shell.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/helpers/url.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/url.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/helpers/utils.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/utils.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/httpsnippet.d.js +0 -19
- package/dist/httpsnippet-lite/types/httpsnippet.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/c/libcurl/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/c/libcurl/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/c/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/c/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/clojure/clj_http/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/clojure/clj_http/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/clojure/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/clojure/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/csharp/restsharp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/csharp/restsharp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/csharp/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/csharp/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/dart/http/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/dart/http/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/dart/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/dart/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/go/native/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/go/native/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/go/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/go/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/http/http1.1/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/http/http1.1/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/http/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/http/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/java/asynchttp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/java/asynchttp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/java/nethttp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/java/nethttp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/java/okhttp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/java/okhttp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/java/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/java/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/java/unirest/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/java/unirest/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/javascript/axios/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/javascript/axios/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/javascript/fetch/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/javascript/fetch/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/javascript/jquery/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/javascript/jquery/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/javascript/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/javascript/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/javascript/xhr/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/javascript/xhr/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/kotlin/okhttp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/kotlin/okhttp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/kotlin/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/kotlin/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/axios/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/axios/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/fetch/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/fetch/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/native/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/native/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/request/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/request/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/unirest/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/unirest/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/objc/helpers.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/objc/helpers.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/objc/nsurlsession/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/objc/nsurlsession/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/objc/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/objc/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/ocaml/cohttp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/ocaml/cohttp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/ocaml/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/ocaml/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/curl/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/curl/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/guzzle/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/guzzle/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/helpers.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/helpers.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/http1/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/http1/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/http2/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/http2/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/powershell/common.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/powershell/common.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/powershell/restmethod/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/powershell/restmethod/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/powershell/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/powershell/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/powershell/webrequest/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/powershell/webrequest/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/python/helpers.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/python/helpers.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/python/python3/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/python/python3/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/python/requests/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/python/requests/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/python/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/python/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/r/httr/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/r/httr/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/r/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/r/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/ruby/native/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/ruby/native/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/ruby/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/ruby/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/shell/curl/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/shell/curl/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/shell/httpie/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/shell/httpie/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/shell/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/shell/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/shell/wget/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/shell/wget/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/swift/helpers.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/swift/helpers.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/swift/nsurlsession/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/swift/nsurlsession/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/swift/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/swift/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/targets.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/targets.d.js.map +0 -7
- /package/dist/httpsnippet-lite/{esm/helpers → helpers}/escape.js +0 -0
- /package/dist/httpsnippet-lite/{types/helpers/code-builder.d.js.map → helpers/reducer.js.map} +0 -0
- /package/dist/httpsnippet-lite/{types/helpers/escape.d.js.map → helpers/snippet-request.js.map} +0 -0
- /package/dist/httpsnippet-lite/{esm/targets → targets}/powershell/restmethod/client.js +0 -0
- /package/dist/httpsnippet-lite/{esm/targets → targets}/powershell/webrequest/client.js +0 -0
- /package/dist/httpsnippet-lite/{types/helpers/headers.d.js.map → targets/target.js.map} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* HTTP code snippet generator for native Python3.
|
|
4
|
+
*
|
|
5
|
+
* @author
|
|
6
|
+
* @montanaflynn
|
|
7
|
+
*
|
|
8
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
+
*/
|
|
10
|
+
import type { Client } from '../../../../httpsnippet-lite/targets/target.js';
|
|
11
|
+
export declare const python3: Client;
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/python/python3/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,eAAO,MAAM,OAAO,EAAE,MAsErB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBuilder } from "
|
|
2
|
-
import { escapeForDoubleQuotes } from "
|
|
1
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
2
|
+
import { escapeForDoubleQuotes } from "../../../../httpsnippet-lite/helpers/escape.js";
|
|
3
3
|
const python3 = {
|
|
4
4
|
info: {
|
|
5
5
|
key: "python3",
|
|
@@ -23,9 +23,7 @@ const python3 = {
|
|
|
23
23
|
push(`conn = http.client.HTTPConnection("${host}")`);
|
|
24
24
|
blank();
|
|
25
25
|
}
|
|
26
|
-
const payload = JSON.stringify(
|
|
27
|
-
postData === null || postData === void 0 ? void 0 : postData.text
|
|
28
|
-
);
|
|
26
|
+
const payload = JSON.stringify(postData === null || postData === void 0 ? void 0 : postData.text);
|
|
29
27
|
if (payload) {
|
|
30
28
|
push(`payload = ${payload}`);
|
|
31
29
|
blank();
|
|
@@ -34,9 +32,7 @@ const python3 = {
|
|
|
34
32
|
const headerCount = Object.keys(headers).length;
|
|
35
33
|
if (headerCount === 1) {
|
|
36
34
|
for (const header in headers) {
|
|
37
|
-
push(
|
|
38
|
-
`headers = { '${header}': "${escapeForDoubleQuotes(headers[header])}" }`
|
|
39
|
-
);
|
|
35
|
+
push(`headers = { '${header}': "${escapeForDoubleQuotes(headers[header])}" }`);
|
|
40
36
|
blank();
|
|
41
37
|
}
|
|
42
38
|
} else if (headerCount > 1) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/python/python3/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @description\n * HTTP code snippet generator for native Python3.\n *\n * @author\n * @montanaflynn\n *\n * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.\n */\n\nimport { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { escapeForDoubleQuotes } from '@/httpsnippet-lite/helpers/escape'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const python3: Client = {\n info: {\n key: 'python3',\n title: 'http.client',\n link: 'https://docs.python.org/3/library/http.client.html',\n description: 'Python3 HTTP Client',\n },\n convert: ({ uriObj: { path, protocol, host }, postData, allHeaders, method }, options = {}) => {\n const { insecureSkipVerify = false } = options\n const { push, blank, join } = new CodeBuilder()\n // Start Request\n push('import http.client')\n if (insecureSkipVerify) {\n push('import ssl')\n }\n blank()\n // Check which protocol to be used for the client connection\n if (protocol === 'https:') {\n const sslContext = insecureSkipVerify ? ', context = ssl._create_unverified_context()' : ''\n push(`conn = http.client.HTTPSConnection(\"${host}\"${sslContext})`)\n blank()\n } else {\n push(`conn = http.client.HTTPConnection(\"${host}\")`)\n blank()\n }\n // Create payload string if it exists\n const payload = JSON.stringify(postData === null || postData === void 0 ? void 0 : postData.text)\n if (payload) {\n push(`payload = ${payload}`)\n blank()\n }\n // Create Headers\n const headers = allHeaders\n const headerCount = Object.keys(headers).length\n if (headerCount === 1) {\n for (const header in headers) {\n push(`headers = { '${header}': \"${escapeForDoubleQuotes(headers[header] as string)}\" }`)\n blank()\n }\n } else if (headerCount > 1) {\n let count = 1\n push('headers = {')\n for (const header in headers) {\n if (count++ !== headerCount) {\n push(` '${header}': \"${escapeForDoubleQuotes(headers[header] as string)}\",`)\n } else {\n push(` '${header}': \"${escapeForDoubleQuotes(headers[header] as string)}\"`)\n }\n }\n push('}')\n blank()\n }\n // Make Request\n if (payload && headerCount) {\n push(`conn.request(\"${method}\", \"${path}\", payload, headers)`)\n } else if (payload && !headerCount) {\n push(`conn.request(\"${method}\", \"${path}\", payload)`)\n } else if (!payload && headerCount) {\n push(`conn.request(\"${method}\", \"${path}\", headers=headers)`)\n } else {\n push(`conn.request(\"${method}\", \"${path}\")`)\n }\n // Get Response\n blank()\n push('res = conn.getresponse()')\n push('data = res.read()')\n blank()\n push('print(data.decode(\"utf-8\"))')\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "AAUA,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AAG/B,MAAM,UAAkB;AAAA,EAC7B,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,UAAU,KAAK,GAAG,UAAU,YAAY,OAAO,GAAG,UAAU,CAAC,MAAM;AAC7F,UAAM,EAAE,qBAAqB,MAAM,IAAI;AACvC,UAAM,EAAE,MAAM,OAAO,KAAK,IAAI,IAAI,YAAY;AAE9C,SAAK,oBAAoB;AACzB,QAAI,oBAAoB;AACtB,WAAK,YAAY;AAAA,IACnB;AACA,UAAM;AAEN,QAAI,aAAa,UAAU;AACzB,YAAM,aAAa,qBAAqB,iDAAiD;AACzF,WAAK,uCAAuC,IAAI,IAAI,UAAU,GAAG;AACjE,YAAM;AAAA,IACR,OAAO;AACL,WAAK,sCAAsC,IAAI,IAAI;AACnD,YAAM;AAAA,IACR;AAEA,UAAM,UAAU,KAAK,UAAU,aAAa,QAAQ,aAAa,SAAS,SAAS,SAAS,IAAI;AAChG,QAAI,SAAS;AACX,WAAK,aAAa,OAAO,EAAE;AAC3B,YAAM;AAAA,IACR;AAEA,UAAM,UAAU;AAChB,UAAM,cAAc,OAAO,KAAK,OAAO,EAAE;AACzC,QAAI,gBAAgB,GAAG;AACrB,iBAAW,UAAU,SAAS;AAC5B,aAAK,gBAAgB,MAAM,OAAO,sBAAsB,QAAQ,MAAM,CAAW,CAAC,KAAK;AACvF,cAAM;AAAA,MACR;AAAA,IACF,WAAW,cAAc,GAAG;AAC1B,UAAI,QAAQ;AACZ,WAAK,aAAa;AAClB,iBAAW,UAAU,SAAS;AAC5B,YAAI,YAAY,aAAa;AAC3B,eAAK,QAAQ,MAAM,OAAO,sBAAsB,QAAQ,MAAM,CAAW,CAAC,IAAI;AAAA,QAChF,OAAO;AACL,eAAK,QAAQ,MAAM,OAAO,sBAAsB,QAAQ,MAAM,CAAW,CAAC,GAAG;AAAA,QAC/E;AAAA,MACF;AACA,WAAK,GAAG;AACR,YAAM;AAAA,IACR;AAEA,QAAI,WAAW,aAAa;AAC1B,WAAK,iBAAiB,MAAM,OAAO,IAAI,sBAAsB;AAAA,IAC/D,WAAW,WAAW,CAAC,aAAa;AAClC,WAAK,iBAAiB,MAAM,OAAO,IAAI,aAAa;AAAA,IACtD,WAAW,CAAC,WAAW,aAAa;AAClC,WAAK,iBAAiB,MAAM,OAAO,IAAI,qBAAqB;AAAA,IAC9D,OAAO;AACL,WAAK,iBAAiB,MAAM,OAAO,IAAI,IAAI;AAAA,IAC7C;AAEA,UAAM;AACN,SAAK,0BAA0B;AAC/B,SAAK,mBAAmB;AACxB,UAAM;AACN,SAAK,6BAA6B;AAClC,WAAO,KAAK;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* HTTP code snippet generator for R using httr
|
|
4
|
+
*
|
|
5
|
+
* @author
|
|
6
|
+
* @gabrielakoreeda
|
|
7
|
+
*
|
|
8
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
+
*/
|
|
10
|
+
import type { Client } from '../../../../httpsnippet-lite/targets/target.js';
|
|
11
|
+
export declare const httr: Client;
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/r/httr/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,eAAO,MAAM,IAAI,EAAE,MAqGlB,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { CodeBuilder } from "
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
escapeForSingleQuotes
|
|
5
|
-
} from "../../../helpers/escape.js";
|
|
6
|
-
import { getHeader } from "../../../helpers/headers.js";
|
|
1
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
2
|
+
import { escapeForDoubleQuotes, escapeForSingleQuotes } from "../../../../httpsnippet-lite/helpers/escape.js";
|
|
3
|
+
import { getHeader } from "../../../../httpsnippet-lite/helpers/headers.js";
|
|
7
4
|
const httr = {
|
|
8
5
|
info: {
|
|
9
6
|
key: "httr",
|
|
@@ -38,9 +35,7 @@ const httr = {
|
|
|
38
35
|
push(")");
|
|
39
36
|
blank();
|
|
40
37
|
}
|
|
41
|
-
const payload = JSON.stringify(
|
|
42
|
-
postData === null || postData === void 0 ? void 0 : postData.text
|
|
43
|
-
);
|
|
38
|
+
const payload = JSON.stringify(postData === null || postData === void 0 ? void 0 : postData.text);
|
|
44
39
|
if (payload) {
|
|
45
40
|
push(`payload <- ${payload}`);
|
|
46
41
|
blank();
|
|
@@ -70,9 +65,7 @@ const httr = {
|
|
|
70
65
|
const setCookies = cookieHeader ? `set_cookies(\`${String(cookieHeader).replace(/;/g, '", `').replace(/` /g, "`").replace(/[=]/g, '` = "')}")` : void 0;
|
|
71
66
|
const setAccept = acceptHeader ? `accept("${escapeForDoubleQuotes(acceptHeader)}")` : void 0;
|
|
72
67
|
const setContentType = `content_type("${escapeForDoubleQuotes((_b = postData === null || postData === void 0 ? void 0 : postData.mimeType) !== null && _b !== void 0 ? _b : "application/octet-stream")}")`;
|
|
73
|
-
const otherHeaders = Object.entries(allHeaders).filter(
|
|
74
|
-
([key]) => !["cookie", "accept", "content-type"].includes(key.toLowerCase())
|
|
75
|
-
).map(([key, value]) => `'${key}' = '${escapeForSingleQuotes(value)}'`).join(", ");
|
|
68
|
+
const otherHeaders = Object.entries(allHeaders).filter(([key]) => !["cookie", "accept", "content-type"].includes(key.toLowerCase())).map(([key, value]) => `'${key}' = '${escapeForSingleQuotes(value)}'`).join(", ");
|
|
76
69
|
const setHeaders = otherHeaders ? `add_headers(${otherHeaders})` : void 0;
|
|
77
70
|
let request = `response <- VERB("${method}", url`;
|
|
78
71
|
if (payload) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/r/httr/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @description\n * HTTP code snippet generator for R using httr\n *\n * @author\n * @gabrielakoreeda\n *\n * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.\n */\n\nimport { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { escapeForDoubleQuotes, escapeForSingleQuotes } from '@/httpsnippet-lite/helpers/escape'\nimport { getHeader } from '@/httpsnippet-lite/helpers/headers'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const httr: Client = {\n info: {\n key: 'httr',\n title: 'httr',\n link: 'https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html',\n description: 'httr: Tools for Working with URLs and HTTP',\n },\n convert: ({ url, queryObj, queryString, postData, allHeaders, method }, options = {}) => {\n let _a, _b\n // Start snippet\n const { push, blank, join } = new CodeBuilder({\n indent: (_a = options.indent) !== null && _a !== void 0 ? _a : ' ',\n })\n // Import httr\n push('library(httr)')\n blank()\n // Set URL\n push(`url <- \"${url}\"`)\n blank()\n // Construct query string\n const qs = queryObj\n delete queryObj.key\n const entries = Object.entries(qs)\n const entriesCount = entries.length\n if (entriesCount === 1) {\n const entry = entries[0]!\n push(`queryString <- list(${entry[0]} = \"${entry[1]}\")`)\n blank()\n } else if (entriesCount > 1) {\n push('queryString <- list(')\n entries.forEach(([key, value], i) => {\n const isLastItem = i !== entriesCount - 1\n const maybeComma = isLastItem ? ',' : ''\n push(`${key} = \"${value}\"${maybeComma}`, 1)\n })\n push(')')\n blank()\n }\n // Construct payload\n const payload = JSON.stringify(postData === null || postData === void 0 ? void 0 : postData.text)\n if (payload) {\n push(`payload <- ${payload}`)\n blank()\n }\n // Define encode\n if (postData && (postData.text || postData.jsonObj || postData.params)) {\n switch (postData.mimeType) {\n case 'application/x-www-form-urlencoded':\n push('encode <- \"form\"')\n blank()\n break\n case 'application/json':\n push('encode <- \"json\"')\n blank()\n break\n case 'multipart/form-data':\n push('encode <- \"multipart\"')\n blank()\n break\n default:\n push('encode <- \"raw\"')\n blank()\n break\n }\n }\n // Construct headers\n const cookieHeader = getHeader(allHeaders, 'cookie')\n const acceptHeader = getHeader(allHeaders, 'accept')\n const setCookies = cookieHeader\n ? `set_cookies(\\`${String(cookieHeader).replace(/;/g, '\", `').replace(/` /g, '`').replace(/[=]/g, '` = \"')}\")`\n : undefined\n const setAccept = acceptHeader ? `accept(\"${escapeForDoubleQuotes(acceptHeader as string)}\")` : undefined\n const setContentType = `content_type(\"${escapeForDoubleQuotes((_b = postData === null || postData === void 0 ? void 0 : postData.mimeType) !== null && _b !== void 0 ? _b : 'application/octet-stream')}\")`\n const otherHeaders = Object.entries(allHeaders)\n // These headers are all handled separately:\n .filter(([key]) => !['cookie', 'accept', 'content-type'].includes(key.toLowerCase()))\n .map(([key, value]) => `'${key}' = '${escapeForSingleQuotes(value as string)}'`)\n .join(', ')\n const setHeaders = otherHeaders ? `add_headers(${otherHeaders})` : undefined\n // Construct request\n let request = `response <- VERB(\"${method}\", url`\n if (payload) {\n request += ', body = payload'\n }\n if (queryString.length) {\n request += ', query = queryString'\n }\n const headerAdditions = [setHeaders, setContentType, setAccept, setCookies].filter((x) => !!x).join(', ')\n if (headerAdditions) {\n request += `, ${headerAdditions}`\n }\n if (postData && (postData.text || postData.jsonObj || postData.params)) {\n request += ', encode = encode'\n }\n request += ')'\n push(request)\n blank()\n // Print response\n push('content(response, \"text\")')\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/ruby/native/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,eAAO,MAAM,MAAM,EAAE,MAkEpB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBuilder } from "
|
|
2
|
-
import { escapeForSingleQuotes } from "
|
|
1
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
2
|
+
import { escapeForSingleQuotes } from "../../../../httpsnippet-lite/helpers/escape.js";
|
|
3
3
|
const native = {
|
|
4
4
|
info: {
|
|
5
5
|
key: "native",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/ruby/native/client.ts"],
|
|
4
|
+
"sourcesContent": ["import { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { escapeForSingleQuotes } from '@/httpsnippet-lite/helpers/escape'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const native: Client = {\n info: {\n key: 'native',\n title: 'net::http',\n link: 'http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html',\n description: 'Ruby HTTP client',\n },\n convert: ({ uriObj, method: rawMethod, fullUrl, postData, allHeaders }, options = {}) => {\n const { insecureSkipVerify = false } = options\n const { push, blank, join } = new CodeBuilder()\n push(\"require 'uri'\")\n push(\"require 'net/http'\")\n blank()\n // To support custom methods we check for the supported methods\n // and if doesn't exist then we build a custom class for it\n const method = rawMethod.toUpperCase()\n const methods = [\n 'GET',\n 'POST',\n 'HEAD',\n 'DELETE',\n 'PATCH',\n 'PUT',\n 'OPTIONS',\n 'COPY',\n 'LOCK',\n 'UNLOCK',\n 'MOVE',\n 'TRACE',\n ]\n const capMethod = method.charAt(0) + method.substring(1).toLowerCase()\n if (!methods.includes(method)) {\n push(`class Net::HTTP::${capMethod} < Net::HTTPRequest`)\n push(` METHOD = '${method.toUpperCase()}'`)\n push(\n ` REQUEST_HAS_BODY = '${(postData === null || postData === void 0 ? void 0 : postData.text) ? 'true' : 'false'}'`,\n )\n push(' RESPONSE_HAS_BODY = true')\n push('end')\n blank()\n }\n push(`url = URI(\"${fullUrl}\")`)\n blank()\n push('http = Net::HTTP.new(url.host, url.port)')\n if (uriObj.protocol === 'https:') {\n push('http.use_ssl = true')\n if (insecureSkipVerify) {\n push('http.verify_mode = OpenSSL::SSL::VERIFY_NONE')\n }\n }\n blank()\n push(`request = Net::HTTP::${capMethod}.new(url)`)\n const headers = Object.keys(allHeaders)\n if (headers.length) {\n headers.forEach((key) => {\n push(`request[\"${key}\"] = '${escapeForSingleQuotes(allHeaders[key] as string)}'`)\n })\n }\n if (postData === null || postData === void 0 ? void 0 : postData.text) {\n push(`request.body = ${JSON.stringify(postData!.text)}`)\n }\n blank()\n push('response = http.request(request)')\n push('puts response.read_body')\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AAG/B,MAAM,SAAiB;AAAA,EAC5B,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,SAAS,CAAC,EAAE,QAAQ,QAAQ,WAAW,SAAS,UAAU,WAAW,GAAG,UAAU,CAAC,MAAM;AACvF,UAAM,EAAE,qBAAqB,MAAM,IAAI;AACvC,UAAM,EAAE,MAAM,OAAO,KAAK,IAAI,IAAI,YAAY;AAC9C,SAAK,eAAe;AACpB,SAAK,oBAAoB;AACzB,UAAM;AAGN,UAAM,SAAS,UAAU,YAAY;AACrC,UAAM,UAAU;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,UAAM,YAAY,OAAO,OAAO,CAAC,IAAI,OAAO,UAAU,CAAC,EAAE,YAAY;AACrE,QAAI,CAAC,QAAQ,SAAS,MAAM,GAAG;AAC7B,WAAK,oBAAoB,SAAS,qBAAqB;AACvD,WAAK,eAAe,OAAO,YAAY,CAAC,GAAG;AAC3C;AAAA,QACE,0BAA0B,aAAa,QAAQ,aAAa,SAAS,SAAS,SAAS,QAAQ,SAAS,OAAO;AAAA,MACjH;AACA,WAAK,4BAA4B;AACjC,WAAK,KAAK;AACV,YAAM;AAAA,IACR;AACA,SAAK,cAAc,OAAO,IAAI;AAC9B,UAAM;AACN,SAAK,0CAA0C;AAC/C,QAAI,OAAO,aAAa,UAAU;AAChC,WAAK,qBAAqB;AAC1B,UAAI,oBAAoB;AACtB,aAAK,8CAA8C;AAAA,MACrD;AAAA,IACF;AACA,UAAM;AACN,SAAK,wBAAwB,SAAS,WAAW;AACjD,UAAM,UAAU,OAAO,KAAK,UAAU;AACtC,QAAI,QAAQ,QAAQ;AAClB,cAAQ,QAAQ,CAAC,QAAQ;AACvB,aAAK,YAAY,GAAG,SAAS,sBAAsB,WAAW,GAAG,CAAW,CAAC,GAAG;AAAA,MAClF,CAAC;AAAA,IACH;AACA,QAAI,aAAa,QAAQ,aAAa,SAAS,SAAS,SAAS,MAAM;AACrE,WAAK,kBAAkB,KAAK,UAAU,SAAU,IAAI,CAAC,EAAE;AAAA,IACzD;AACA,UAAM;AACN,SAAK,kCAAkC;AACvC,SAAK,yBAAyB;AAC9B,WAAO,KAAK;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* HTTP code snippet generator for the Shell using HTTPie.
|
|
4
|
+
*
|
|
5
|
+
* @author
|
|
6
|
+
* @AhmadNassri
|
|
7
|
+
*
|
|
8
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
+
*/
|
|
10
|
+
import type { Client } from '../../../../httpsnippet-lite/targets/target.js';
|
|
11
|
+
export declare const httpie: Client;
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/shell/httpie/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,eAAO,MAAM,MAAM,EAAE,MA8GpB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBuilder } from "
|
|
2
|
-
import {
|
|
1
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
2
|
+
import { shellQuote } from "../../../../httpsnippet-lite/helpers/shell.js";
|
|
3
3
|
const httpie = {
|
|
4
4
|
info: {
|
|
5
5
|
key: "httpie",
|
|
@@ -63,31 +63,31 @@ ${opts.indent}` : " "
|
|
|
63
63
|
const value = queryObj[name];
|
|
64
64
|
if (Array.isArray(value)) {
|
|
65
65
|
value.forEach((val) => {
|
|
66
|
-
push(`${name}==${
|
|
66
|
+
push(`${name}==${shellQuote(val)}`);
|
|
67
67
|
});
|
|
68
68
|
} else {
|
|
69
|
-
push(`${name}==${
|
|
69
|
+
push(`${name}==${shellQuote(value)}`);
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
Object.keys(allHeaders).sort().forEach((key) => {
|
|
74
|
-
push(`${key}:${
|
|
74
|
+
push(`${key}:${shellQuote(allHeaders[key])}`);
|
|
75
75
|
});
|
|
76
76
|
if ((postData === null || postData === void 0 ? void 0 : postData.mimeType) === "application/x-www-form-urlencoded") {
|
|
77
77
|
if (postData.params?.length) {
|
|
78
78
|
flags.push(opts.short ? "-f" : "--form");
|
|
79
79
|
postData.params.forEach((param) => {
|
|
80
|
-
push(`${param.name}=${
|
|
80
|
+
push(`${param.name}=${shellQuote(param.value)}`);
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
} else if ((postData === null || postData === void 0 ? void 0 : postData.mimeType) === "multipart/form-data") {
|
|
84
|
-
if (postData
|
|
84
|
+
if (postData?.params?.length) {
|
|
85
85
|
flags.push("--multipart");
|
|
86
86
|
postData.params.forEach((param) => {
|
|
87
87
|
if (param.fileName) {
|
|
88
|
-
push(`${param.name}@${
|
|
88
|
+
push(`${param.name}@${shellQuote(param.fileName)}`);
|
|
89
89
|
} else {
|
|
90
|
-
push(`${param.name}='${
|
|
90
|
+
push(`${param.name}='${shellQuote(param.value)}'`);
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
}
|
|
@@ -95,10 +95,10 @@ ${opts.indent}` : " "
|
|
|
95
95
|
raw = true;
|
|
96
96
|
}
|
|
97
97
|
const cliFlags = flags.length ? `${flags.join(" ")} ` : "";
|
|
98
|
-
url =
|
|
98
|
+
url = shellQuote(opts.queryParams ? url : fullUrl);
|
|
99
99
|
unshift(`http ${cliFlags}${method} ${url}`);
|
|
100
100
|
if (raw && (postData === null || postData === void 0 ? void 0 : postData.text)) {
|
|
101
|
-
const postDataText =
|
|
101
|
+
const postDataText = shellQuote(postData.text);
|
|
102
102
|
unshift(`echo ${postDataText} | `);
|
|
103
103
|
}
|
|
104
104
|
return join();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/shell/httpie/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @description\n * HTTP code snippet generator for the Shell using HTTPie.\n *\n * @author\n * @AhmadNassri\n *\n * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.\n */\n\nimport { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { shellQuote } from '@/httpsnippet-lite/helpers/shell'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const httpie: Client = {\n info: {\n key: 'httpie',\n title: 'HTTPie',\n link: 'http://httpie.org/',\n description: 'a CLI, cURL-like tool for humans',\n },\n convert: ({ allHeaders, postData, queryObj, fullUrl, method, url }, options) => {\n const opts = {\n body: false,\n cert: false,\n headers: false,\n indent: ' ',\n pretty: false,\n print: false,\n queryParams: false,\n short: false,\n style: false,\n timeout: false,\n verbose: false,\n verify: false,\n ...options,\n }\n const { push, join, unshift } = new CodeBuilder({\n indent: opts.indent,\n // @ts-expect-error SEEMS LEGIT\n join: opts.indent !== false ? ` \\\\\\n${opts.indent}` : ' ',\n })\n let raw = false\n const flags = []\n if (opts.headers) {\n flags.push(opts.short ? '-h' : '--headers')\n }\n if (opts.body) {\n flags.push(opts.short ? '-b' : '--body')\n }\n if (opts.verbose) {\n flags.push(opts.short ? '-v' : '--verbose')\n }\n if (opts.print) {\n flags.push(`${opts.short ? '-p' : '--print'}=${opts.print}`)\n }\n if (opts.verify) {\n flags.push(`--verify=${opts.verify}`)\n }\n if (opts.cert) {\n flags.push(`--cert=${opts.cert}`)\n }\n if (opts.pretty) {\n flags.push(`--pretty=${opts.pretty}`)\n }\n if (opts.style) {\n flags.push(`--style=${opts.style}`)\n }\n if (opts.timeout) {\n flags.push(`--timeout=${opts.timeout}`)\n }\n // construct query params\n if (opts.queryParams) {\n Object.keys(queryObj).forEach((name) => {\n const value = queryObj[name]\n if (Array.isArray(value)) {\n value.forEach((val) => {\n push(`${name}==${shellQuote(val)}`)\n })\n } else {\n push(`${name}==${shellQuote(value)}`)\n }\n })\n }\n // construct headers\n Object.keys(allHeaders)\n .sort()\n .forEach((key) => {\n push(`${key}:${shellQuote(allHeaders[key] as string)}`)\n })\n if (\n (postData === null || postData === void 0 ? void 0 : postData.mimeType) === 'application/x-www-form-urlencoded'\n ) {\n // construct post params\n if (postData!.params?.length) {\n flags.push(opts.short ? '-f' : '--form')\n postData!.params.forEach((param) => {\n push(`${param.name}=${shellQuote(param.value)}`)\n })\n }\n } else if ((postData === null || postData === void 0 ? void 0 : postData.mimeType) === 'multipart/form-data') {\n // construct multipart form data\n if (postData?.params?.length) {\n flags.push('--multipart')\n postData.params.forEach((param) => {\n if (param.fileName) {\n push(`${param.name}@${shellQuote(param.fileName)}`)\n } else {\n push(`${param.name}='${shellQuote(param.value)}'`)\n }\n })\n }\n } else {\n raw = true\n }\n const cliFlags = flags.length ? `${flags.join(' ')} ` : ''\n url = shellQuote(opts.queryParams ? url : fullUrl)\n unshift(`http ${cliFlags}${method} ${url}`)\n if (raw && (postData === null || postData === void 0 ? void 0 : postData.text)) {\n const postDataText = shellQuote(postData!.text)\n unshift(`echo ${postDataText} | `)\n }\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* HTTP code snippet generator for the Shell using Wget.
|
|
4
|
+
*
|
|
5
|
+
* @author
|
|
6
|
+
* @AhmadNassri
|
|
7
|
+
*
|
|
8
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
+
*/
|
|
10
|
+
import type { Client } from '../../../../httpsnippet-lite/targets/target.js';
|
|
11
|
+
export declare const wget: Client;
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/shell/wget/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,eAAO,MAAM,IAAI,EAAE,MAoClB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBuilder } from "
|
|
2
|
-
import {
|
|
1
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
2
|
+
import { shellEscape, shellQuote } from "../../../../httpsnippet-lite/helpers/shell.js";
|
|
3
3
|
const wget = {
|
|
4
4
|
info: {
|
|
5
5
|
key: "wget",
|
|
@@ -25,16 +25,16 @@ ${opts.indent}` : " "
|
|
|
25
25
|
} else {
|
|
26
26
|
push(`wget ${opts.short ? "-q" : "--quiet"}`);
|
|
27
27
|
}
|
|
28
|
-
push(`--method ${
|
|
28
|
+
push(`--method ${shellQuote(method)}`);
|
|
29
29
|
Object.keys(allHeaders).forEach((key) => {
|
|
30
30
|
const header = `${key}: ${allHeaders[key]}`;
|
|
31
|
-
push(`--header ${
|
|
31
|
+
push(`--header ${shellQuote(header)}`);
|
|
32
32
|
});
|
|
33
33
|
if (postData === null || postData === void 0 ? void 0 : postData.text) {
|
|
34
|
-
push(`--body-data ${
|
|
34
|
+
push(`--body-data ${shellEscape(shellQuote(postData.text))}`);
|
|
35
35
|
}
|
|
36
36
|
push(opts.short ? "-O" : "--output-document");
|
|
37
|
-
push(`- ${
|
|
37
|
+
push(`- ${shellQuote(fullUrl)}`);
|
|
38
38
|
return join();
|
|
39
39
|
}
|
|
40
40
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/shell/wget/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @description\n * HTTP code snippet generator for the Shell using Wget.\n *\n * @author\n * @AhmadNassri\n *\n * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.\n */\n\nimport { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { shellEscape, shellQuote } from '@/httpsnippet-lite/helpers/shell'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const wget: Client = {\n info: {\n key: 'wget',\n title: 'Wget',\n link: 'https://www.gnu.org/software/wget/',\n description: 'a free software package for retrieving files using HTTP, HTTPS',\n },\n convert: ({ method, postData, allHeaders, fullUrl }, options) => {\n const opts = {\n indent: ' ',\n short: false,\n verbose: false,\n ...options,\n }\n const { push, join } = new CodeBuilder({\n indent: opts.indent,\n // @ts-expect-error SEEMS LEGIT\n join: opts.indent !== false ? ` \\\\\\n${opts.indent}` : ' ',\n })\n if (opts.verbose) {\n push(`wget ${opts.short ? '-v' : '--verbose'}`)\n } else {\n push(`wget ${opts.short ? '-q' : '--quiet'}`)\n }\n push(`--method ${shellQuote(method)}`)\n Object.keys(allHeaders).forEach((key) => {\n const header = `${key}: ${allHeaders[key]}`\n push(`--header ${shellQuote(header)}`)\n })\n if (postData === null || postData === void 0 ? void 0 : postData.text) {\n push(`--body-data ${shellEscape(shellQuote(postData!.text))}`)\n }\n push(opts.short ? '-O' : '--output-document')\n push(`- ${shellQuote(fullUrl)}`)\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "AAUA,SAAS,mBAAmB;AAC5B,SAAS,aAAa,kBAAkB;AAGjC,MAAM,OAAe;AAAA,EAC1B,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,SAAS,CAAC,EAAE,QAAQ,UAAU,YAAY,QAAQ,GAAG,YAAY;AAC/D,UAAM,OAAO;AAAA,MACX,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,SAAS;AAAA,MACT,GAAG;AAAA,IACL;AACA,UAAM,EAAE,MAAM,KAAK,IAAI,IAAI,YAAY;AAAA,MACrC,QAAQ,KAAK;AAAA;AAAA,MAEb,MAAM,KAAK,WAAW,QAAQ;AAAA,EAAQ,KAAK,MAAM,KAAK;AAAA,IACxD,CAAC;AACD,QAAI,KAAK,SAAS;AAChB,WAAK,QAAQ,KAAK,QAAQ,OAAO,WAAW,EAAE;AAAA,IAChD,OAAO;AACL,WAAK,QAAQ,KAAK,QAAQ,OAAO,SAAS,EAAE;AAAA,IAC9C;AACA,SAAK,YAAY,WAAW,MAAM,CAAC,EAAE;AACrC,WAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACvC,YAAM,SAAS,GAAG,GAAG,KAAK,WAAW,GAAG,CAAC;AACzC,WAAK,YAAY,WAAW,MAAM,CAAC,EAAE;AAAA,IACvC,CAAC;AACD,QAAI,aAAa,QAAQ,aAAa,SAAS,SAAS,SAAS,MAAM;AACrE,WAAK,eAAe,YAAY,WAAW,SAAU,IAAI,CAAC,CAAC,EAAE;AAAA,IAC/D;AACA,SAAK,KAAK,QAAQ,OAAO,mBAAmB;AAC5C,SAAK,KAAK,WAAW,OAAO,CAAC,EAAE;AAC/B,WAAO,KAAK;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
indent: string;
|
|
3
|
+
pretty: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Create a string corresponding to a valid declaration and initialization of a Swift array or dictionary literal
|
|
7
|
+
*
|
|
8
|
+
* @param name Desired name of the instance
|
|
9
|
+
* @param parameters Key-value object of parameters to translate to a Swift object literal
|
|
10
|
+
* @param opts Target options
|
|
11
|
+
* @return {string}
|
|
12
|
+
*/
|
|
13
|
+
export declare const literalDeclaration: (name: string, parameters: unknown, opts: Options) => string;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/targets/swift/helpers.ts"],"names":[],"mappings":"AAqBA,UAAU,OAAO;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;GAOG;AAEH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,YAAY,OAAO,EAAE,MAAM,OAAO,WACvB,CAAA"}
|
|
@@ -12,8 +12,8 @@ ${closingBraceIndent}]`;
|
|
|
12
12
|
return `[${arr.join(join)}]`;
|
|
13
13
|
};
|
|
14
14
|
const literalDeclaration = (name, parameters, opts) => `let ${name} = ${literalRepresentation(parameters, opts)}`;
|
|
15
|
-
const literalRepresentation = (value, opts,
|
|
16
|
-
indentLevel =
|
|
15
|
+
const literalRepresentation = (value, opts, indentLevelInput) => {
|
|
16
|
+
const indentLevel = indentLevelInput === void 0 ? 1 : indentLevelInput + 1;
|
|
17
17
|
switch (Object.prototype.toString.call(value)) {
|
|
18
18
|
case "[object Number]":
|
|
19
19
|
return value;
|
|
@@ -29,19 +29,13 @@ const literalRepresentation = (value, opts, indentLevel) => {
|
|
|
29
29
|
}
|
|
30
30
|
case "[object Object]": {
|
|
31
31
|
const keyValuePairs = [];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const _value = value;
|
|
33
|
+
for (const key in _value) {
|
|
34
|
+
if (Object.hasOwn(_value, key)) {
|
|
35
|
+
keyValuePairs.push(`"${key}": ${literalRepresentation(_value[key], opts, indentLevel)}`);
|
|
36
|
+
}
|
|
36
37
|
}
|
|
37
|
-
return concatArray(
|
|
38
|
-
keyValuePairs,
|
|
39
|
-
// @ts-expect-error needs better types
|
|
40
|
-
opts.pretty && keyValuePairs.length > 1,
|
|
41
|
-
// @ts-expect-error needs better types
|
|
42
|
-
opts.indent,
|
|
43
|
-
indentLevel
|
|
44
|
-
);
|
|
38
|
+
return concatArray(keyValuePairs, opts.pretty && keyValuePairs.length > 1, opts.indent, indentLevel);
|
|
45
39
|
}
|
|
46
40
|
case "[object Boolean]":
|
|
47
41
|
return value.toString();
|
|
@@ -53,7 +47,6 @@ const literalRepresentation = (value, opts, indentLevel) => {
|
|
|
53
47
|
}
|
|
54
48
|
};
|
|
55
49
|
export {
|
|
56
|
-
literalDeclaration
|
|
57
|
-
literalRepresentation
|
|
50
|
+
literalDeclaration
|
|
58
51
|
};
|
|
59
52
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/httpsnippet-lite/targets/swift/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Create an string of given length filled with blank spaces\n *\n * @param length Length of the array to return\n * @param str String to pad out with\n */\nconst buildString = (length: number, str: string) => str.repeat(length)\n\n/**\n * Create a string corresponding to a Dictionary or Array literal representation with pretty option and indentation.\n */\nconst concatArray = (arr: Array<string>, pretty: boolean, indentation: string, indentLevel: number): string => {\n const currentIndent = buildString(indentLevel, indentation)\n const closingBraceIndent = buildString(indentLevel - 1, indentation)\n const join = pretty ? `,\\n${currentIndent}` : ', '\n if (pretty) {\n return `[\\n${currentIndent}${arr.join(join)}\\n${closingBraceIndent}]`\n }\n return `[${arr.join(join)}]`\n}\n\ninterface Options {\n indent: string\n pretty: boolean\n}\n\n/**\n * Create a string corresponding to a valid declaration and initialization of a Swift array or dictionary literal\n *\n * @param name Desired name of the instance\n * @param parameters Key-value object of parameters to translate to a Swift object literal\n * @param opts Target options\n * @return {string}\n */\n\nexport const literalDeclaration = (name: string, parameters: unknown, opts: Options) =>\n `let ${name} = ${literalRepresentation(parameters, opts)}`\n/**\n * Create a valid Swift string of a literal value according to its type.\n *\n * @param value Any JavaScript literal\n * @param opts Target options\n */\nconst literalRepresentation = (value: unknown, opts: Options, indentLevelInput?: number): string => {\n const indentLevel = indentLevelInput === undefined ? 1 : indentLevelInput + 1\n switch (Object.prototype.toString.call(value)) {\n case '[object Number]':\n return value as string\n case '[object Array]': {\n // Don't prettify arrays to avoid taking too much space\n let pretty = false\n const valuesRepresentation = (value as Array<unknown>).map((v) => {\n // Switch to prettify if the value is a dictionary with multiple keys\n if (Object.prototype.toString.call(v) === '[object Object]') {\n pretty = Object.keys(v as {}).length > 1\n }\n return literalRepresentation(v, opts, indentLevel)\n })\n\n return concatArray(valuesRepresentation, pretty, opts.indent, indentLevel)\n }\n case '[object Object]': {\n const keyValuePairs = []\n const _value = value as Record<string, unknown>\n for (const key in _value) {\n if (Object.hasOwn(_value, key)) {\n keyValuePairs.push(`\"${key}\": ${literalRepresentation(_value[key], opts, indentLevel)}`)\n }\n }\n return concatArray(keyValuePairs, opts.pretty && keyValuePairs.length > 1, opts.indent, indentLevel)\n }\n case '[object Boolean]':\n return (value as boolean).toString()\n\n default:\n if (value === null || value === undefined) {\n return ''\n }\n return `\"${value.toString().replace(/\"/g, '\\\\\"')}\"`\n }\n}\n"],
|
|
5
|
+
"mappings": "AAMA,MAAM,cAAc,CAAC,QAAgB,QAAgB,IAAI,OAAO,MAAM;AAKtE,MAAM,cAAc,CAAC,KAAoB,QAAiB,aAAqB,gBAAgC;AAC7G,QAAM,gBAAgB,YAAY,aAAa,WAAW;AAC1D,QAAM,qBAAqB,YAAY,cAAc,GAAG,WAAW;AACnE,QAAM,OAAO,SAAS;AAAA,EAAM,aAAa,KAAK;AAC9C,MAAI,QAAQ;AACV,WAAO;AAAA,EAAM,aAAa,GAAG,IAAI,KAAK,IAAI,CAAC;AAAA,EAAK,kBAAkB;AAAA,EACpE;AACA,SAAO,IAAI,IAAI,KAAK,IAAI,CAAC;AAC3B;AAgBO,MAAM,qBAAqB,CAAC,MAAc,YAAqB,SACpE,OAAO,IAAI,MAAM,sBAAsB,YAAY,IAAI,CAAC;AAO1D,MAAM,wBAAwB,CAAC,OAAgB,MAAe,qBAAsC;AAClG,QAAM,cAAc,qBAAqB,SAAY,IAAI,mBAAmB;AAC5E,UAAQ,OAAO,UAAU,SAAS,KAAK,KAAK,GAAG;AAAA,IAC7C,KAAK;AACH,aAAO;AAAA,IACT,KAAK,kBAAkB;AAErB,UAAI,SAAS;AACb,YAAM,uBAAwB,MAAyB,IAAI,CAAC,MAAM;AAEhE,YAAI,OAAO,UAAU,SAAS,KAAK,CAAC,MAAM,mBAAmB;AAC3D,mBAAS,OAAO,KAAK,CAAO,EAAE,SAAS;AAAA,QACzC;AACA,eAAO,sBAAsB,GAAG,MAAM,WAAW;AAAA,MACnD,CAAC;AAED,aAAO,YAAY,sBAAsB,QAAQ,KAAK,QAAQ,WAAW;AAAA,IAC3E;AAAA,IACA,KAAK,mBAAmB;AACtB,YAAM,gBAAgB,CAAC;AACvB,YAAM,SAAS;AACf,iBAAW,OAAO,QAAQ;AACxB,YAAI,OAAO,OAAO,QAAQ,GAAG,GAAG;AAC9B,wBAAc,KAAK,IAAI,GAAG,MAAM,sBAAsB,OAAO,GAAG,GAAG,MAAM,WAAW,CAAC,EAAE;AAAA,QACzF;AAAA,MACF;AACA,aAAO,YAAY,eAAe,KAAK,UAAU,cAAc,SAAS,GAAG,KAAK,QAAQ,WAAW;AAAA,IACrG;AAAA,IACA,KAAK;AACH,aAAQ,MAAkB,SAAS;AAAA,IAErC;AACE,UAAI,UAAU,QAAQ,UAAU,QAAW;AACzC,eAAO;AAAA,MACT;AACA,aAAO,IAAI,MAAM,SAAS,EAAE,QAAQ,MAAM,KAAK,CAAC;AAAA,EACpD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* HTTP code snippet generator for Swift using NSURLSession.
|
|
4
|
+
*
|
|
5
|
+
* @author
|
|
6
|
+
* @thibaultCha
|
|
7
|
+
*
|
|
8
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
+
*/
|
|
10
|
+
import type { Client } from '../../../../httpsnippet-lite/targets/target.js';
|
|
11
|
+
export declare const nsurlsession: Client;
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/swift/nsurlsession/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,eAAO,MAAM,YAAY,EAAE,MAuH1B,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBuilder } from "
|
|
2
|
-
import { literalDeclaration } from "
|
|
1
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
2
|
+
import { literalDeclaration } from "../../../../httpsnippet-lite/targets/swift/helpers.js";
|
|
3
3
|
const nsurlsession = {
|
|
4
4
|
info: {
|
|
5
5
|
key: "nsurlsession",
|
|
@@ -37,9 +37,7 @@ const nsurlsession = {
|
|
|
37
37
|
`let postData = NSMutableData(data: "${head.name}=${head.value}".data(using: String.Encoding.utf8)!)`
|
|
38
38
|
);
|
|
39
39
|
tail.forEach(({ name, value }) => {
|
|
40
|
-
push(
|
|
41
|
-
`postData.append("&${name}=${value}".data(using: String.Encoding.utf8)!)`
|
|
42
|
-
);
|
|
40
|
+
push(`postData.append("&${name}=${value}".data(using: String.Encoding.utf8)!)`);
|
|
43
41
|
});
|
|
44
42
|
} else {
|
|
45
43
|
req.hasBody = false;
|
|
@@ -47,13 +45,9 @@ const nsurlsession = {
|
|
|
47
45
|
break;
|
|
48
46
|
case "application/json":
|
|
49
47
|
if (postData.jsonObj) {
|
|
50
|
-
push(
|
|
51
|
-
`${literalDeclaration("parameters", postData.jsonObj, opts)} as [String : Any]`
|
|
52
|
-
);
|
|
48
|
+
push(`${literalDeclaration("parameters", postData.jsonObj, opts)} as [String : Any]`);
|
|
53
49
|
blank();
|
|
54
|
-
push(
|
|
55
|
-
"let postData = JSONSerialization.data(withJSONObject: parameters, options: [])"
|
|
56
|
-
);
|
|
50
|
+
push("let postData = JSONSerialization.data(withJSONObject: parameters, options: [])");
|
|
57
51
|
}
|
|
58
52
|
break;
|
|
59
53
|
case "multipart/form-data":
|
|
@@ -66,16 +60,10 @@ const nsurlsession = {
|
|
|
66
60
|
push("for param in parameters {");
|
|
67
61
|
push('let paramName = param["name"]!', 1);
|
|
68
62
|
push('body += "--\\(boundary)\\r\\n"', 1);
|
|
69
|
-
push(
|
|
70
|
-
'body += "Content-Disposition:form-data; name=\\"\\(paramName)\\""',
|
|
71
|
-
1
|
|
72
|
-
);
|
|
63
|
+
push('body += "Content-Disposition:form-data; name=\\"\\(paramName)\\""', 1);
|
|
73
64
|
push('if let filename = param["fileName"] {', 1);
|
|
74
65
|
push('let contentType = param["content-type"]!', 2);
|
|
75
|
-
push(
|
|
76
|
-
"let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)",
|
|
77
|
-
2
|
|
78
|
-
);
|
|
66
|
+
push("let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)", 2);
|
|
79
67
|
push("if (error != nil) {", 2);
|
|
80
68
|
push("print(error as Any)", 3);
|
|
81
69
|
push("}", 2);
|
|
@@ -89,22 +77,13 @@ const nsurlsession = {
|
|
|
89
77
|
break;
|
|
90
78
|
default:
|
|
91
79
|
blank();
|
|
92
|
-
push(
|
|
93
|
-
`let postData = NSData(data: "${postData.text}".data(using: String.Encoding.utf8)!)`
|
|
94
|
-
);
|
|
80
|
+
push(`let postData = NSData(data: "${postData.text}".data(using: String.Encoding.utf8)!)`);
|
|
95
81
|
}
|
|
96
82
|
}
|
|
97
83
|
blank();
|
|
98
|
-
push(
|
|
99
|
-
|
|
100
|
-
);
|
|
101
|
-
push(
|
|
102
|
-
" cachePolicy: .useProtocolCachePolicy,"
|
|
103
|
-
);
|
|
104
|
-
push(
|
|
105
|
-
// @ts-expect-error needs better types
|
|
106
|
-
` timeoutInterval: ${Number.parseInt(opts.timeout, 10).toFixed(1)})`
|
|
107
|
-
);
|
|
84
|
+
push(`let request = NSMutableURLRequest(url: NSURL(string: "${fullUrl}")! as URL,`);
|
|
85
|
+
push(" cachePolicy: .useProtocolCachePolicy,");
|
|
86
|
+
push(` timeoutInterval: ${Number.parseInt(opts.timeout, 10).toFixed(1)})`);
|
|
108
87
|
push(`request.httpMethod = "${method}"`);
|
|
109
88
|
if (req.hasHeaders) {
|
|
110
89
|
push("request.allHTTPHeaderFields = headers");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/swift/nsurlsession/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @description\n * HTTP code snippet generator for Swift using NSURLSession.\n *\n * @author\n * @thibaultCha\n *\n * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.\n */\n\nimport { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { literalDeclaration } from '@/httpsnippet-lite/targets/swift/helpers'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const nsurlsession: Client = {\n info: {\n key: 'nsurlsession',\n title: 'NSURLSession',\n link: 'https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html',\n description: \"Foundation's NSURLSession request\",\n },\n convert: ({ allHeaders, postData, fullUrl, method }, options) => {\n let _a\n const opts = {\n indent: ' ',\n pretty: true,\n timeout: '10',\n ...options,\n }\n const { push, blank, join } = new CodeBuilder({ indent: opts.indent })\n // Markers for headers to be created as litteral objects and later be set on the NSURLRequest if exist\n const req = {\n hasHeaders: false,\n hasBody: false,\n }\n // We just want to make sure people understand that is the only dependency\n push('import Foundation')\n if (Object.keys(allHeaders).length) {\n req.hasHeaders = true\n blank()\n push(literalDeclaration('headers', allHeaders, opts))\n }\n if (postData && (postData.text || postData.jsonObj || postData.params)) {\n req.hasBody = true\n switch (postData.mimeType) {\n case 'application/x-www-form-urlencoded':\n // By appending parameters one by one in the resulting snippet,\n // we make it easier for the user to edit it according to his or her needs after pasting.\n // The user can just add/remove lines adding/removing body parameters.\n blank()\n if ((_a = postData.params) === null || _a === void 0 ? void 0 : _a.length) {\n const [head, ...tail] = postData.params!\n push(\n `let postData = NSMutableData(data: \"${head!.name}=${head!.value}\".data(using: String.Encoding.utf8)!)`,\n )\n tail.forEach(({ name, value }) => {\n push(`postData.append(\"&${name}=${value}\".data(using: String.Encoding.utf8)!)`)\n })\n } else {\n req.hasBody = false\n }\n break\n case 'application/json':\n if (postData.jsonObj) {\n push(`${literalDeclaration('parameters', postData.jsonObj, opts)} as [String : Any]`)\n blank()\n push('let postData = JSONSerialization.data(withJSONObject: parameters, options: [])')\n }\n break\n case 'multipart/form-data':\n /**\n * By appending multipart parameters one by one in the resulting snippet,\n * we make it easier for the user to edit it according to his or her needs after pasting.\n * The user can just edit the parameters NSDictionary or put this part of a snippet in a multipart builder method.\n */\n push(literalDeclaration('parameters', postData.params, opts))\n blank()\n push(`let boundary = \"${postData.boundary}\"`)\n blank()\n push('var body = \"\"')\n push('var error: NSError? = nil')\n push('for param in parameters {')\n push('let paramName = param[\"name\"]!', 1)\n push('body += \"--\\\\(boundary)\\\\r\\\\n\"', 1)\n push('body += \"Content-Disposition:form-data; name=\\\\\"\\\\(paramName)\\\\\"\"', 1)\n push('if let filename = param[\"fileName\"] {', 1)\n push('let contentType = param[\"content-type\"]!', 2)\n push('let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)', 2)\n push('if (error != nil) {', 2)\n push('print(error as Any)', 3)\n push('}', 2)\n push('body += \"; filename=\\\\\"\\\\(filename)\\\\\"\\\\r\\\\n\"', 2)\n push('body += \"Content-Type: \\\\(contentType)\\\\r\\\\n\\\\r\\\\n\"', 2)\n push('body += fileContent', 2)\n push('} else if let paramValue = param[\"value\"] {', 1)\n push('body += \"\\\\r\\\\n\\\\r\\\\n\\\\(paramValue)\"', 2)\n push('}', 1)\n push('}')\n break\n default:\n blank()\n push(`let postData = NSData(data: \"${postData.text}\".data(using: String.Encoding.utf8)!)`)\n }\n }\n blank()\n // NSURLRequestUseProtocolCachePolicy is the default policy, let's just always set it to avoid confusion.\n push(`let request = NSMutableURLRequest(url: NSURL(string: \"${fullUrl}\")! as URL,`)\n push(' cachePolicy: .useProtocolCachePolicy,')\n push(` timeoutInterval: ${Number.parseInt(opts.timeout, 10).toFixed(1)})`)\n push(`request.httpMethod = \"${method}\"`)\n if (req.hasHeaders) {\n push('request.allHTTPHeaderFields = headers')\n }\n if (req.hasBody) {\n push('request.httpBody = postData as Data')\n }\n blank()\n // Retrieving the shared session will be less verbose than creating a new one.\n push('let session = URLSession.shared')\n push(\n 'let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in',\n )\n push('if (error != nil) {', 1)\n push('print(error as Any)', 2)\n push('} else {', 1) // Casting the NSURLResponse to NSHTTPURLResponse so the user can see the status .\n push('let httpResponse = response as? HTTPURLResponse', 2)\n push('print(httpResponse)', 2)\n push('}', 1)\n push('})')\n blank()\n push('dataTask.resume()')\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CodeBuilderOptions } from '../../httpsnippet-lite/helpers/code-builder.js';
|
|
2
|
+
import type { SnippetRequest } from '../../httpsnippet-lite/helpers/snippet-request.js';
|
|
3
|
+
type ClientId = string;
|
|
4
|
+
type ClientInfo = {
|
|
5
|
+
key: ClientId;
|
|
6
|
+
title: string;
|
|
7
|
+
link: string;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
type SimpleMerge<Destination, Source> = {
|
|
11
|
+
[Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
|
|
12
|
+
} & Source;
|
|
13
|
+
export type Converter<T extends Record<string, any>> = (request: SnippetRequest, options?: SimpleMerge<CodeBuilderOptions, T>) => string;
|
|
14
|
+
export type Client<T extends Record<string, any> = Record<string, any>> = {
|
|
15
|
+
info: ClientInfo;
|
|
16
|
+
convert: Converter<T>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../src/httpsnippet-lite/targets/target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AA4BhF,KAAK,QAAQ,GAAG,MAAM,CAAA;AACtB,KAAK,UAAU,GAAG;IAChB,GAAG,EAAE,QAAQ,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,WAAW,CAAC,WAAW,EAAE,MAAM,IAAI;KACrC,GAAG,IAAI,MAAM,WAAW,IAAI,GAAG,SAAS,MAAM,MAAM,GAAG,KAAK,GAAG,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC;CACvF,GAAG,MAAM,CAAA;AAEV,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CACrD,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,WAAW,CAAC,kBAAkB,EAAE,CAAC,CAAC,KACzC,MAAM,CAAA;AAEX,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;IACxE,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;CACtB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=target.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { AVAILABLE_CLIENTS, type AvailableClient, type AvailableClients, type ClientId, type FormDataParam, type HarRequest, type Plugin, type PluginConfiguration, type Target, type TargetId, } from '@scalar/types/snippetz';
|
|
2
|
+
export { snippetz } from './snippetz.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,mBAAmB,EACxB,KAAK,MAAM,EACX,KAAK,QAAQ,GACd,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
AVAILABLE_CLIENTS
|
|
3
|
+
} from "@scalar/types/snippetz";
|
|
4
|
+
import { snippetz } from "./snippetz.js";
|
|
5
|
+
export {
|
|
6
|
+
AVAILABLE_CLIENTS,
|
|
7
|
+
snippetz
|
|
8
|
+
};
|
|
3
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["export {\n AVAILABLE_CLIENTS,\n type AvailableClient,\n type AvailableClients,\n type ClientId,\n type FormDataParam,\n type HarRequest,\n type Plugin,\n type PluginConfiguration,\n type Target,\n type TargetId,\n} from '@scalar/types/snippetz'\n\nexport { snippetz } from './snippetz'\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,OAUK;AAEP,SAAS,gBAAgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|