@scalar/snippetz 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +3 -3
  2. package/dist/core/types.d.ts +46 -11
  3. package/dist/core/types.d.ts.map +1 -1
  4. package/dist/core/utils/convertWithHttpSnippetLite.d.ts +7 -0
  5. package/dist/core/utils/convertWithHttpSnippetLite.d.ts.map +1 -0
  6. package/dist/core/utils/convertWithHttpSnippetLite.js +83 -0
  7. package/dist/plugins/c/libcurl/index.d.ts +2 -0
  8. package/dist/plugins/c/libcurl/index.d.ts.map +1 -0
  9. package/dist/plugins/c/libcurl/index.js +1 -0
  10. package/dist/plugins/c/libcurl/libcurl.d.ts +6 -0
  11. package/dist/plugins/c/libcurl/libcurl.d.ts.map +1 -0
  12. package/dist/plugins/c/libcurl/libcurl.js +16 -0
  13. package/dist/plugins/clojure/clj_http/clj_http.d.ts +6 -0
  14. package/dist/plugins/clojure/clj_http/clj_http.d.ts.map +1 -0
  15. package/dist/plugins/clojure/clj_http/clj_http.js +16 -0
  16. package/dist/plugins/clojure/clj_http/index.d.ts +2 -0
  17. package/dist/plugins/clojure/clj_http/index.d.ts.map +1 -0
  18. package/dist/plugins/clojure/clj_http/index.js +1 -0
  19. package/dist/plugins/csharp/httpclient/httpclient.d.ts +6 -0
  20. package/dist/plugins/csharp/httpclient/httpclient.d.ts.map +1 -0
  21. package/dist/plugins/csharp/httpclient/httpclient.js +16 -0
  22. package/dist/plugins/csharp/httpclient/index.d.ts +2 -0
  23. package/dist/plugins/csharp/httpclient/index.d.ts.map +1 -0
  24. package/dist/plugins/csharp/httpclient/index.js +1 -0
  25. package/dist/plugins/csharp/restsharp/index.d.ts +2 -0
  26. package/dist/plugins/csharp/restsharp/index.d.ts.map +1 -0
  27. package/dist/plugins/csharp/restsharp/index.js +1 -0
  28. package/dist/plugins/csharp/restsharp/restsharp.d.ts +6 -0
  29. package/dist/plugins/csharp/restsharp/restsharp.d.ts.map +1 -0
  30. package/dist/plugins/csharp/restsharp/restsharp.js +16 -0
  31. package/dist/plugins/go/native/index.d.ts +2 -0
  32. package/dist/plugins/go/native/index.d.ts.map +1 -0
  33. package/dist/plugins/go/native/index.js +1 -0
  34. package/dist/plugins/go/native/native.d.ts +6 -0
  35. package/dist/plugins/go/native/native.d.ts.map +1 -0
  36. package/dist/plugins/go/native/native.js +16 -0
  37. package/dist/plugins/http/http11/http11.d.ts +6 -0
  38. package/dist/plugins/http/http11/http11.d.ts.map +1 -0
  39. package/dist/plugins/http/http11/http11.js +16 -0
  40. package/dist/plugins/http/http11/index.d.ts +2 -0
  41. package/dist/plugins/http/http11/index.d.ts.map +1 -0
  42. package/dist/plugins/http/http11/index.js +1 -0
  43. package/dist/plugins/java/asynchttp/asynchttp.d.ts +6 -0
  44. package/dist/plugins/java/asynchttp/asynchttp.d.ts.map +1 -0
  45. package/dist/plugins/java/asynchttp/asynchttp.js +16 -0
  46. package/dist/plugins/java/asynchttp/index.d.ts +2 -0
  47. package/dist/plugins/java/asynchttp/index.d.ts.map +1 -0
  48. package/dist/plugins/java/asynchttp/index.js +1 -0
  49. package/dist/plugins/java/nethttp/index.d.ts +2 -0
  50. package/dist/plugins/java/nethttp/index.d.ts.map +1 -0
  51. package/dist/plugins/java/nethttp/index.js +1 -0
  52. package/dist/plugins/java/nethttp/nethttp.d.ts +6 -0
  53. package/dist/plugins/java/nethttp/nethttp.d.ts.map +1 -0
  54. package/dist/plugins/java/nethttp/nethttp.js +16 -0
  55. package/dist/plugins/java/okhttp/index.d.ts +2 -0
  56. package/dist/plugins/java/okhttp/index.d.ts.map +1 -0
  57. package/dist/plugins/java/okhttp/index.js +1 -0
  58. package/dist/plugins/java/okhttp/okhttp.d.ts +6 -0
  59. package/dist/plugins/java/okhttp/okhttp.d.ts.map +1 -0
  60. package/dist/plugins/java/okhttp/okhttp.js +16 -0
  61. package/dist/plugins/java/unirest/index.d.ts +2 -0
  62. package/dist/plugins/java/unirest/index.d.ts.map +1 -0
  63. package/dist/plugins/java/unirest/index.js +1 -0
  64. package/dist/plugins/java/unirest/unirest.d.ts +6 -0
  65. package/dist/plugins/java/unirest/unirest.d.ts.map +1 -0
  66. package/dist/plugins/java/unirest/unirest.js +16 -0
  67. package/dist/plugins/js/axios/axios.d.ts +6 -0
  68. package/dist/plugins/js/axios/axios.d.ts.map +1 -0
  69. package/dist/plugins/js/axios/axios.js +16 -0
  70. package/dist/plugins/js/axios/index.d.ts +2 -0
  71. package/dist/plugins/js/axios/index.d.ts.map +1 -0
  72. package/dist/plugins/js/axios/index.js +1 -0
  73. package/dist/plugins/js/fetch/fetch.d.ts +2 -6
  74. package/dist/plugins/js/fetch/fetch.d.ts.map +1 -1
  75. package/dist/plugins/js/fetch/fetch.js +60 -59
  76. package/dist/plugins/js/fetch/index.js +1 -1
  77. package/dist/plugins/js/jquery/index.d.ts +2 -0
  78. package/dist/plugins/js/jquery/index.d.ts.map +1 -0
  79. package/dist/plugins/js/jquery/index.js +1 -0
  80. package/dist/plugins/js/jquery/jquery.d.ts +6 -0
  81. package/dist/plugins/js/jquery/jquery.d.ts.map +1 -0
  82. package/dist/plugins/js/jquery/jquery.js +16 -0
  83. package/dist/plugins/js/ofetch/index.js +1 -1
  84. package/dist/plugins/js/ofetch/ofetch.d.ts +2 -6
  85. package/dist/plugins/js/ofetch/ofetch.d.ts.map +1 -1
  86. package/dist/plugins/js/ofetch/ofetch.js +65 -64
  87. package/dist/plugins/js/xhr/index.d.ts +2 -0
  88. package/dist/plugins/js/xhr/index.d.ts.map +1 -0
  89. package/dist/plugins/js/xhr/index.js +1 -0
  90. package/dist/plugins/js/xhr/xhr.d.ts +6 -0
  91. package/dist/plugins/js/xhr/xhr.d.ts.map +1 -0
  92. package/dist/plugins/js/xhr/xhr.js +16 -0
  93. package/dist/plugins/kotlin/okhttp/index.d.ts +2 -0
  94. package/dist/plugins/kotlin/okhttp/index.d.ts.map +1 -0
  95. package/dist/plugins/kotlin/okhttp/index.js +1 -0
  96. package/dist/plugins/kotlin/okhttp/okhttp.d.ts +6 -0
  97. package/dist/plugins/kotlin/okhttp/okhttp.d.ts.map +1 -0
  98. package/dist/plugins/kotlin/okhttp/okhttp.js +16 -0
  99. package/dist/plugins/node/axios/axios.d.ts +6 -0
  100. package/dist/plugins/node/axios/axios.d.ts.map +1 -0
  101. package/dist/plugins/node/axios/axios.js +16 -0
  102. package/dist/plugins/node/axios/index.d.ts +2 -0
  103. package/dist/plugins/node/axios/index.d.ts.map +1 -0
  104. package/dist/plugins/node/axios/index.js +1 -0
  105. package/dist/plugins/node/fetch/fetch.d.ts +2 -6
  106. package/dist/plugins/node/fetch/fetch.d.ts.map +1 -1
  107. package/dist/plugins/node/fetch/fetch.js +60 -59
  108. package/dist/plugins/node/fetch/index.js +1 -1
  109. package/dist/plugins/node/ofetch/index.js +1 -1
  110. package/dist/plugins/node/ofetch/ofetch.d.ts +2 -6
  111. package/dist/plugins/node/ofetch/ofetch.d.ts.map +1 -1
  112. package/dist/plugins/node/ofetch/ofetch.js +65 -64
  113. package/dist/plugins/node/undici/index.js +1 -1
  114. package/dist/plugins/node/undici/undici.d.ts +2 -6
  115. package/dist/plugins/node/undici/undici.d.ts.map +1 -1
  116. package/dist/plugins/node/undici/undici.js +60 -59
  117. package/dist/plugins/objc/nsurlsession/index.d.ts +2 -0
  118. package/dist/plugins/objc/nsurlsession/index.d.ts.map +1 -0
  119. package/dist/plugins/objc/nsurlsession/index.js +1 -0
  120. package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts +6 -0
  121. package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts.map +1 -0
  122. package/dist/plugins/objc/nsurlsession/nsurlsession.js +16 -0
  123. package/dist/plugins/ocaml/cohttp/cohttp.d.ts +6 -0
  124. package/dist/plugins/ocaml/cohttp/cohttp.d.ts.map +1 -0
  125. package/dist/plugins/ocaml/cohttp/cohttp.js +16 -0
  126. package/dist/plugins/ocaml/cohttp/index.d.ts +2 -0
  127. package/dist/plugins/ocaml/cohttp/index.d.ts.map +1 -0
  128. package/dist/plugins/ocaml/cohttp/index.js +1 -0
  129. package/dist/plugins/php/curl/curl.d.ts +6 -0
  130. package/dist/plugins/php/curl/curl.d.ts.map +1 -0
  131. package/dist/plugins/php/curl/curl.js +16 -0
  132. package/dist/plugins/php/curl/index.d.ts +2 -0
  133. package/dist/plugins/php/curl/index.d.ts.map +1 -0
  134. package/dist/plugins/php/curl/index.js +1 -0
  135. package/dist/plugins/php/guzzle/guzzle.d.ts +6 -0
  136. package/dist/plugins/php/guzzle/guzzle.d.ts.map +1 -0
  137. package/dist/plugins/php/guzzle/guzzle.js +16 -0
  138. package/dist/plugins/php/guzzle/index.d.ts +2 -0
  139. package/dist/plugins/php/guzzle/index.d.ts.map +1 -0
  140. package/dist/plugins/php/guzzle/index.js +1 -0
  141. package/dist/plugins/powershell/restmethod/index.d.ts +2 -0
  142. package/dist/plugins/powershell/restmethod/index.d.ts.map +1 -0
  143. package/dist/plugins/powershell/restmethod/index.js +1 -0
  144. package/dist/plugins/powershell/restmethod/restmethod.d.ts +6 -0
  145. package/dist/plugins/powershell/restmethod/restmethod.d.ts.map +1 -0
  146. package/dist/plugins/powershell/restmethod/restmethod.js +16 -0
  147. package/dist/plugins/powershell/webrequest/index.d.ts +2 -0
  148. package/dist/plugins/powershell/webrequest/index.d.ts.map +1 -0
  149. package/dist/plugins/powershell/webrequest/index.js +1 -0
  150. package/dist/plugins/powershell/webrequest/webrequest.d.ts +6 -0
  151. package/dist/plugins/powershell/webrequest/webrequest.d.ts.map +1 -0
  152. package/dist/plugins/powershell/webrequest/webrequest.js +16 -0
  153. package/dist/plugins/python/python3/index.d.ts +2 -0
  154. package/dist/plugins/python/python3/index.d.ts.map +1 -0
  155. package/dist/plugins/python/python3/index.js +1 -0
  156. package/dist/plugins/python/python3/python3.d.ts +6 -0
  157. package/dist/plugins/python/python3/python3.d.ts.map +1 -0
  158. package/dist/plugins/python/python3/python3.js +16 -0
  159. package/dist/plugins/python/requests/index.d.ts +2 -0
  160. package/dist/plugins/python/requests/index.d.ts.map +1 -0
  161. package/dist/plugins/python/requests/index.js +1 -0
  162. package/dist/plugins/python/requests/requests.d.ts +6 -0
  163. package/dist/plugins/python/requests/requests.d.ts.map +1 -0
  164. package/dist/plugins/python/requests/requests.js +16 -0
  165. package/dist/plugins/r/httr/httr.d.ts +6 -0
  166. package/dist/plugins/r/httr/httr.d.ts.map +1 -0
  167. package/dist/plugins/r/httr/httr.js +16 -0
  168. package/dist/plugins/r/httr/index.d.ts +2 -0
  169. package/dist/plugins/r/httr/index.d.ts.map +1 -0
  170. package/dist/plugins/r/httr/index.js +1 -0
  171. package/dist/plugins/ruby/native/index.d.ts +2 -0
  172. package/dist/plugins/ruby/native/index.d.ts.map +1 -0
  173. package/dist/plugins/ruby/native/index.js +1 -0
  174. package/dist/plugins/ruby/native/native.d.ts +6 -0
  175. package/dist/plugins/ruby/native/native.d.ts.map +1 -0
  176. package/dist/plugins/ruby/native/native.js +16 -0
  177. package/dist/plugins/shell/curl/curl.d.ts +2 -6
  178. package/dist/plugins/shell/curl/curl.d.ts.map +1 -1
  179. package/dist/plugins/shell/curl/curl.js +95 -95
  180. package/dist/plugins/shell/curl/index.js +1 -1
  181. package/dist/plugins/shell/httpie/httpie.d.ts +6 -0
  182. package/dist/plugins/shell/httpie/httpie.d.ts.map +1 -0
  183. package/dist/plugins/shell/httpie/httpie.js +16 -0
  184. package/dist/plugins/shell/httpie/index.d.ts +2 -0
  185. package/dist/plugins/shell/httpie/index.d.ts.map +1 -0
  186. package/dist/plugins/shell/httpie/index.js +1 -0
  187. package/dist/plugins/shell/wget/index.d.ts +2 -0
  188. package/dist/plugins/shell/wget/index.d.ts.map +1 -0
  189. package/dist/plugins/shell/wget/index.js +1 -0
  190. package/dist/plugins/shell/wget/wget.d.ts +6 -0
  191. package/dist/plugins/shell/wget/wget.d.ts.map +1 -0
  192. package/dist/plugins/shell/wget/wget.js +16 -0
  193. package/dist/plugins/swift/nsurlsession/index.d.ts +2 -0
  194. package/dist/plugins/swift/nsurlsession/index.d.ts.map +1 -0
  195. package/dist/plugins/swift/nsurlsession/index.js +1 -0
  196. package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts +6 -0
  197. package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts.map +1 -0
  198. package/dist/plugins/swift/nsurlsession/nsurlsession.js +16 -0
  199. package/dist/snippetz.d.ts +8 -11
  200. package/dist/snippetz.d.ts.map +1 -1
  201. package/dist/snippetz.js +78 -23
  202. package/package.json +146 -1
