@roarkanalytics/sdk 0.1.0-alpha.1 → 0.1.0-alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (347) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +1 -1
  3. package/README.md +48 -85
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/{internal/utils.js → _shims/auto/runtime-bun.js} +5 -8
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +89 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +241 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +908 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +876 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +3 -3
  81. package/error.d.ts.map +1 -1
  82. package/error.js +6 -6
  83. package/error.js.map +1 -1
  84. package/error.mjs +3 -3
  85. package/error.mjs.map +1 -1
  86. package/index.d.mts +109 -5
  87. package/index.d.ts +109 -5
  88. package/index.d.ts.map +1 -1
  89. package/index.js +103 -11
  90. package/index.js.map +1 -1
  91. package/index.mjs +77 -5
  92. package/index.mjs.map +1 -1
  93. package/package.json +66 -82
  94. package/resource.d.ts +3 -3
  95. package/resource.d.ts.map +1 -1
  96. package/resource.js.map +1 -1
  97. package/resource.mjs.map +1 -1
  98. package/resources/calls.d.ts +2 -3
  99. package/resources/calls.d.ts.map +1 -1
  100. package/resources/calls.js.map +1 -1
  101. package/resources/calls.mjs.map +1 -1
  102. package/resources/index.d.ts.map +1 -1
  103. package/shims/node.d.ts +30 -0
  104. package/shims/node.d.ts.map +1 -0
  105. package/shims/node.js +31 -0
  106. package/shims/node.js.map +1 -0
  107. package/shims/node.mjs +5 -0
  108. package/shims/node.mjs.map +1 -0
  109. package/shims/web.d.ts +26 -0
  110. package/shims/web.d.ts.map +1 -0
  111. package/shims/web.js +31 -0
  112. package/shims/web.js.map +1 -0
  113. package/shims/web.mjs +5 -0
  114. package/shims/web.mjs.map +1 -0
  115. package/src/_shims/MultipartBody.ts +9 -0
  116. package/src/_shims/README.md +46 -0
  117. package/src/_shims/auto/runtime-bun.ts +4 -0
  118. package/src/_shims/auto/runtime-node.ts +4 -0
  119. package/src/_shims/auto/runtime.ts +4 -0
  120. package/src/_shims/auto/types-node.ts +4 -0
  121. package/src/_shims/auto/types.d.ts +101 -0
  122. package/src/_shims/auto/types.js +3 -0
  123. package/src/_shims/auto/types.mjs +3 -0
  124. package/src/_shims/bun-runtime.ts +14 -0
  125. package/src/_shims/index.d.ts +81 -0
  126. package/src/_shims/index.js +13 -0
  127. package/src/_shims/index.mjs +7 -0
  128. package/src/_shims/manual-types.d.ts +12 -0
  129. package/src/_shims/manual-types.js +3 -0
  130. package/src/_shims/manual-types.mjs +3 -0
  131. package/src/_shims/node-runtime.ts +81 -0
  132. package/src/_shims/node-types.d.ts +42 -0
  133. package/src/_shims/node-types.js +3 -0
  134. package/src/_shims/node-types.mjs +3 -0
  135. package/src/_shims/registry.ts +67 -0
  136. package/src/_shims/web-runtime.ts +103 -0
  137. package/src/_shims/web-types.d.ts +83 -0
  138. package/src/_shims/web-types.js +3 -0
  139. package/src/_shims/web-types.mjs +3 -0
  140. package/src/core.ts +1200 -0
  141. package/src/error.ts +3 -3
  142. package/src/index.ts +172 -5
  143. package/src/resource.ts +3 -3
  144. package/src/resources/calls.ts +2 -3
  145. package/src/shims/node.ts +50 -0
  146. package/src/shims/web.ts +50 -0
  147. package/src/tsconfig.json +2 -2
  148. package/src/uploads.ts +255 -1
  149. package/src/version.ts +1 -1
  150. package/uploads.d.ts +74 -1
  151. package/uploads.d.ts.map +1 -1
  152. package/uploads.js +168 -3
  153. package/uploads.js.map +1 -1
  154. package/uploads.mjs +157 -1
  155. package/uploads.mjs.map +1 -1
  156. package/version.d.ts +1 -1
  157. package/version.js +1 -1
  158. package/version.mjs +1 -1
  159. package/api-promise.d.mts +0 -47
  160. package/api-promise.d.mts.map +0 -1
  161. package/api-promise.d.ts +0 -47
  162. package/api-promise.d.ts.map +0 -1
  163. package/api-promise.js +0 -84
  164. package/api-promise.js.map +0 -1
  165. package/api-promise.mjs +0 -80
  166. package/api-promise.mjs.map +0 -1
  167. package/client.d.mts +0 -186
  168. package/client.d.mts.map +0 -1
  169. package/client.d.ts +0 -186
  170. package/client.d.ts.map +0 -1
  171. package/client.js +0 -449
  172. package/client.js.map +0 -1
  173. package/client.mjs +0 -422
  174. package/client.mjs.map +0 -1
  175. package/error.d.mts +0 -47
  176. package/error.d.mts.map +0 -1
  177. package/index.d.mts.map +0 -1
  178. package/internal/builtin-types.d.mts +0 -65
  179. package/internal/builtin-types.d.mts.map +0 -1
  180. package/internal/builtin-types.d.ts +0 -65
  181. package/internal/builtin-types.d.ts.map +0 -1
  182. package/internal/builtin-types.js +0 -4
  183. package/internal/builtin-types.js.map +0 -1
  184. package/internal/builtin-types.mjs +0 -3
  185. package/internal/builtin-types.mjs.map +0 -1
  186. package/internal/detect-platform.d.mts +0 -15
  187. package/internal/detect-platform.d.mts.map +0 -1
  188. package/internal/detect-platform.d.ts +0 -15
  189. package/internal/detect-platform.d.ts.map +0 -1
  190. package/internal/detect-platform.js +0 -162
  191. package/internal/detect-platform.js.map +0 -1
  192. package/internal/detect-platform.mjs +0 -157
  193. package/internal/detect-platform.mjs.map +0 -1
  194. package/internal/errors.d.mts +0 -3
  195. package/internal/errors.d.mts.map +0 -1
  196. package/internal/errors.d.ts +0 -3
  197. package/internal/errors.d.ts.map +0 -1
  198. package/internal/errors.js +0 -26
  199. package/internal/errors.js.map +0 -1
  200. package/internal/errors.mjs +0 -21
  201. package/internal/errors.mjs.map +0 -1
  202. package/internal/headers.d.mts +0 -21
  203. package/internal/headers.d.mts.map +0 -1
  204. package/internal/headers.d.ts +0 -21
  205. package/internal/headers.d.ts.map +0 -1
  206. package/internal/headers.js +0 -77
  207. package/internal/headers.js.map +0 -1
  208. package/internal/headers.mjs +0 -72
  209. package/internal/headers.mjs.map +0 -1
  210. package/internal/parse.d.mts +0 -10
  211. package/internal/parse.d.mts.map +0 -1
  212. package/internal/parse.d.ts +0 -10
  213. package/internal/parse.d.ts.map +0 -1
  214. package/internal/parse.js +0 -28
  215. package/internal/parse.js.map +0 -1
  216. package/internal/parse.mjs +0 -24
  217. package/internal/parse.mjs.map +0 -1
  218. package/internal/polyfill/crypto.node.d.ts +0 -10
  219. package/internal/polyfill/crypto.node.js +0 -11
  220. package/internal/polyfill/crypto.node.mjs +0 -2
  221. package/internal/polyfill/file.node.d.ts +0 -9
  222. package/internal/polyfill/file.node.js +0 -17
  223. package/internal/polyfill/file.node.mjs +0 -9
  224. package/internal/request-options.d.mts +0 -34
  225. package/internal/request-options.d.mts.map +0 -1
  226. package/internal/request-options.d.ts +0 -34
  227. package/internal/request-options.d.ts.map +0 -1
  228. package/internal/request-options.js +0 -39
  229. package/internal/request-options.js.map +0 -1
  230. package/internal/request-options.mjs +0 -34
  231. package/internal/request-options.mjs.map +0 -1
  232. package/internal/shim-types.d.mts +0 -28
  233. package/internal/shim-types.d.ts +0 -28
  234. package/internal/shims.d.mts +0 -61
  235. package/internal/shims.d.mts.map +0 -1
  236. package/internal/shims.d.ts +0 -61
  237. package/internal/shims.d.ts.map +0 -1
  238. package/internal/shims.js +0 -101
  239. package/internal/shims.js.map +0 -1
  240. package/internal/shims.mjs +0 -92
  241. package/internal/shims.mjs.map +0 -1
  242. package/internal/types.d.mts +0 -68
  243. package/internal/types.d.mts.map +0 -1
  244. package/internal/types.d.ts +0 -68
  245. package/internal/types.d.ts.map +0 -1
  246. package/internal/types.js +0 -4
  247. package/internal/types.js.map +0 -1
  248. package/internal/types.mjs +0 -3
  249. package/internal/types.mjs.map +0 -1
  250. package/internal/uploads.d.mts +0 -73
  251. package/internal/uploads.d.mts.map +0 -1
  252. package/internal/uploads.d.ts +0 -73
  253. package/internal/uploads.d.ts.map +0 -1
  254. package/internal/uploads.js +0 -208
  255. package/internal/uploads.js.map +0 -1
  256. package/internal/uploads.mjs +0 -200
  257. package/internal/uploads.mjs.map +0 -1
  258. package/internal/utils/base64.d.mts +0 -3
  259. package/internal/utils/base64.d.mts.map +0 -1
  260. package/internal/utils/base64.d.ts +0 -3
  261. package/internal/utils/base64.d.ts.map +0 -1
  262. package/internal/utils/base64.js +0 -33
  263. package/internal/utils/base64.js.map +0 -1
  264. package/internal/utils/base64.mjs +0 -28
  265. package/internal/utils/base64.mjs.map +0 -1
  266. package/internal/utils/env.d.mts +0 -9
  267. package/internal/utils/env.d.mts.map +0 -1
  268. package/internal/utils/env.d.ts +0 -9
  269. package/internal/utils/env.d.ts.map +0 -1
  270. package/internal/utils/env.js +0 -22
  271. package/internal/utils/env.js.map +0 -1
  272. package/internal/utils/env.mjs +0 -18
  273. package/internal/utils/env.mjs.map +0 -1
  274. package/internal/utils/log.d.mts +0 -4
  275. package/internal/utils/log.d.mts.map +0 -1
  276. package/internal/utils/log.d.ts +0 -4
  277. package/internal/utils/log.d.ts.map +0 -1
  278. package/internal/utils/log.js +0 -47
  279. package/internal/utils/log.js.map +0 -1
  280. package/internal/utils/log.mjs +0 -43
  281. package/internal/utils/log.mjs.map +0 -1
  282. package/internal/utils/sleep.d.mts +0 -2
  283. package/internal/utils/sleep.d.mts.map +0 -1
  284. package/internal/utils/sleep.d.ts +0 -2
  285. package/internal/utils/sleep.d.ts.map +0 -1
  286. package/internal/utils/sleep.js +0 -7
  287. package/internal/utils/sleep.js.map +0 -1
  288. package/internal/utils/sleep.mjs +0 -3
  289. package/internal/utils/sleep.mjs.map +0 -1
  290. package/internal/utils/uuid.d.mts +0 -5
  291. package/internal/utils/uuid.d.mts.map +0 -1
  292. package/internal/utils/uuid.d.ts +0 -5
  293. package/internal/utils/uuid.d.ts.map +0 -1
  294. package/internal/utils/uuid.js +0 -15
  295. package/internal/utils/uuid.js.map +0 -1
  296. package/internal/utils/uuid.mjs +0 -11
  297. package/internal/utils/uuid.mjs.map +0 -1
  298. package/internal/utils/values.d.mts +0 -15
  299. package/internal/utils/values.d.mts.map +0 -1
  300. package/internal/utils/values.d.ts +0 -15
  301. package/internal/utils/values.d.ts.map +0 -1
  302. package/internal/utils/values.js +0 -100
  303. package/internal/utils/values.js.map +0 -1
  304. package/internal/utils/values.mjs +0 -84
  305. package/internal/utils/values.mjs.map +0 -1
  306. package/internal/utils.d.mts +0 -7
  307. package/internal/utils.d.mts.map +0 -1
  308. package/internal/utils.d.ts +0 -7
  309. package/internal/utils.d.ts.map +0 -1
  310. package/internal/utils.js.map +0 -1
  311. package/internal/utils.mjs +0 -8
  312. package/internal/utils.mjs.map +0 -1
  313. package/resource.d.mts +0 -6
  314. package/resource.d.mts.map +0 -1
  315. package/resources/calls.d.mts +0 -85
  316. package/resources/calls.d.mts.map +0 -1
  317. package/resources/index.d.mts +0 -2
  318. package/resources/index.d.mts.map +0 -1
  319. package/src/api-promise.ts +0 -92
  320. package/src/client.ts +0 -646
  321. package/src/internal/builtin-types.ts +0 -79
  322. package/src/internal/detect-platform.ts +0 -196
  323. package/src/internal/errors.ts +0 -22
  324. package/src/internal/headers.ts +0 -96
  325. package/src/internal/parse.ts +0 -41
  326. package/src/internal/polyfill/crypto.node.d.ts +0 -10
  327. package/src/internal/polyfill/crypto.node.js +0 -11
  328. package/src/internal/polyfill/crypto.node.mjs +0 -2
  329. package/src/internal/polyfill/file.node.d.ts +0 -9
  330. package/src/internal/polyfill/file.node.js +0 -17
  331. package/src/internal/polyfill/file.node.mjs +0 -9
  332. package/src/internal/request-options.ts +0 -67
  333. package/src/internal/shim-types.d.ts +0 -28
  334. package/src/internal/shims.ts +0 -145
  335. package/src/internal/types.ts +0 -98
  336. package/src/internal/uploads.ts +0 -307
  337. package/src/internal/utils/base64.ts +0 -37
  338. package/src/internal/utils/env.ts +0 -18
  339. package/src/internal/utils/log.ts +0 -49
  340. package/src/internal/utils/sleep.ts +0 -3
  341. package/src/internal/utils/uuid.ts +0 -13
  342. package/src/internal/utils/values.ts +0 -94
  343. package/src/internal/utils.ts +0 -8
  344. package/uploads.d.mts +0 -2
  345. package/uploads.d.mts.map +0 -1
  346. package/version.d.mts +0 -2
  347. package/version.d.mts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.2 (2025-02-04)
