@scalar/snippetz 0.7.3 → 0.7.5
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 +168 -169
- package/dist/httpsnippet-lite/helpers/code-builder.js +86 -74
- package/dist/httpsnippet-lite/helpers/escape.js +69 -44
- package/dist/httpsnippet-lite/helpers/headers.js +17 -14
- package/dist/httpsnippet-lite/helpers/reducer.js +1 -1
- package/dist/httpsnippet-lite/helpers/shell.js +13 -13
- package/dist/httpsnippet-lite/helpers/snippet-request.js +1 -1
- package/dist/httpsnippet-lite/helpers/url.js +4 -8
- package/dist/httpsnippet-lite/targets/c/libcurl/client.js +69 -67
- package/dist/httpsnippet-lite/targets/clojure/clj_http/client.js +165 -154
- package/dist/httpsnippet-lite/targets/csharp/restsharp/client.js +35 -38
- package/dist/httpsnippet-lite/targets/go/native/client.js +151 -147
- package/dist/httpsnippet-lite/targets/java/asynchttp/client.js +32 -35
- package/dist/httpsnippet-lite/targets/java/nethttp/client.js +40 -39
- package/dist/httpsnippet-lite/targets/java/okhttp/client.js +83 -73
- package/dist/httpsnippet-lite/targets/java/unirest/client.js +41 -34
- package/dist/httpsnippet-lite/targets/javascript/axios/client.js +81 -76
- package/dist/httpsnippet-lite/targets/javascript/jquery/client.js +77 -71
- package/dist/httpsnippet-lite/targets/javascript/xhr/client.js +73 -71
- package/dist/httpsnippet-lite/targets/kotlin/okhttp/client.js +83 -73
- package/dist/httpsnippet-lite/targets/node/axios/client.js +74 -69
- package/dist/httpsnippet-lite/targets/objc/helpers.js +52 -33
- package/dist/httpsnippet-lite/targets/objc/nsurlsession/client.js +123 -121
- package/dist/httpsnippet-lite/targets/ocaml/cohttp/client.js +60 -49
- package/dist/httpsnippet-lite/targets/powershell/common.js +46 -56
- package/dist/httpsnippet-lite/targets/powershell/restmethod/client.js +9 -13
- package/dist/httpsnippet-lite/targets/powershell/webrequest/client.js +9 -13
- package/dist/httpsnippet-lite/targets/python/python3/client.js +85 -68
- package/dist/httpsnippet-lite/targets/r/httr/client.js +114 -95
- package/dist/httpsnippet-lite/targets/ruby/native/client.js +66 -70
- package/dist/httpsnippet-lite/targets/shell/httpie/client.js +121 -107
- package/dist/httpsnippet-lite/targets/shell/wget/client.js +48 -43
- package/dist/httpsnippet-lite/targets/swift/helpers.js +62 -44
- package/dist/httpsnippet-lite/targets/swift/nsurlsession/client.js +126 -112
- package/dist/httpsnippet-lite/targets/target.js +1 -1
- package/dist/index.js +2 -9
- package/dist/libs/http.js +68 -56
- package/dist/libs/javascript.js +77 -60
- package/dist/libs/php.js +59 -49
- package/dist/libs/rust.js +60 -33
- package/dist/libs/shell.js +14 -5
- package/dist/plugins/c/libcurl/index.js +1 -5
- package/dist/plugins/c/libcurl/libcurl.js +13 -13
- package/dist/plugins/clojure/clj_http/clj_http.js +13 -13
- package/dist/plugins/clojure/clj_http/index.js +1 -5
- package/dist/plugins/csharp/httpclient/httpclient.js +186 -150
- package/dist/plugins/csharp/httpclient/index.js +1 -5
- package/dist/plugins/csharp/restsharp/index.js +1 -5
- package/dist/plugins/csharp/restsharp/restsharp.js +13 -13
- package/dist/plugins/dart/http/http.js +95 -93
- package/dist/plugins/dart/http/index.js +1 -5
- package/dist/plugins/fsharp/httpclient/httpclient.js +156 -122
- package/dist/plugins/fsharp/httpclient/index.js +1 -5
- package/dist/plugins/go/native/index.js +1 -5
- package/dist/plugins/go/native/native.js +13 -13
- package/dist/plugins/http/http11/http11.js +103 -85
- package/dist/plugins/http/http11/index.js +1 -5
- package/dist/plugins/java/asynchttp/asynchttp.js +13 -13
- package/dist/plugins/java/asynchttp/index.js +1 -5
- package/dist/plugins/java/nethttp/index.js +1 -5
- package/dist/plugins/java/nethttp/nethttp.js +13 -13
- package/dist/plugins/java/okhttp/index.js +1 -5
- package/dist/plugins/java/okhttp/okhttp.js +13 -13
- package/dist/plugins/java/unirest/index.js +1 -5
- package/dist/plugins/java/unirest/unirest.js +13 -13
- package/dist/plugins/js/axios/axios.js +13 -13
- package/dist/plugins/js/axios/index.js +1 -5
- package/dist/plugins/js/fetch/fetch.js +82 -68
- package/dist/plugins/js/fetch/index.js +1 -5
- package/dist/plugins/js/jquery/index.js +1 -5
- package/dist/plugins/js/jquery/jquery.js +13 -13
- package/dist/plugins/js/ofetch/index.js +1 -5
- package/dist/plugins/js/ofetch/ofetch.js +61 -48
- package/dist/plugins/js/xhr/index.js +1 -5
- package/dist/plugins/js/xhr/xhr.js +13 -13
- package/dist/plugins/kotlin/okhttp/index.js +1 -5
- package/dist/plugins/kotlin/okhttp/okhttp.js +13 -13
- package/dist/plugins/node/axios/axios.js +13 -13
- package/dist/plugins/node/axios/index.js +1 -5
- package/dist/plugins/node/fetch/fetch.js +86 -74
- package/dist/plugins/node/fetch/index.js +1 -5
- package/dist/plugins/node/ofetch/index.js +1 -5
- package/dist/plugins/node/ofetch/ofetch.js +61 -48
- package/dist/plugins/node/undici/index.js +1 -5
- package/dist/plugins/node/undici/undici.js +60 -47
- package/dist/plugins/objc/nsurlsession/index.js +1 -5
- package/dist/plugins/objc/nsurlsession/nsurlsession.js +13 -13
- package/dist/plugins/ocaml/cohttp/cohttp.js +13 -13
- package/dist/plugins/ocaml/cohttp/index.js +1 -5
- package/dist/plugins/php/curl/curl.js +143 -101
- package/dist/plugins/php/curl/index.js +1 -5
- package/dist/plugins/php/guzzle/guzzle.js +103 -83
- package/dist/plugins/php/guzzle/index.js +1 -5
- package/dist/plugins/powershell/restmethod/index.js +1 -5
- package/dist/plugins/powershell/restmethod/restmethod.js +13 -13
- package/dist/plugins/powershell/webrequest/index.js +1 -5
- package/dist/plugins/powershell/webrequest/webrequest.js +13 -13
- package/dist/plugins/python/httpx/async.js +17 -15
- package/dist/plugins/python/httpx/index.js +2 -7
- package/dist/plugins/python/httpx/sync.js +11 -12
- package/dist/plugins/python/python3/index.js +1 -5
- package/dist/plugins/python/python3/python3.js +13 -13
- package/dist/plugins/python/requests/index.js +1 -5
- package/dist/plugins/python/requests/requests.js +11 -12
- package/dist/plugins/python/requestsLike.js +128 -112
- package/dist/plugins/r/httr/httr.js +13 -13
- package/dist/plugins/r/httr/index.js +1 -5
- package/dist/plugins/ruby/native/index.js +1 -5
- package/dist/plugins/ruby/native/native.js +13 -13
- package/dist/plugins/rust/reqwest/index.js +1 -5
- package/dist/plugins/rust/reqwest/reqwest.js +110 -83
- package/dist/plugins/shell/curl/curl.js +128 -97
- package/dist/plugins/shell/curl/index.js +1 -5
- package/dist/plugins/shell/httpie/httpie.js +13 -13
- package/dist/plugins/shell/httpie/index.js +1 -5
- package/dist/plugins/shell/wget/index.js +1 -5
- package/dist/plugins/shell/wget/wget.js +13 -13
- package/dist/plugins/swift/nsurlsession/index.js +1 -5
- package/dist/plugins/swift/nsurlsession/nsurlsession.js +13 -13
- package/dist/snippetz.js +25 -28
- package/dist/utils/convertWithHttpSnippetLite.js +100 -96
- package/dist/utils/index.js +1 -5
- package/package.json +8 -12
- package/dist/clients/index.js.map +0 -7
- package/dist/httpsnippet-lite/helpers/code-builder.js.map +0 -7
- package/dist/httpsnippet-lite/helpers/escape.js.map +0 -7
- package/dist/httpsnippet-lite/helpers/headers.js.map +0 -7
- package/dist/httpsnippet-lite/helpers/reducer.js.map +0 -7
- package/dist/httpsnippet-lite/helpers/shell.js.map +0 -7
- package/dist/httpsnippet-lite/helpers/snippet-request.js.map +0 -7
- package/dist/httpsnippet-lite/helpers/url.js.map +0 -7
- package/dist/httpsnippet-lite/targets/c/libcurl/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/clojure/clj_http/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/csharp/restsharp/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/go/native/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/java/asynchttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/java/nethttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/java/okhttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/java/unirest/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/javascript/axios/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/javascript/jquery/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/javascript/xhr/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/kotlin/okhttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/node/axios/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/objc/helpers.js.map +0 -7
- package/dist/httpsnippet-lite/targets/objc/nsurlsession/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/ocaml/cohttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/powershell/common.js.map +0 -7
- package/dist/httpsnippet-lite/targets/powershell/restmethod/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/powershell/webrequest/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/python/python3/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/r/httr/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/ruby/native/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/shell/httpie/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/shell/wget/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/swift/helpers.js.map +0 -7
- package/dist/httpsnippet-lite/targets/swift/nsurlsession/client.js.map +0 -7
- package/dist/httpsnippet-lite/targets/target.js.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/libs/http.js.map +0 -7
- package/dist/libs/javascript.js.map +0 -7
- package/dist/libs/php.js.map +0 -7
- package/dist/libs/rust.js.map +0 -7
- package/dist/libs/shell.js.map +0 -7
- package/dist/plugins/c/libcurl/index.js.map +0 -7
- package/dist/plugins/c/libcurl/libcurl.js.map +0 -7
- package/dist/plugins/clojure/clj_http/clj_http.js.map +0 -7
- package/dist/plugins/clojure/clj_http/index.js.map +0 -7
- package/dist/plugins/csharp/httpclient/httpclient.js.map +0 -7
- package/dist/plugins/csharp/httpclient/index.js.map +0 -7
- package/dist/plugins/csharp/restsharp/index.js.map +0 -7
- package/dist/plugins/csharp/restsharp/restsharp.js.map +0 -7
- package/dist/plugins/dart/http/http.js.map +0 -7
- package/dist/plugins/dart/http/index.js.map +0 -7
- package/dist/plugins/fsharp/httpclient/httpclient.js.map +0 -7
- package/dist/plugins/fsharp/httpclient/index.js.map +0 -7
- package/dist/plugins/go/native/index.js.map +0 -7
- package/dist/plugins/go/native/native.js.map +0 -7
- package/dist/plugins/http/http11/http11.js.map +0 -7
- package/dist/plugins/http/http11/index.js.map +0 -7
- package/dist/plugins/java/asynchttp/asynchttp.js.map +0 -7
- package/dist/plugins/java/asynchttp/index.js.map +0 -7
- package/dist/plugins/java/nethttp/index.js.map +0 -7
- package/dist/plugins/java/nethttp/nethttp.js.map +0 -7
- package/dist/plugins/java/okhttp/index.js.map +0 -7
- package/dist/plugins/java/okhttp/okhttp.js.map +0 -7
- package/dist/plugins/java/unirest/index.js.map +0 -7
- package/dist/plugins/java/unirest/unirest.js.map +0 -7
- package/dist/plugins/js/axios/axios.js.map +0 -7
- package/dist/plugins/js/axios/index.js.map +0 -7
- package/dist/plugins/js/fetch/fetch.js.map +0 -7
- package/dist/plugins/js/fetch/index.js.map +0 -7
- package/dist/plugins/js/jquery/index.js.map +0 -7
- package/dist/plugins/js/jquery/jquery.js.map +0 -7
- package/dist/plugins/js/ofetch/index.js.map +0 -7
- package/dist/plugins/js/ofetch/ofetch.js.map +0 -7
- package/dist/plugins/js/xhr/index.js.map +0 -7
- package/dist/plugins/js/xhr/xhr.js.map +0 -7
- package/dist/plugins/kotlin/okhttp/index.js.map +0 -7
- package/dist/plugins/kotlin/okhttp/okhttp.js.map +0 -7
- package/dist/plugins/node/axios/axios.js.map +0 -7
- package/dist/plugins/node/axios/index.js.map +0 -7
- package/dist/plugins/node/fetch/fetch.js.map +0 -7
- package/dist/plugins/node/fetch/index.js.map +0 -7
- package/dist/plugins/node/ofetch/index.js.map +0 -7
- package/dist/plugins/node/ofetch/ofetch.js.map +0 -7
- package/dist/plugins/node/undici/index.js.map +0 -7
- package/dist/plugins/node/undici/undici.js.map +0 -7
- package/dist/plugins/objc/nsurlsession/index.js.map +0 -7
- package/dist/plugins/objc/nsurlsession/nsurlsession.js.map +0 -7
- package/dist/plugins/ocaml/cohttp/cohttp.js.map +0 -7
- package/dist/plugins/ocaml/cohttp/index.js.map +0 -7
- package/dist/plugins/php/curl/curl.js.map +0 -7
- package/dist/plugins/php/curl/index.js.map +0 -7
- package/dist/plugins/php/guzzle/guzzle.js.map +0 -7
- package/dist/plugins/php/guzzle/index.js.map +0 -7
- package/dist/plugins/powershell/restmethod/index.js.map +0 -7
- package/dist/plugins/powershell/restmethod/restmethod.js.map +0 -7
- package/dist/plugins/powershell/webrequest/index.js.map +0 -7
- package/dist/plugins/powershell/webrequest/webrequest.js.map +0 -7
- package/dist/plugins/python/httpx/async.js.map +0 -7
- package/dist/plugins/python/httpx/index.js.map +0 -7
- package/dist/plugins/python/httpx/sync.js.map +0 -7
- package/dist/plugins/python/python3/index.js.map +0 -7
- package/dist/plugins/python/python3/python3.js.map +0 -7
- package/dist/plugins/python/requests/index.js.map +0 -7
- package/dist/plugins/python/requests/requests.js.map +0 -7
- package/dist/plugins/python/requestsLike.js.map +0 -7
- package/dist/plugins/r/httr/httr.js.map +0 -7
- package/dist/plugins/r/httr/index.js.map +0 -7
- package/dist/plugins/ruby/native/index.js.map +0 -7
- package/dist/plugins/ruby/native/native.js.map +0 -7
- package/dist/plugins/rust/reqwest/index.js.map +0 -7
- package/dist/plugins/rust/reqwest/reqwest.js.map +0 -7
- package/dist/plugins/shell/curl/curl.js.map +0 -7
- package/dist/plugins/shell/curl/index.js.map +0 -7
- package/dist/plugins/shell/httpie/httpie.js.map +0 -7
- package/dist/plugins/shell/httpie/index.js.map +0 -7
- package/dist/plugins/shell/wget/index.js.map +0 -7
- package/dist/plugins/shell/wget/wget.js.map +0 -7
- package/dist/plugins/swift/nsurlsession/index.js.map +0 -7
- package/dist/plugins/swift/nsurlsession/nsurlsession.js.map +0 -7
- package/dist/snippetz.js.map +0 -7
- package/dist/utils/convertWithHttpSnippetLite.js.map +0 -7
- package/dist/utils/index.js.map +0 -7
package/dist/clients/index.js
CHANGED
|
@@ -1,170 +1,169 @@
|
|
|
1
|
-
import { cLibcurl } from
|
|
2
|
-
import { clojureCljhttp } from
|
|
3
|
-
import { csharpHttpclient } from
|
|
4
|
-
import { csharpRestsharp } from
|
|
5
|
-
import { dartHttp } from
|
|
6
|
-
import { fsharpHttpclient } from
|
|
7
|
-
import { goNative } from
|
|
8
|
-
import { httpHttp11 } from
|
|
9
|
-
import { javaAsynchttp } from
|
|
10
|
-
import { javaNethttp } from
|
|
11
|
-
import { javaOkhttp } from
|
|
12
|
-
import { javaUnirest } from
|
|
13
|
-
import { jsAxios } from
|
|
14
|
-
import { jsFetch } from
|
|
15
|
-
import { jsJquery } from
|
|
16
|
-
import { jsOfetch } from
|
|
17
|
-
import { jsXhr } from
|
|
18
|
-
import { kotlinOkhttp } from
|
|
19
|
-
import { nodeAxios } from
|
|
20
|
-
import { nodeFetch } from
|
|
21
|
-
import { nodeOfetch } from
|
|
22
|
-
import { nodeUndici } from
|
|
23
|
-
import { objcNsurlsession } from
|
|
24
|
-
import { ocamlCohttp } from
|
|
25
|
-
import { phpCurl } from
|
|
26
|
-
import { phpGuzzle } from
|
|
27
|
-
import { powershellRestmethod } from
|
|
28
|
-
import { powershellWebrequest } from
|
|
29
|
-
import { pythonHttpxAsync, pythonHttpxSync } from
|
|
30
|
-
import { pythonPython3 } from
|
|
31
|
-
import { pythonRequests } from
|
|
32
|
-
import { rHttr } from
|
|
33
|
-
import { rubyNative } from
|
|
34
|
-
import { rustReqwest } from
|
|
35
|
-
import { shellCurl } from
|
|
36
|
-
import { shellHttpie } from
|
|
37
|
-
import { shellWget } from
|
|
38
|
-
import { swiftNsurlsession } from
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
1
|
+
import { cLibcurl } from '../plugins/c/libcurl/index.js';
|
|
2
|
+
import { clojureCljhttp } from '../plugins/clojure/clj_http/index.js';
|
|
3
|
+
import { csharpHttpclient } from '../plugins/csharp/httpclient/index.js';
|
|
4
|
+
import { csharpRestsharp } from '../plugins/csharp/restsharp/index.js';
|
|
5
|
+
import { dartHttp } from '../plugins/dart/http/index.js';
|
|
6
|
+
import { fsharpHttpclient } from '../plugins/fsharp/httpclient/index.js';
|
|
7
|
+
import { goNative } from '../plugins/go/native/index.js';
|
|
8
|
+
import { httpHttp11 } from '../plugins/http/http11/index.js';
|
|
9
|
+
import { javaAsynchttp } from '../plugins/java/asynchttp/index.js';
|
|
10
|
+
import { javaNethttp } from '../plugins/java/nethttp/index.js';
|
|
11
|
+
import { javaOkhttp } from '../plugins/java/okhttp/index.js';
|
|
12
|
+
import { javaUnirest } from '../plugins/java/unirest/index.js';
|
|
13
|
+
import { jsAxios } from '../plugins/js/axios/index.js';
|
|
14
|
+
import { jsFetch } from '../plugins/js/fetch/index.js';
|
|
15
|
+
import { jsJquery } from '../plugins/js/jquery/index.js';
|
|
16
|
+
import { jsOfetch } from '../plugins/js/ofetch/index.js';
|
|
17
|
+
import { jsXhr } from '../plugins/js/xhr/index.js';
|
|
18
|
+
import { kotlinOkhttp } from '../plugins/kotlin/okhttp/index.js';
|
|
19
|
+
import { nodeAxios } from '../plugins/node/axios/index.js';
|
|
20
|
+
import { nodeFetch } from '../plugins/node/fetch/index.js';
|
|
21
|
+
import { nodeOfetch } from '../plugins/node/ofetch/index.js';
|
|
22
|
+
import { nodeUndici } from '../plugins/node/undici/index.js';
|
|
23
|
+
import { objcNsurlsession } from '../plugins/objc/nsurlsession/index.js';
|
|
24
|
+
import { ocamlCohttp } from '../plugins/ocaml/cohttp/index.js';
|
|
25
|
+
import { phpCurl } from '../plugins/php/curl/index.js';
|
|
26
|
+
import { phpGuzzle } from '../plugins/php/guzzle/index.js';
|
|
27
|
+
import { powershellRestmethod } from '../plugins/powershell/restmethod/index.js';
|
|
28
|
+
import { powershellWebrequest } from '../plugins/powershell/webrequest/index.js';
|
|
29
|
+
import { pythonHttpxAsync, pythonHttpxSync } from '../plugins/python/httpx/index.js';
|
|
30
|
+
import { pythonPython3 } from '../plugins/python/python3/index.js';
|
|
31
|
+
import { pythonRequests } from '../plugins/python/requests/index.js';
|
|
32
|
+
import { rHttr } from '../plugins/r/httr/index.js';
|
|
33
|
+
import { rubyNative } from '../plugins/ruby/native/index.js';
|
|
34
|
+
import { rustReqwest } from '../plugins/rust/reqwest/index.js';
|
|
35
|
+
import { shellCurl } from '../plugins/shell/curl/index.js';
|
|
36
|
+
import { shellHttpie } from '../plugins/shell/httpie/index.js';
|
|
37
|
+
import { shellWget } from '../plugins/shell/wget/index.js';
|
|
38
|
+
import { swiftNsurlsession } from '../plugins/swift/nsurlsession/index.js';
|
|
39
|
+
/**
|
|
40
|
+
* All available clients
|
|
41
|
+
*/
|
|
42
|
+
export const clients = [
|
|
43
|
+
{
|
|
44
|
+
key: 'c',
|
|
45
|
+
title: 'C',
|
|
46
|
+
default: 'libcurl',
|
|
47
|
+
clients: [cLibcurl],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: 'csharp',
|
|
51
|
+
title: 'C#',
|
|
52
|
+
default: 'restsharp',
|
|
53
|
+
clients: [csharpHttpclient, csharpRestsharp],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'clojure',
|
|
57
|
+
title: 'Clojure',
|
|
58
|
+
default: 'clj_http',
|
|
59
|
+
clients: [clojureCljhttp],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: 'dart',
|
|
63
|
+
title: 'Dart',
|
|
64
|
+
default: 'http',
|
|
65
|
+
clients: [dartHttp],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: 'fsharp',
|
|
69
|
+
title: 'F#',
|
|
70
|
+
default: 'httpclient',
|
|
71
|
+
clients: [fsharpHttpclient],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
key: 'go',
|
|
75
|
+
title: 'Go',
|
|
76
|
+
default: 'native',
|
|
77
|
+
clients: [goNative],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: 'http',
|
|
81
|
+
title: 'HTTP',
|
|
82
|
+
default: 'http1.1',
|
|
83
|
+
clients: [httpHttp11],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
key: 'java',
|
|
87
|
+
title: 'Java',
|
|
88
|
+
default: 'unirest',
|
|
89
|
+
clients: [javaAsynchttp, javaNethttp, javaOkhttp, javaUnirest],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
key: 'js',
|
|
93
|
+
title: 'JavaScript',
|
|
94
|
+
default: 'fetch',
|
|
95
|
+
clients: [jsFetch, jsAxios, jsOfetch, jsJquery, jsXhr],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: 'kotlin',
|
|
99
|
+
title: 'Kotlin',
|
|
100
|
+
default: 'okhttp',
|
|
101
|
+
clients: [kotlinOkhttp],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
key: 'node',
|
|
105
|
+
title: 'Node.js',
|
|
106
|
+
default: 'fetch',
|
|
107
|
+
clients: [nodeFetch, nodeAxios, nodeOfetch, nodeUndici],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: 'objc',
|
|
111
|
+
title: 'Objective-C',
|
|
112
|
+
default: 'nsurlsession',
|
|
113
|
+
clients: [objcNsurlsession],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: 'ocaml',
|
|
117
|
+
title: 'OCaml',
|
|
118
|
+
default: 'cohttp',
|
|
119
|
+
clients: [ocamlCohttp],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: 'php',
|
|
123
|
+
title: 'PHP',
|
|
124
|
+
default: 'curl',
|
|
125
|
+
clients: [phpCurl, phpGuzzle],
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
key: 'powershell',
|
|
129
|
+
title: 'PowerShell',
|
|
130
|
+
default: 'webrequest',
|
|
131
|
+
clients: [powershellWebrequest, powershellRestmethod],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
key: 'python',
|
|
135
|
+
title: 'Python',
|
|
136
|
+
default: 'python3',
|
|
137
|
+
clients: [pythonPython3, pythonRequests, pythonHttpxSync, pythonHttpxAsync],
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
key: 'r',
|
|
141
|
+
title: 'R',
|
|
142
|
+
default: 'httr',
|
|
143
|
+
clients: [rHttr],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
key: 'ruby',
|
|
147
|
+
title: 'Ruby',
|
|
148
|
+
default: 'native',
|
|
149
|
+
clients: [rubyNative],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
key: 'rust',
|
|
153
|
+
title: 'Rust',
|
|
154
|
+
default: 'reqwest',
|
|
155
|
+
clients: [rustReqwest],
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
key: 'shell',
|
|
159
|
+
title: 'Shell',
|
|
160
|
+
default: 'curl',
|
|
161
|
+
clients: [shellCurl, shellWget, shellHttpie],
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
key: 'swift',
|
|
165
|
+
title: 'Swift',
|
|
166
|
+
default: 'nsurlsession',
|
|
167
|
+
clients: [swiftNsurlsession],
|
|
168
|
+
},
|
|
166
169
|
];
|
|
167
|
-
export {
|
|
168
|
-
clients
|
|
169
|
-
};
|
|
170
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,75 +1,87 @@
|
|
|
1
|
-
const DEFAULT_INDENTATION_CHARACTER =
|
|
2
|
-
const DEFAULT_LINE_JOIN =
|
|
3
|
-
class CodeBuilder {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
const DEFAULT_INDENTATION_CHARACTER = '';
|
|
2
|
+
const DEFAULT_LINE_JOIN = '\n';
|
|
3
|
+
export class CodeBuilder {
|
|
4
|
+
postProcessors;
|
|
5
|
+
code;
|
|
6
|
+
indentationCharacter;
|
|
7
|
+
lineJoin;
|
|
8
|
+
/**
|
|
9
|
+
* Add given indentation level to given line of code
|
|
10
|
+
*/
|
|
11
|
+
indentLine;
|
|
12
|
+
/**
|
|
13
|
+
* Add the line at the beginning of the current lines
|
|
14
|
+
*/
|
|
15
|
+
unshift;
|
|
16
|
+
/**
|
|
17
|
+
* Add the line at the end of the current lines
|
|
18
|
+
*/
|
|
19
|
+
push;
|
|
20
|
+
/**
|
|
21
|
+
* Add an empty line at the end of current lines
|
|
22
|
+
*/
|
|
23
|
+
blank;
|
|
24
|
+
/**
|
|
25
|
+
* Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added
|
|
26
|
+
*/
|
|
27
|
+
join;
|
|
28
|
+
/**
|
|
29
|
+
* Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.
|
|
30
|
+
* To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.
|
|
31
|
+
*/
|
|
32
|
+
addPostProcessor;
|
|
33
|
+
/**
|
|
34
|
+
* Helper object to format and aggragate lines of code.
|
|
35
|
+
* Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
|
|
36
|
+
*/
|
|
37
|
+
constructor({ indent, join } = {}) {
|
|
38
|
+
this.postProcessors = [];
|
|
39
|
+
this.code = [];
|
|
40
|
+
this.indentationCharacter = DEFAULT_INDENTATION_CHARACTER;
|
|
41
|
+
this.lineJoin = DEFAULT_LINE_JOIN;
|
|
42
|
+
/**
|
|
43
|
+
* Add given indentation level to given line of code
|
|
44
|
+
*/
|
|
45
|
+
this.indentLine = (line, indentationLevel = 0) => {
|
|
46
|
+
const whitespace = this.indentationCharacter.repeat(indentationLevel);
|
|
47
|
+
return `${whitespace}${line}`;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Add the line at the beginning of the current lines
|
|
51
|
+
*/
|
|
52
|
+
this.unshift = (line, indentationLevel) => {
|
|
53
|
+
const newLine = this.indentLine(line, indentationLevel);
|
|
54
|
+
this.code.unshift(newLine);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Add the line at the end of the current lines
|
|
58
|
+
*/
|
|
59
|
+
this.push = (line, indentationLevel) => {
|
|
60
|
+
const newLine = this.indentLine(line, indentationLevel);
|
|
61
|
+
this.code.push(newLine);
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Add an empty line at the end of current lines
|
|
65
|
+
*/
|
|
66
|
+
this.blank = () => {
|
|
67
|
+
this.code.push('');
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added
|
|
71
|
+
*/
|
|
72
|
+
this.join = () => {
|
|
73
|
+
const unreplacedCode = this.code.join(this.lineJoin);
|
|
74
|
+
const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);
|
|
75
|
+
return replacedOutput;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.
|
|
79
|
+
* To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.
|
|
80
|
+
*/
|
|
81
|
+
this.addPostProcessor = (postProcessor) => {
|
|
82
|
+
this.postProcessors = [...this.postProcessors, postProcessor];
|
|
83
|
+
};
|
|
84
|
+
this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;
|
|
85
|
+
this.lineJoin = join !== null && join !== void 0 ? join : DEFAULT_LINE_JOIN;
|
|
86
|
+
}
|
|
71
87
|
}
|
|
72
|
-
export {
|
|
73
|
-
CodeBuilder
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=code-builder.js.map
|
|
@@ -1,45 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Escape characters within a value to make it safe to insert directly into a
|
|
3
|
+
* snippet. Takes options which define the escape requirements.
|
|
4
|
+
*
|
|
5
|
+
* This is closely based on the JSON-stringify string serialization algorithm,
|
|
6
|
+
* but generalized for other string delimiters (e.g. " or ') and different escape
|
|
7
|
+
* characters (e.g. Powershell uses `)
|
|
8
|
+
*
|
|
9
|
+
* See https://tc39.es/ecma262/multipage/structured-data.html#sec-quotejsonstring
|
|
10
|
+
* for the complete original algorithm.
|
|
11
|
+
*/
|
|
12
|
+
export function escapeString(rawValue, options = {}) {
|
|
13
|
+
const { delimiter = '"', escapeChar = '\\', escapeNewlines = true } = options;
|
|
14
|
+
const stringValue = rawValue.toString();
|
|
15
|
+
return [...stringValue]
|
|
16
|
+
.map((c) => {
|
|
17
|
+
if (c === '\b') {
|
|
18
|
+
return `${escapeChar}b`;
|
|
19
|
+
}
|
|
20
|
+
if (c === '\t') {
|
|
21
|
+
return `${escapeChar}t`;
|
|
22
|
+
}
|
|
23
|
+
if (c === '\n') {
|
|
24
|
+
if (escapeNewlines) {
|
|
25
|
+
return `${escapeChar}n`;
|
|
26
|
+
}
|
|
27
|
+
return c; // Don't just continue, or this is caught by < \u0020
|
|
28
|
+
}
|
|
29
|
+
if (c === '\f') {
|
|
30
|
+
return `${escapeChar}f`;
|
|
31
|
+
}
|
|
32
|
+
if (c === '\r') {
|
|
33
|
+
if (escapeNewlines) {
|
|
34
|
+
return `${escapeChar}r`;
|
|
35
|
+
}
|
|
36
|
+
return c; // Don't just continue, or this is caught by < \u0020
|
|
37
|
+
}
|
|
38
|
+
if (c === escapeChar) {
|
|
39
|
+
return escapeChar + escapeChar;
|
|
40
|
+
}
|
|
41
|
+
if (c === delimiter) {
|
|
42
|
+
return escapeChar + delimiter;
|
|
43
|
+
}
|
|
44
|
+
if (c < '\u0020' || c > '\u007E') {
|
|
45
|
+
// Delegate the trickier non-ASCII cases to the normal algorithm. Some of these
|
|
46
|
+
// are escaped as \uXXXX, whilst others are represented literally. Since we're
|
|
47
|
+
// using this primarily for header values that are generally (though not 100%
|
|
48
|
+
// strictly?) ASCII-only, this should almost never happen.
|
|
49
|
+
return JSON.stringify(c).slice(1, -1);
|
|
50
|
+
}
|
|
51
|
+
return c;
|
|
52
|
+
})
|
|
53
|
+
.join('');
|
|
37
54
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Make a string value safe to insert literally into a snippet within single quotes,
|
|
57
|
+
* by escaping problematic characters, including single quotes inside the string,
|
|
58
|
+
* backslashes, newlines, and other special characters.
|
|
59
|
+
*
|
|
60
|
+
* If value is not a string, it will be stringified with .toString() first.
|
|
61
|
+
*/
|
|
62
|
+
export const escapeForSingleQuotes = (value) => escapeString(value, { delimiter: "'" });
|
|
63
|
+
/**
|
|
64
|
+
* Make a string value safe to insert literally into a snippet within double quotes,
|
|
65
|
+
* by escaping problematic characters, including double quotes inside the string,
|
|
66
|
+
* backslashes, newlines, and other special characters.
|
|
67
|
+
*
|
|
68
|
+
* If value is not a string, it will be stringified with .toString() first.
|
|
69
|
+
*/
|
|
70
|
+
export const escapeForDoubleQuotes = (value) => escapeString(value, { delimiter: '"' });
|