@@ -0,0 +1,16 @@
1
+ import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
2
+ import { restmethod } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/powershell/restmethod/client.mjs';
3
+
4
+ /**
5
+ * powershell/restmethod
6
+ */
7
+ const powershellRestmethod = {
8
+ target: 'powershell',
9
+ client: 'restmethod',
10
+ generate(request) {
11
+ // TODO: Write an own converter
12
+ return convertWithHttpSnippetLite(restmethod, request);
13
+ },
14
+ };
15
+
16
+ export { powershellRestmethod };
@@ -0,0 +1,2 @@
1
+ export * from './webrequest.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/powershell/webrequest/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -0,0 +1 @@
1
+ export { powershellWebrequest } from './webrequest.js';
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '../../../core/index.js';
2
+ /**
3
+ * powershell/webrequest
4
+ */
5
+ export declare const powershellWebrequest: Plugin;
6
+ //# sourceMappingURL=webrequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webrequest.d.ts","sourceRoot":"","sources":["../../../../src/plugins/powershell/webrequest/webrequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAOlC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
2
+ import { webrequest } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/powershell/webrequest/client.mjs';
3
+
4
+ /**
5
+ * powershell/webrequest
6
+ */
7
+ const powershellWebrequest = {
8
+ target: 'powershell',
9
+ client: 'webrequest',
10
+ generate(request) {
11
+ // TODO: Write an own converter
12
+ return convertWithHttpSnippetLite(webrequest, request);
13
+ },
14
+ };
15
+
16
+ export { powershellWebrequest };
@@ -0,0 +1,2 @@
1
+ export * from './python3.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/python/python3/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
@@ -0,0 +1 @@
1
+ export { pythonPython3 } from './python3.js';
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '../../../core/index.js';
2
+ /**
3
+ * python/python3
4
+ */
5
+ export declare const pythonPython3: Plugin;
6
+ //# sourceMappingURL=python3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python3.d.ts","sourceRoot":"","sources":["../../../../src/plugins/python/python3/python3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAO3B,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
2
+ import { python3 } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/python/python3/client.mjs';
3
+
4
+ /**
5
+ * python/python3
6
+ */
7
+ const pythonPython3 = {
8
+ target: 'python',
9
+ client: 'python3',
10
+ generate(request) {
11
+ // TODO: Write an own converter
12
+ return convertWithHttpSnippetLite(python3, request);
13
+ },
14
+ };
15
+
16
+ export { pythonPython3 };
@@ -0,0 +1,2 @@
1
+ export * from './requests.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/python/requests/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -0,0 +1 @@
1
+ export { pythonRequests } from './requests.js';
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '../../../core/index.js';
2
+ /**
3
+ * python/requests
4
+ */
5
+ export declare const pythonRequests: Plugin;
6
+ //# sourceMappingURL=requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/plugins/python/requests/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAO5B,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
2
+ import { requests } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/python/requests/client.mjs';
3
+
4
+ /**
5
+ * python/requests
6
+ */
7
+ const pythonRequests = {
8
+ target: 'python',
9
+ client: 'requests',
10
+ generate(request) {
11
+ // TODO: Write an own converter
12
+ return convertWithHttpSnippetLite(requests, request);
13
+ },
14
+ };
15
+
16
+ export { pythonRequests };
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '../../../core/index.js';
2
+ /**
3
+ * r/httr
4
+ */
5
+ export declare const rHttr: Plugin;
6
+ //# sourceMappingURL=httr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httr.d.ts","sourceRoot":"","sources":["../../../../src/plugins/r/httr/httr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,MAOnB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
2
+ import { httr } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/r/httr/client.mjs';
3
+
4
+ /**
5
+ * r/httr
6
+ */
7
+ const rHttr = {
8
+ target: 'r',
9
+ client: 'httr',
10
+ generate(request) {
11
+ // TODO: Write an own converter
12
+ return convertWithHttpSnippetLite(httr, request);
13
+ },
14
+ };
15
+
16
+ export { rHttr };
@@ -0,0 +1,2 @@
1
+ export * from './httr.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/r/httr/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
@@ -0,0 +1 @@
1
+ export { rHttr } from './httr.js';
@@ -0,0 +1,2 @@
1
+ export * from './native.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/ruby/native/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -0,0 +1 @@
1
+ export { rubyNative } from './native.js';
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '../../../core/index.js';
2
+ /**
3
+ * ruby/native
4
+ */
5
+ export declare const rubyNative: Plugin;
6
+ //# sourceMappingURL=native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../../src/plugins/ruby/native/native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAOxB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
2
+ import { native } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/ruby/native/client.mjs';
3
+
4
+ /**
5
+ * ruby/native
6
+ */
7
+ const rubyNative = {
8
+ target: 'ruby',
9
+ client: 'native',
10
+ generate(request) {
11
+ // TODO: Write an own converter
12
+ return convertWithHttpSnippetLite(native, request);
13
+ },
14
+ };
15
+
16
+ export { rubyNative };
@@ -1,10 +1,6 @@
1
- import type { AddClient, PluginConfiguration, Request, Source } from '../../../core/index.js';
2
- declare global {
3
- interface Clients extends AddClient<'shell', 'curl'> {
4
- }
5
- }
1
+ import type { Plugin } from '../../../core/index.js';
6
2
  /**
7
3
  * shell/curl
8
4
  */