4
+
5
+ Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/roarkhq/sdk-roark-analytics-node/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([#6](https://github.com/roarkhq/sdk-roark-analytics-node/issues/6)) ([d0eb21e](https://github.com/roarkhq/sdk-roark-analytics-node/commit/d0eb21e5116a9ce99f7198ac430eec2ed68cf0ed))
10
+
3
11
  ## 0.1.0-alpha.1 (2025-02-04)
4
12
 
5
13
  Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/roarkhq/sdk-roark-analytics-node/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
package/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2025 Petstore
189
+ Copyright 2025 Roark
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # Petstore TypeScript API Library
1
+ # Roark Node API Library
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/@roarkanalytics/sdk.svg)](https://npmjs.org/package/@roarkanalytics/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@roarkanalytics/sdk)
4
4
 
5
- This library provides convenient access to the Petstore REST API from server-side TypeScript or JavaScript.
5
+ This library provides convenient access to the Roark REST API from server-side TypeScript or JavaScript.
6
6
 
7
- The REST API documentation can be found on [app.stainlessapi.com](https://app.stainlessapi.com/docs). The full API of this library can be found in [api.md](api.md).
7
+ The REST API documentation can be found on [docs.roark.ai](https://docs.roark.ai). The full API of this library can be found in [api.md](api.md).
8
8
 
9
9
  It is generated with [Stainless](https://www.stainlessapi.com/).
10
10
 
@@ -20,14 +20,14 @@ The full API of this library can be found in [api.md](api.md).
20
20
 
21
21
  <!-- prettier-ignore -->
22
22
  ```js
23
- import Petstore from '@roarkanalytics/sdk';
23
+ import Roark from '@roarkanalytics/sdk';
24
24
 
25
- const client = new Petstore({
25
+ const client = new Roark({
26
26
  bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
27
27
  });
28
28
 
29
29
  async function main() {
30
- const call = await client.calls.create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' });
30
+ const call = await client.calls.create({ direction: 'INBOUND', startedAt: '2025-02-04T06:23:19.633Z' });
31
31
 
32
32
  console.log(call.data);
33
33
  }
@@ -41,15 +41,15 @@ This library includes TypeScript definitions for all request params and response
41
41
 
42
42
  <!-- prettier-ignore -->
43
43
  ```ts
44
- import Petstore from '@roarkanalytics/sdk';
44
+ import Roark from '@roarkanalytics/sdk';
45
45
 
46
- const client = new Petstore({
46
+ const client = new Roark({
47
47
  bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
48
48
  });
49
49
 
50
50
  async function main() {
51
- const params: Petstore.CallCreateParams = { direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' };
52
- const call: Petstore.CallCreateResponse = await client.calls.create(params);
51
+ const params: Roark.CallCreateParams = { direction: 'INBOUND', startedAt: '2025-02-04T06:23:19.633Z' };
52
+ const call: Roark.CallCreateResponse = await client.calls.create(params);
53
53
  }
54
54
 
55
55
  main();
@@ -67,9 +67,9 @@ a subclass of `APIError` will be thrown:
67
67
  ```ts
68
68
  async function main() {
69
69
  const call = await client.calls
70
- .create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' })
70
+ .create({ direction: 'INBOUND', startedAt: '2025-02-04T06:23:19.633Z' })
71
71
  .catch(async (err) => {
72
- if (err instanceof Petstore.APIError) {
72
+ if (err instanceof Roark.APIError) {
73
73
  console.log(err.status); // 400
74
74
  console.log(err.name); // BadRequestError
75
75
  console.log(err.headers); // {server: 'nginx', ...}
@@ -106,12 +106,12 @@ You can use the `maxRetries` option to configure or disable this:
106
106
  <!-- prettier-ignore -->
107
107
  ```js
108
108
  // Configure the default for all requests:
109
- const client = new Petstore({
109
+ const client = new Roark({
110
110
  maxRetries: 0, // default is 2
111
111
  });
112
112
 
113
113
  // Or, configure per-request:
114
- await client.calls.create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' }, {
114
+ await client.calls.create({ direction: 'INBOUND', startedAt: '2025-02-04T06:23:19.633Z' }, {
115
115
  maxRetries: 5,
116
116
  });
117
117
  ```
@@ -123,12 +123,12 @@ Requests time out after 1 minute by default. You can configure this with a `time
123
123
  <!-- prettier-ignore -->
124
124
  ```ts
125
125
  // Configure the default for all requests:
126
- const client = new Petstore({
126
+ const client = new Roark({
127
127
  timeout: 20 * 1000, // 20 seconds (default is 1 minute)
128
128
  });
129
129
 
130
130
  // Override per-request:
131
- await client.calls.create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' }, {
131
+ await client.calls.create({ direction: 'INBOUND', startedAt: '2025-02-04T06:23:19.633Z' }, {
132
132
  timeout: 5 * 1000,
133
133
  });
134
134
  ```
@@ -147,16 +147,16 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
147
147
 
148
148
  <!-- prettier-ignore -->
149
149
  ```ts
150
- const client = new Petstore();
150
+ const client = new Roark();
151
151
 
152
152
  const response = await client.calls
153
- .create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' })
153
+ .create({ direction: 'INBOUND', startedAt: '2025-02-04T06:23:19.633Z' })
154
154
  .asResponse();
155
155
  console.log(response.headers.get('X-My-Header'));
156
156
  console.log(response.statusText); // access the underlying Response object
157
157
 
158
158
  const { data: call, response: raw } = await client.calls
159
- .create({ direction: 'INBOUND', startedAt: '2025-02-04T01:48:11.473Z' })
159
+ .create({ direction: 'INBOUND', startedAt: '2025-02-04T06:23:19.633Z' })
160
160
  .withResponse();
161
161
  console.log(raw.headers.get('X-My-Header'));
162
162
  console.log(call.data);
@@ -208,23 +208,21 @@ validate or strip extra properties from the response from the API.
208
208
 
209
209
  ### Customizing the fetch client
210
210
 
211
- By default, this library expects a global `fetch` function is defined.
211
+ By default, this library uses `node-fetch` in Node, and expects a global `fetch` function in other environments.
212
212
 
213
- If you want to use a different `fetch` function, you can either polyfill the global:
213
+ If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment,
214
+ (for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`),
215
+ add the following import before your first import `from "Roark"`:
214
216
 
215
217
  ```ts
216
- import fetch from 'my-fetch';
217
-
218
- globalThis.fetch = fetch;
218
+ // Tell TypeScript and the package to use the global web fetch instead of node-fetch.
219
+ // Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
220
+ import '@roarkanalytics/sdk/shims/web';
221
+ import Roark from '@roarkanalytics/sdk';
219
222
  ```
220
223
 
221
- Or pass it to the client:
222
-
223
- ```ts
224
- import fetch from 'my-fetch';
225
-
226
- const client = new Petstore({ fetch });
227
- ```
224
+ To do the inverse, add `import "@roarkanalytics/sdk/shims/node"` (which does import polyfills).
225
+ This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/roarkhq/sdk-roark-analytics-node/tree/main/src/_shims#readme)).
228
226
 
229
227
  ### Logging and middleware
230
228
 
@@ -233,9 +231,9 @@ which can be used to inspect or alter the `Request` or `Response` before/after e
233
231
 
234
232
  ```ts
235
233
  import { fetch } from 'undici'; // as one example
236
- import Petstore from '@roarkanalytics/sdk';
234
+ import Roark from '@roarkanalytics/sdk';
237
235
 
238
- const client = new Petstore({
236
+ const client = new Roark({
239
237
  fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
240
238
  console.log('About to make a request', url, init);
241
239
  const response = await fetch(url, init);
@@ -245,69 +243,34 @@ const client = new Petstore({
245
243
  });
246
244
  ```
247
245
 
248
- Note that if given a `PETSTORE_LOG=debug` environment variable, this library will log all requests and responses automatically.
246
+ Note that if given a `DEBUG=true` environment variable, this library will log all requests and responses automatically.
249
247
  This is intended for debugging purposes only and may change in the future without notice.
250
248
 
251
- ### Fetch options
252
-
253
- If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
254
-
255
- ```ts
256
- import Petstore from '@roarkanalytics/sdk';
257
-
258
- const client = new Petstore({
259
- fetchOptions: {
260
- // `RequestInit` options
261
- },
262
- });
263
- ```
264
-
265
- #### Configuring proxies
266
-
267
- To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
268
- options to requests:
269
-
270
- <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
249
+ ### Configuring an HTTP(S) Agent (e.g., for proxies)
271
250
 
272
- ```ts
273
- import Petstore from '@roarkanalytics/sdk';
274
- import * as undici from 'undici';
275
-
276
- const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
277
- const client = new Petstore({
278
- fetchOptions: {
279
- dispatcher: proxyAgent,
280
- },
281
- });
282
- ```
251
+ By default, this library uses a stable agent for all http/https requests to reuse TCP connections, eliminating many TCP & TLS handshakes and shaving around 100ms off most requests.
283
252
 
284
- <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
253
+ If you would like to disable or customize this behavior, for example to use the API behind a proxy, you can pass an `httpAgent` which is used for all requests (be they http or https), for example:
285
254
 
255
+ <!-- prettier-ignore -->
286
256
  ```ts
287
- import Petstore from '@roarkanalytics/sdk';
257
+ import http from 'http';
258
+ import { HttpsProxyAgent } from 'https-proxy-agent';
288
259
 
289
- const client = new Petstore({
290
- fetchOptions: {
291
- proxy: 'http://localhost:8888',
292
- },
260
+ // Configure the default for all requests:
261
+ const client = new Roark({
262
+ httpAgent: new HttpsProxyAgent(process.env.PROXY_URL),
293
263
  });
294
- ```
295
-
296
- <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
297
-
298
- ```ts
299
- import Petstore from 'npm:@roarkanalytics/sdk';
300
264
 
301
- const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
302
- const client = new Petstore({
303
- fetchOptions: {
304
- client: httpClient,
265
+ // Override per-request:
266
+ await client.calls.create(
267
+ { direction: 'INBOUND', startedAt: '2025-02-04T06:23:19.633Z' },
268
+ {
269
+ httpAgent: new http.Agent({ keepAlive: false }),
305
270
  },
306
- });
271
+ );
307
272
  ```
308
273
 
309
- ## Frequently Asked Questions
310
-
311
274
  ## Semantic versioning
312
275
 
313
276
  This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
@@ -322,7 +285,7 @@ We are keen for your feedback; please open an [issue](https://www.github.com/roa
322
285
 
323
286
  ## Requirements
324
287
 
325
- TypeScript >= 4.9 is supported.
288
+ TypeScript >= 4.5 is supported.
326
289
 
327
290
  The following runtimes are supported:
328
291
 
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export declare class MultipartBody {
5
+ body: any;
6
+ constructor(body: any);
7
+ get [Symbol.toStringTag](): string;
8
+ }
9
+ //# sourceMappingURL=MultipartBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipartBody.d.ts","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,aAAa;IACL,IAAI,EAAE,GAAG;gBAAT,IAAI,EAAE,GAAG;IAC5B,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;CACF"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultipartBody = void 0;
4
+ /**
5
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
6
+ */
7
+ class MultipartBody {
8
+ constructor(body) {
9
+ this.body = body;
10
+ }
11
+ get [Symbol.toStringTag]() {
12
+ return 'MultipartBody';
13
+ }
14
+ }
15
+ exports.MultipartBody = MultipartBody;
16
+ //# sourceMappingURL=MultipartBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipartBody.js","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,aAAa;IACxB,YAAmB,IAAS;QAAT,SAAI,GAAJ,IAAI,CAAK;IAAG,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AALD,sCAKC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export class MultipartBody {
5
+ constructor(body) {
6
+ this.body = body;
7
+ }
8
+ get [Symbol.toStringTag]() {
9
+ return 'MultipartBody';
10
+ }
11
+ }
12
+ //# sourceMappingURL=MultipartBody.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipartBody.mjs","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,YAAmB,IAAS;QAAT,SAAI,GAAJ,IAAI,CAAK;IAAG,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,46 @@
1
+ # 👋 Wondering what everything in here does?
2
+
3
+ `@roarkanalytics/sdk` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
4
+ edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM).
5
+
6
+ To do this, `@roarkanalytics/sdk` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
7
+
8
+ It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to
9
+ automatically select the correct shims for each environment. However, conditional exports are a fairly new
10
+ feature and not supported everywhere. For instance, the TypeScript `"moduleResolution": "node"`
11
+
12
+ setting doesn't consult the `exports` map, compared to `"moduleResolution": "nodeNext"`, which does.
13
+ Unfortunately that's still the default setting, and it can result in errors like
14
+ getting the wrong raw `Response` type from `.asResponse()`, for example.
15
+
16
+ The user can work around these issues by manually importing one of:
17
+
18
+ - `import '@roarkanalytics/sdk/shims/node'`
19
+ - `import '@roarkanalytics/sdk/shims/web'`
20
+
21
+ All of the code here in `_shims` handles selecting the automatic default shims or manual overrides.
22
+
23
+ ### How it works - Runtime
24
+
25
+ Runtime shims get installed by calling `setShims` exported by `@roarkanalytics/sdk/_shims/registry`.
26
+
27
+ Manually importing `@roarkanalytics/sdk/shims/node` or `@roarkanalytics/sdk/shims/web`, calls `setShims` with the respective runtime shims.
28
+
29
+ All client code imports shims from `@roarkanalytics/sdk/_shims/index`, which:
30
+
31
+ - checks if shims have been set manually
32
+ - if not, calls `setShims` with the shims from `@roarkanalytics/sdk/_shims/auto/runtime`
33
+ - re-exports the installed shims from `@roarkanalytics/sdk/_shims/registry`.
34
+
35
+ `@roarkanalytics/sdk/_shims/auto/runtime` exports web runtime shims.
36
+ If the `node` export condition is set, the export map replaces it with `@roarkanalytics/sdk/_shims/auto/runtime-node`.
37
+
38
+ ### How it works - Type time
39
+
40
+ All client code imports shim types from `@roarkanalytics/sdk/_shims/index`, which selects the manual types from `@roarkanalytics/sdk/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@roarkanalytics/sdk/_shims/auto/types`.
41
+
42
+ `@roarkanalytics/sdk/_shims/manual-types` exports an empty namespace.
43
+ Manually importing `@roarkanalytics/sdk/shims/node` or `@roarkanalytics/sdk/shims/web` merges declarations into this empty namespace, so they get picked up by `@roarkanalytics/sdk/_shims/index`.
44
+
45
+ `@roarkanalytics/sdk/_shims/auto/types` exports web type definitions.
46
+ If the `node` export condition is set, the export map replaces it with `@roarkanalytics/sdk/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export * from "../bun-runtime.js";
5
+ //# sourceMappingURL=runtime-bun.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-bun.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC"}
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
3
  if (k2 === undefined) k2 = k;
5
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -15,10 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
15
  };
17
16
  Object.defineProperty(exports, "__esModule", { value: true });
18
- __exportStar(require("./utils/values.js"), exports);
19
- __exportStar(require("./utils/base64.js"), exports);
20
- __exportStar(require("./utils/env.js"), exports);
21
- __exportStar(require("./utils/log.js"), exports);
22
- __exportStar(require("./utils/uuid.js"), exports);
23
- __exportStar(require("./utils/sleep.js"), exports);
24
- //# sourceMappingURL=utils.js.map
17
+ /**
18
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
+ */
20
+ __exportStar(require("../bun-runtime.js"), exports);
21
+ //# sourceMappingURL=runtime-bun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-bun.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,oDAA+B"}
@@ -0,0 +1,2 @@
1
+ export * from "../bun-runtime.mjs";
2
+ //# sourceMappingURL=runtime-bun.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-bun.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export * from "../node-runtime.js";
5
+ //# sourceMappingURL=runtime-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-node.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
+ */
20
+ __exportStar(require("../node-runtime.js"), exports);
21
+ //# sourceMappingURL=runtime-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-node.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,qDAAgC"}
@@ -0,0 +1,2 @@
1
+ export * from "../node-runtime.mjs";
2
+ //# sourceMappingURL=runtime-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-node.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export * from "../web-runtime.js";
5
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
+ */
20
+ __exportStar(require("../web-runtime.js"), exports);
21
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,oDAA+B"}
@@ -0,0 +1,2 @@
1
+ export * from "../web-runtime.mjs";
2
+ //# sourceMappingURL=runtime.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export * from "../node-types.js";
5
+ //# sourceMappingURL=types-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-node.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,eAAe,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
+ */
20
+ __exportStar(require("../node-types.js"), exports);
21
+ //# sourceMappingURL=types-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-node.js","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,mDAA8B"}
@@ -0,0 +1,2 @@
1
+ export * from "../node-types.mjs";
2
+ //# sourceMappingURL=types-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-node.mjs","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":""}