9
- export declare function curl(request?: Partial<Request>, configuration?: PluginConfiguration): Source;
5
+ export declare const shellCurl: Plugin;
10
6
  //# sourceMappingURL=curl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/curl/curl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,MAAM,EACP,MAAM,eAAe,CAAA;AAEtB,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,OAAQ,SAAQ,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;KAAG;CACxD;AAED;;GAEG;AACH,wBAAgB,IAAI,CAClB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAC1B,aAAa,CAAC,EAAE,mBAAmB,GAClC,MAAM,CAoHR"}
1
+ {"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/curl/curl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,MAoHvB,CAAA"}
@@ -1,105 +1,105 @@
1
1
  /**
2
2
  * shell/curl
3
3
  */
4
- function curl(request, configuration) {
5
- // Defaults
6
- const normalizedRequest = {
7
- method: 'GET',
8
- ...request,
9
- };
10
- // Normalization
11
- normalizedRequest.method = normalizedRequest.method.toUpperCase();
12
- // Build curl command parts
13
- const parts = ['curl'];
14
- // URL (quote if has query parameters or special characters)
15
- const queryString = normalizedRequest.queryString?.length
16
- ? '?' +
17
- normalizedRequest.queryString
18
- .map((param) => {
19
- // Ensure both name and value are fully URI encoded
20
- const encodedName = encodeURIComponent(param.name);
21
- const encodedValue = encodeURIComponent(param.value);
22
- return `${encodedName}=${encodedValue}`;
23
- })
24
- .join('&')
25
- : '';
26
- const url = `${normalizedRequest.url}${queryString}`;
27
- const hasSpecialChars = /[\s<>[\]{}|\\^%]/.test(url);
28
- const urlPart = queryString || hasSpecialChars ? `'${url}'` : url;
29
- parts[0] = `curl ${urlPart}`;
30
- // Method
31
- if (normalizedRequest.method !== 'GET') {
32
- parts.push(`--request ${normalizedRequest.method}`);
33
- }
34
- // Basic Auth
35
- if (configuration?.auth?.username && configuration?.auth?.password) {
36
- parts.push(`--user '${configuration.auth.username}:${configuration.auth.password}'`);
37
- }
38
- // Headers
39
- if (normalizedRequest.headers?.length) {
40
- normalizedRequest.headers.forEach((header) => {
41
- parts.push(`--header '${header.name}: ${header.value}'`);
42
- });
43
- // Add compressed flag if Accept-Encoding header includes compression
44
- const acceptEncoding = normalizedRequest.headers.find((header) => header.name.toLowerCase() === 'accept-encoding');
45
- if (acceptEncoding && /gzip|deflate/.test(acceptEncoding.value)) {
46
- parts.push('--compressed');
47
- }
48
- }
49
- // Cookies
50
- if (normalizedRequest.cookies?.length) {
51
- const cookieString = normalizedRequest.cookies
52
- .map((cookie) => {
53
- // Encode both cookie name and value to handle special characters
54
- const encodedName = encodeURIComponent(cookie.name);
55
- const encodedValue = encodeURIComponent(cookie.value);
56
- return `${encodedName}=${encodedValue}`;
57
- })
58
- .join('; ');
59
- parts.push(`--cookie '${cookieString}'`);
60
- }
61
- // Body
62
- if (normalizedRequest.postData) {
63
- if (normalizedRequest.postData.mimeType === 'application/json') {
64
- // Pretty print JSON data
65
- if (normalizedRequest.postData.text) {
66
- const jsonData = JSON.parse(normalizedRequest.postData.text);
67
- const prettyJson = JSON.stringify(jsonData, null, 2);
68
- parts.push(`--data '${prettyJson}'`);
69
- }
4
+ const shellCurl = {
5
+ target: 'shell',
6
+ client: 'curl',
7
+ generate(request, configuration) {
8
+ // Defaults
9
+ const normalizedRequest = {
10
+ method: 'GET',
11
+ ...request,
12
+ };
13
+ // Normalization
14
+ normalizedRequest.method = normalizedRequest.method.toUpperCase();
15
+ // Build curl command parts
16
+ const parts = ['curl'];
17
+ // URL (quote if has query parameters or special characters)
18
+ const queryString = normalizedRequest.queryString?.length
19
+ ? '?' +
20
+ normalizedRequest.queryString
21
+ .map((param) => {
22
+ // Ensure both name and value are fully URI encoded
23
+ const encodedName = encodeURIComponent(param.name);
24
+ const encodedValue = encodeURIComponent(param.value);
25
+ return `${encodedName}=${encodedValue}`;
26
+ })
27
+ .join('&')
28
+ : '';
29
+ const url = `${normalizedRequest.url}${queryString}`;
30
+ const hasSpecialChars = /[\s<>[\]{}|\\^%]/.test(url);
31
+ const urlPart = queryString || hasSpecialChars ? `'${url}'` : url;
32
+ parts[0] = `curl ${urlPart}`;
33
+ // Method
34
+ if (normalizedRequest.method !== 'GET') {
35
+ parts.push(`--request ${normalizedRequest.method}`);
70
36
  }
71
- else if (normalizedRequest.postData.mimeType === 'application/octet-stream') {
72
- parts.push(`--data-binary '${normalizedRequest.postData.text}'`);
37
+ // Basic Auth
38
+ if (configuration?.auth?.username && configuration?.auth?.password) {
39
+ parts.push(`--user '${configuration.auth.username}:${configuration.auth.password}'`);
73
40
  }
74
- else if (normalizedRequest.postData.mimeType ===
75
- 'application/x-www-form-urlencoded' &&
76
- normalizedRequest.postData.params) {
77
- // Handle URL-encoded form data
78
- normalizedRequest.postData.params.forEach((param) => {
79
- parts.push(`--data-urlencode '${encodeURIComponent(param.name)}=${param.value}'`);
41
+ // Headers
42
+ if (normalizedRequest.headers?.length) {
43
+ normalizedRequest.headers.forEach((header) => {
44
+ parts.push(`--header '${header.name}: ${header.value}'`);
80
45
  });
46
+ // Add compressed flag if Accept-Encoding header includes compression
47
+ const acceptEncoding = normalizedRequest.headers.find((header) => header.name.toLowerCase() === 'accept-encoding');
48
+ if (acceptEncoding && /gzip|deflate/.test(acceptEncoding.value)) {
49
+ parts.push('--compressed');
50
+ }
81
51
  }
82
- else if (normalizedRequest.postData.mimeType === 'multipart/form-data' &&
83
- normalizedRequest.postData.params) {
84
- // Handle multipart form data
85
- normalizedRequest.postData.params.forEach((param) => {
86
- if (param.fileName !== undefined) {
87
- parts.push(`--form '${param.name}=@${param.fileName}'`);
88
- }
89
- else {
90
- parts.push(`--form '${param.name}=${param.value}'`);
91
- }
92
- });
52
+ // Cookies
53
+ if (normalizedRequest.cookies?.length) {
54
+ const cookieString = normalizedRequest.cookies
55
+ .map((cookie) => {
56
+ // Encode both cookie name and value to handle special characters
57
+ const encodedName = encodeURIComponent(cookie.name);
58
+ const encodedValue = encodeURIComponent(cookie.value);
59
+ return `${encodedName}=${encodedValue}`;
60
+ })
61
+ .join('; ');
62
+ parts.push(`--cookie '${cookieString}'`);
93
63
  }
94
- else {
95
- parts.push(`--data "${normalizedRequest.postData.text}"`);
64
+ // Body
65
+ if (normalizedRequest.postData) {
66
+ if (normalizedRequest.postData.mimeType === 'application/json') {
67
+ // Pretty print JSON data
68
+ if (normalizedRequest.postData.text) {
69
+ const jsonData = JSON.parse(normalizedRequest.postData.text);
70
+ const prettyJson = JSON.stringify(jsonData, null, 2);
71
+ parts.push(`--data '${prettyJson}'`);
72
+ }
73
+ }
74
+ else if (normalizedRequest.postData.mimeType === 'application/octet-stream') {
75
+ parts.push(`--data-binary '${normalizedRequest.postData.text}'`);
76
+ }
77
+ else if (normalizedRequest.postData.mimeType ===
78
+ 'application/x-www-form-urlencoded' &&
79
+ normalizedRequest.postData.params) {
80
+ // Handle URL-encoded form data
81
+ normalizedRequest.postData.params.forEach((param) => {
82
+ parts.push(`--data-urlencode '${encodeURIComponent(param.name)}=${param.value}'`);
83
+ });
84
+ }
85
+ else if (normalizedRequest.postData.mimeType === 'multipart/form-data' &&
86
+ normalizedRequest.postData.params) {
87
+ // Handle multipart form data
88
+ normalizedRequest.postData.params.forEach((param) => {
89
+ if (param.fileName !== undefined) {
90
+ parts.push(`--form '${param.name}=@${param.fileName}'`);
91
+ }
92
+ else {
93
+ parts.push(`--form '${param.name}=${param.value}'`);
94
+ }
95
+ });
96
+ }
97
+ else {
98
+ parts.push(`--data "${normalizedRequest.postData.text}"`);
99
+ }
96
100
  }
97
- }
98
- return {
99
- target: 'shell',
100
- client: 'curl',
101
- code: parts.join(' \\\n '),
102
- };
103
- }
101
+ return parts.join(' \\\n ');
102
+ },
103
+ };
104
104
 
105
- export { curl };
105
+ export { shellCurl };
@@ -1 +1 @@
1
- export { curl } from './curl.js';
1
+ export { shellCurl } from './curl.js';
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '../../../core/index.js';
2
+ /**
3
+ * shell/httpie
4
+ */
5
+ export declare const shellHttpie: Plugin;
6
+ //# sourceMappingURL=httpie.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpie.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/httpie/httpie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAOzB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
2
+ import { httpie } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/shell/httpie/client.mjs';
3
+
4
+ /**
5
+ * shell/httpie
6
+ */
7
+ const shellHttpie = {
8
+ target: 'shell',
9
+ client: 'httpie',
10
+ generate(request) {
11
+ // TODO: Write an own converter
12
+ return convertWithHttpSnippetLite(httpie, request);
13
+ },
14
+ };
15
+
16
+ export { shellHttpie };
@@ -0,0 +1,2 @@
1
+ export * from './httpie.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/httpie/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -0,0 +1 @@
1
+ export { shellHttpie } from './httpie.js';
@@ -0,0 +1,2 @@
1
+ export * from './wget.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/wget/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
@@ -0,0 +1 @@
1
+ export { shellWget } from './wget.js';
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '../../../core/index.js';
2
+ /**
3
+ * shell/wget
4
+ */
5
+ export declare const shellWget: Plugin;
6
+ //# sourceMappingURL=wget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wget.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shell/wget/wget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,MAOvB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
2
+ import { wget } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/shell/wget/client.mjs';
3
+
4
+ /**
5
+ * shell/wget
6
+ */
7
+ const shellWget = {
8
+ target: 'shell',
9
+ client: 'wget',
10
+ generate(request) {
11
+ // TODO: Write an own converter
12
+ return convertWithHttpSnippetLite(wget, request);
13
+ },
14
+ };
15
+
16
+ export { shellWget };
@@ -0,0 +1,2 @@
1
+ export * from './nsurlsession.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/swift/nsurlsession/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1 @@
1
+ export { swiftNsurlsession } from './nsurlsession.js';
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '../../../core/index.js';
2
+ /**
3
+ * swift/nsurlsession
4
+ */
5
+ export declare const swiftNsurlsession: Plugin;
6
+ //# sourceMappingURL=nsurlsession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nsurlsession.d.ts","sourceRoot":"","sources":["../../../../src/plugins/swift/nsurlsession/nsurlsession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAO/B,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { convertWithHttpSnippetLite } from '../../../core/utils/convertWithHttpSnippetLite.js';
2
+ import { nsurlsession } from '../../../../node_modules/httpsnippet-lite/dist/esm/targets/swift/nsurlsession/client.mjs';
3
+
4
+ /**
5
+ * swift/nsurlsession
6
+ */
7
+ const swiftNsurlsession = {
8
+ target: 'swift',
9
+ client: 'nsurlsession',
10
+ generate(request) {
11
+ // TODO: Write an own converter
12
+ return convertWithHttpSnippetLite(nsurlsession, request);
13
+ },
14
+ };
15
+
16
+ export { swiftNsurlsession };
@@ -1,20 +1,17 @@
1
- import type { ClientId, Request, TargetId } from './core/index.js';
2
- import { curl } from './plugins/shell/curl/index.js';
1
+ import type { ClientId, Plugin, Request, TargetId } from './core/index.js';
3
2
  /**
4
3
  * Generate code examples for HAR requests
5
4
  */
6
5
  export declare function snippetz(): {
7
- get(target: TargetId, client: ClientId<TargetId>, request: Partial<Request>): import("./core/index.js").Source | {
8
- code: string;
9
- };
10
- print<T extends TargetId>(target: T, client: ClientId<T>, request: Partial<Request>): string;
11
- targets(): ("js" | "node" | "shell")[];
12
- clients(): ClientId<"js" | "node" | "shell">[];
6
+ get(target: TargetId, client: ClientId<TargetId>): Plugin | undefined;
7
+ print<T extends TargetId>(target: T, client: ClientId<T>, request: Partial<Request>): string | undefined;
8
+ targets(): ("c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift")[];
9
+ clients(): ("libcurl" | "clj_http" | "httpclient" | "restsharp" | "native" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "fetch" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "httr" | "httpie" | "wget")[];
13
10
  plugins(): {
14
- target: "js" | "node" | "shell";
15
- client: ClientId<"js" | "node" | "shell">;
11
+ target: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift";
12
+ client: "libcurl" | "clj_http" | "httpclient" | "restsharp" | "native" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "fetch" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "httr" | "httpie" | "wget";
16
13
  }[];
17
- findPlugin<T extends TargetId>(target: T | string, client: ClientId<T> | string): typeof curl | undefined;
14
+ findPlugin<T extends TargetId>(target: T | string, client: ClientId<T> | string): Plugin | undefined;
18
15
  hasPlugin<T extends TargetId>(target: T | string, client: ClientId<T> | string): boolean;
19
16
  };
20
17
  //# sourceMappingURL=snippetz.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../src/snippetz.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAMzD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAE3C;;GAEG;AACH,wBAAgB,QAAQ;gBAKV,QAAQ,UACR,QAAQ,CAAC,QAAQ,CAAC,WACjB,OAAO,CAAC,OAAO,CAAC;;;UAYrB,CAAC,SAAS,QAAQ,UACd,CAAC,UACD,QAAQ,CAAC,CAAC,CAAC,WACV,OAAO,CAAC,OAAO,CAAC;;;;;;;eA0BhB,CAAC,SAAS,QAAQ,UACnB,CAAC,GAAG,MAAM,UACV,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM;cAQpB,CAAC,SAAS,QAAQ,UAClB,CAAC,GAAG,MAAM,UACV,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM;EAKjC"}
1
+ {"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../src/snippetz.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEjE;;GAEG;AACH,wBAAgB,QAAQ;gBAuCR,QAAQ,UAAU,QAAQ,CAAC,QAAQ,CAAC;UAG1C,CAAC,SAAS,QAAQ,UACd,CAAC,UACD,QAAQ,CAAC,CAAC,CAAC,WACV,OAAO,CAAC,OAAO,CAAC;;;;;;;eAwBhB,CAAC,SAAS,QAAQ,UACnB,CAAC,GAAG,MAAM,UACV,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM;cAMpB,CAAC,SAAS,QAAQ,UAClB,CAAC,GAAG,MAAM,UACV,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM;EAKjC"}