@tabstack/sdk 1.0.5 → 2.1.0

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 (513) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/LICENSE +1 -1
  3. package/README.md +282 -356
  4. package/api-promise.d.mts +2 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +2 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +2 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +186 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +186 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +467 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +463 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/resource.d.mts +6 -0
  37. package/core/resource.d.mts.map +1 -0
  38. package/core/resource.d.ts +6 -0
  39. package/core/resource.d.ts.map +1 -0
  40. package/core/resource.js +11 -0
  41. package/core/resource.js.map +1 -0
  42. package/core/resource.mjs +7 -0
  43. package/core/resource.mjs.map +1 -0
  44. package/core/streaming.d.mts +33 -0
  45. package/core/streaming.d.mts.map +1 -0
  46. package/core/streaming.d.ts +33 -0
  47. package/core/streaming.d.ts.map +1 -0
  48. package/core/streaming.js +263 -0
  49. package/core/streaming.js.map +1 -0
  50. package/core/streaming.mjs +258 -0
  51. package/core/streaming.mjs.map +1 -0
  52. package/core/uploads.d.mts +3 -0
  53. package/core/uploads.d.mts.map +1 -0
  54. package/core/uploads.d.ts +3 -0
  55. package/core/uploads.d.ts.map +1 -0
  56. package/core/uploads.js +6 -0
  57. package/core/uploads.js.map +1 -0
  58. package/core/uploads.mjs +2 -0
  59. package/core/uploads.mjs.map +1 -0
  60. package/error.d.mts +2 -0
  61. package/error.d.mts.map +1 -0
  62. package/error.d.ts +2 -0
  63. package/error.d.ts.map +1 -0
  64. package/error.js +6 -0
  65. package/error.js.map +1 -0
  66. package/error.mjs +2 -0
  67. package/error.mjs.map +1 -0
  68. package/index.d.mts +6 -0
  69. package/index.d.mts.map +1 -0
  70. package/index.d.ts +6 -0
  71. package/index.d.ts.map +1 -0
  72. package/index.js +30 -0
  73. package/index.js.map +1 -0
  74. package/index.mjs +7 -0
  75. package/index.mjs.map +1 -0
  76. package/internal/builtin-types.d.mts +73 -0
  77. package/internal/builtin-types.d.mts.map +1 -0
  78. package/internal/builtin-types.d.ts +73 -0
  79. package/internal/builtin-types.d.ts.map +1 -0
  80. package/internal/builtin-types.js +4 -0
  81. package/internal/builtin-types.js.map +1 -0
  82. package/internal/builtin-types.mjs +3 -0
  83. package/internal/builtin-types.mjs.map +1 -0
  84. package/internal/decoders/line.d.mts +17 -0
  85. package/internal/decoders/line.d.mts.map +1 -0
  86. package/internal/decoders/line.d.ts +17 -0
  87. package/internal/decoders/line.d.ts.map +1 -0
  88. package/internal/decoders/line.js +113 -0
  89. package/internal/decoders/line.js.map +1 -0
  90. package/internal/decoders/line.mjs +108 -0
  91. package/internal/decoders/line.mjs.map +1 -0
  92. package/internal/detect-platform.d.mts +15 -0
  93. package/internal/detect-platform.d.mts.map +1 -0
  94. package/internal/detect-platform.d.ts +15 -0
  95. package/internal/detect-platform.d.ts.map +1 -0
  96. package/internal/detect-platform.js +162 -0
  97. package/internal/detect-platform.js.map +1 -0
  98. package/internal/detect-platform.mjs +157 -0
  99. package/internal/detect-platform.mjs.map +1 -0
  100. package/internal/errors.d.mts +3 -0
  101. package/internal/errors.d.mts.map +1 -0
  102. package/internal/errors.d.ts +3 -0
  103. package/internal/errors.d.ts.map +1 -0
  104. package/internal/errors.js +41 -0
  105. package/internal/errors.js.map +1 -0
  106. package/internal/errors.mjs +36 -0
  107. package/internal/errors.mjs.map +1 -0
  108. package/internal/headers.d.mts +20 -0
  109. package/internal/headers.d.mts.map +1 -0
  110. package/internal/headers.d.ts +20 -0
  111. package/internal/headers.d.ts.map +1 -0
  112. package/internal/headers.js +79 -0
  113. package/internal/headers.js.map +1 -0
  114. package/internal/headers.mjs +74 -0
  115. package/internal/headers.mjs.map +1 -0
  116. package/internal/parse.d.mts +12 -0
  117. package/internal/parse.d.mts.map +1 -0
  118. package/internal/parse.d.ts +12 -0
  119. package/internal/parse.d.ts.map +1 -0
  120. package/internal/parse.js +45 -0
  121. package/internal/parse.js.map +1 -0
  122. package/internal/parse.mjs +42 -0
  123. package/internal/parse.mjs.map +1 -0
  124. package/internal/request-options.d.mts +77 -0
  125. package/internal/request-options.d.mts.map +1 -0
  126. package/internal/request-options.d.ts +77 -0
  127. package/internal/request-options.d.ts.map +1 -0
  128. package/internal/request-options.js +14 -0
  129. package/internal/request-options.js.map +1 -0
  130. package/internal/request-options.mjs +10 -0
  131. package/internal/request-options.mjs.map +1 -0
  132. package/internal/shim-types.d.mts +17 -0
  133. package/internal/shim-types.d.mts.map +1 -0
  134. package/internal/shim-types.d.ts +17 -0
  135. package/internal/shim-types.d.ts.map +1 -0
  136. package/internal/shim-types.js +4 -0
  137. package/internal/shim-types.js.map +1 -0
  138. package/internal/shim-types.mjs +3 -0
  139. package/internal/shim-types.mjs.map +1 -0
  140. package/internal/shims.d.mts +20 -0
  141. package/internal/shims.d.mts.map +1 -0
  142. package/internal/shims.d.ts +20 -0
  143. package/internal/shims.d.ts.map +1 -0
  144. package/internal/shims.js +92 -0
  145. package/internal/shims.js.map +1 -0
  146. package/internal/shims.mjs +85 -0
  147. package/internal/shims.mjs.map +1 -0
  148. package/internal/to-file.d.mts +45 -0
  149. package/internal/to-file.d.mts.map +1 -0
  150. package/internal/to-file.d.ts +45 -0
  151. package/internal/to-file.d.ts.map +1 -0
  152. package/internal/to-file.js +91 -0
  153. package/internal/to-file.js.map +1 -0
  154. package/internal/to-file.mjs +88 -0
  155. package/internal/to-file.mjs.map +1 -0
  156. package/internal/tslib.js +81 -0
  157. package/internal/tslib.mjs +17 -0
  158. package/internal/types.d.mts +69 -0
  159. package/internal/types.d.mts.map +1 -0
  160. package/internal/types.d.ts +69 -0
  161. package/internal/types.d.ts.map +1 -0
  162. package/internal/types.js +4 -0
  163. package/internal/types.js.map +1 -0
  164. package/internal/types.mjs +3 -0
  165. package/internal/types.mjs.map +1 -0
  166. package/internal/uploads.d.mts +42 -0
  167. package/internal/uploads.d.mts.map +1 -0
  168. package/internal/uploads.d.ts +42 -0
  169. package/internal/uploads.d.ts.map +1 -0
  170. package/internal/uploads.js +141 -0
  171. package/internal/uploads.js.map +1 -0
  172. package/internal/uploads.mjs +131 -0
  173. package/internal/uploads.mjs.map +1 -0
  174. package/internal/utils/base64.d.mts +3 -0
  175. package/internal/utils/base64.d.mts.map +1 -0
  176. package/internal/utils/base64.d.ts +3 -0
  177. package/internal/utils/base64.d.ts.map +1 -0
  178. package/internal/utils/base64.js +38 -0
  179. package/internal/utils/base64.js.map +1 -0
  180. package/internal/utils/base64.mjs +33 -0
  181. package/internal/utils/base64.mjs.map +1 -0
  182. package/internal/utils/bytes.d.mts +4 -0
  183. package/internal/utils/bytes.d.mts.map +1 -0
  184. package/internal/utils/bytes.d.ts +4 -0
  185. package/internal/utils/bytes.d.ts.map +1 -0
  186. package/internal/utils/bytes.js +31 -0
  187. package/internal/utils/bytes.js.map +1 -0
  188. package/internal/utils/bytes.mjs +26 -0
  189. package/internal/utils/bytes.mjs.map +1 -0
  190. package/internal/utils/env.d.mts +9 -0
  191. package/internal/utils/env.d.mts.map +1 -0
  192. package/internal/utils/env.d.ts +9 -0
  193. package/internal/utils/env.d.ts.map +1 -0
  194. package/internal/utils/env.js +22 -0
  195. package/internal/utils/env.js.map +1 -0
  196. package/internal/utils/env.mjs +18 -0
  197. package/internal/utils/env.mjs.map +1 -0
  198. package/internal/utils/log.d.mts +37 -0
  199. package/internal/utils/log.d.mts.map +1 -0
  200. package/internal/utils/log.d.ts +37 -0
  201. package/internal/utils/log.d.ts.map +1 -0
  202. package/internal/utils/log.js +85 -0
  203. package/internal/utils/log.js.map +1 -0
  204. package/internal/utils/log.mjs +79 -0
  205. package/internal/utils/log.mjs.map +1 -0
  206. package/internal/utils/path.d.mts +15 -0
  207. package/internal/utils/path.d.mts.map +1 -0
  208. package/internal/utils/path.d.ts +15 -0
  209. package/internal/utils/path.d.ts.map +1 -0
  210. package/internal/utils/path.js +79 -0
  211. package/internal/utils/path.js.map +1 -0
  212. package/internal/utils/path.mjs +74 -0
  213. package/internal/utils/path.mjs.map +1 -0
  214. package/internal/utils/sleep.d.mts +2 -0
  215. package/internal/utils/sleep.d.mts.map +1 -0
  216. package/internal/utils/sleep.d.ts +2 -0
  217. package/internal/utils/sleep.d.ts.map +1 -0
  218. package/internal/utils/sleep.js +7 -0
  219. package/internal/utils/sleep.js.map +1 -0
  220. package/internal/utils/sleep.mjs +3 -0
  221. package/internal/utils/sleep.mjs.map +1 -0
  222. package/internal/utils/uuid.d.mts +5 -0
  223. package/internal/utils/uuid.d.mts.map +1 -0
  224. package/internal/utils/uuid.d.ts +5 -0
  225. package/internal/utils/uuid.d.ts.map +1 -0
  226. package/internal/utils/uuid.js +19 -0
  227. package/internal/utils/uuid.js.map +1 -0
  228. package/internal/utils/uuid.mjs +15 -0
  229. package/internal/utils/uuid.mjs.map +1 -0
  230. package/internal/utils/values.d.mts +18 -0
  231. package/internal/utils/values.d.mts.map +1 -0
  232. package/internal/utils/values.d.ts +18 -0
  233. package/internal/utils/values.d.ts.map +1 -0
  234. package/internal/utils/values.js +112 -0
  235. package/internal/utils/values.js.map +1 -0
  236. package/internal/utils/values.mjs +94 -0
  237. package/internal/utils/values.mjs.map +1 -0
  238. package/internal/utils.d.mts +7 -0
  239. package/internal/utils.d.mts.map +1 -0
  240. package/internal/utils.d.ts +7 -0
  241. package/internal/utils.d.ts.map +1 -0
  242. package/internal/utils.js +11 -0
  243. package/internal/utils.js.map +1 -0
  244. package/internal/utils.mjs +8 -0
  245. package/internal/utils.mjs.map +1 -0
  246. package/package.json +139 -82
  247. package/resource.d.mts +2 -0
  248. package/resource.d.mts.map +1 -0
  249. package/resource.d.ts +2 -0
  250. package/resource.d.ts.map +1 -0
  251. package/resource.js +6 -0
  252. package/resource.js.map +1 -0
  253. package/resource.mjs +2 -0
  254. package/resource.mjs.map +1 -0
  255. package/resources/agent.d.mts +154 -0
  256. package/resources/agent.d.mts.map +1 -0
  257. package/resources/agent.d.ts +154 -0
  258. package/resources/agent.d.ts.map +1 -0
  259. package/resources/agent.js +88 -0
  260. package/resources/agent.js.map +1 -0
  261. package/resources/agent.mjs +84 -0
  262. package/resources/agent.mjs.map +1 -0
  263. package/resources/extract.d.mts +207 -0
  264. package/resources/extract.d.mts.map +1 -0
  265. package/resources/extract.d.ts +207 -0
  266. package/resources/extract.d.ts.map +1 -0
  267. package/resources/extract.js +61 -0
  268. package/resources/extract.js.map +1 -0
  269. package/resources/extract.mjs +57 -0
  270. package/resources/extract.mjs.map +1 -0
  271. package/resources/generate.d.mts +79 -0
  272. package/resources/generate.d.mts.map +1 -0
  273. package/resources/generate.d.ts +79 -0
  274. package/resources/generate.d.ts.map +1 -0
  275. package/resources/generate.js +44 -0
  276. package/resources/generate.js.map +1 -0
  277. package/resources/generate.mjs +40 -0
  278. package/resources/generate.mjs.map +1 -0
  279. package/resources/index.d.mts +4 -0
  280. package/resources/index.d.mts.map +1 -0
  281. package/resources/index.d.ts +4 -0
  282. package/resources/index.d.ts.map +1 -0
  283. package/resources/index.js +11 -0
  284. package/resources/index.js.map +1 -0
  285. package/resources/index.mjs +5 -0
  286. package/resources/index.mjs.map +1 -0
  287. package/resources.d.mts +2 -0
  288. package/resources.d.mts.map +1 -0
  289. package/resources.d.ts +2 -0
  290. package/resources.d.ts.map +1 -0
  291. package/resources.js +5 -0
  292. package/resources.js.map +1 -0
  293. package/resources.mjs +2 -0
  294. package/resources.mjs.map +1 -0
  295. package/src/api-promise.ts +2 -0
  296. package/src/client.ts +764 -0
  297. package/src/core/README.md +3 -0
  298. package/src/core/api-promise.ts +92 -0
  299. package/src/core/error.ts +130 -0
  300. package/src/core/resource.ts +11 -0
  301. package/src/core/streaming.ts +315 -0
  302. package/src/core/uploads.ts +2 -0
  303. package/src/error.ts +2 -0
  304. package/src/index.ts +22 -0
  305. package/src/internal/README.md +3 -0
  306. package/src/internal/builtin-types.ts +93 -0
  307. package/src/internal/decoders/line.ts +135 -0
  308. package/src/internal/detect-platform.ts +196 -0
  309. package/src/internal/errors.ts +33 -0
  310. package/src/internal/headers.ts +97 -0
  311. package/src/internal/parse.ts +64 -0
  312. package/src/internal/request-options.ts +93 -0
  313. package/src/internal/shim-types.ts +26 -0
  314. package/src/internal/shims.ts +107 -0
  315. package/src/internal/to-file.ts +154 -0
  316. package/src/internal/types.ts +95 -0
  317. package/src/internal/uploads.ts +187 -0
  318. package/src/internal/utils/base64.ts +40 -0
  319. package/src/internal/utils/bytes.ts +32 -0
  320. package/src/internal/utils/env.ts +18 -0
  321. package/src/internal/utils/log.ts +126 -0
  322. package/src/internal/utils/path.ts +88 -0
  323. package/src/internal/utils/sleep.ts +3 -0
  324. package/src/internal/utils/uuid.ts +17 -0
  325. package/src/internal/utils/values.ts +105 -0
  326. package/src/internal/utils.ts +8 -0
  327. package/src/lib/.keep +4 -0
  328. package/src/resource.ts +2 -0
  329. package/src/resources/agent.ts +194 -0
  330. package/src/resources/extract.ts +248 -0
  331. package/src/resources/generate.ts +89 -0
  332. package/src/resources/index.ts +17 -0
  333. package/src/resources.ts +1 -0
  334. package/src/streaming.ts +2 -0
  335. package/src/tsconfig.json +11 -0
  336. package/src/uploads.ts +2 -0
  337. package/src/version.ts +1 -0
  338. package/streaming.d.mts +2 -0
  339. package/streaming.d.mts.map +1 -0
  340. package/streaming.d.ts +2 -0
  341. package/streaming.d.ts.map +1 -0
  342. package/streaming.js +6 -0
  343. package/streaming.js.map +1 -0
  344. package/streaming.mjs +2 -0
  345. package/streaming.mjs.map +1 -0
  346. package/uploads.d.mts +2 -0
  347. package/uploads.d.mts.map +1 -0
  348. package/uploads.d.ts +2 -0
  349. package/uploads.d.ts.map +1 -0
  350. package/uploads.js +6 -0
  351. package/uploads.js.map +1 -0
  352. package/uploads.mjs +2 -0
  353. package/uploads.mjs.map +1 -0
  354. package/version.d.mts +2 -0
  355. package/version.d.mts.map +1 -0
  356. package/version.d.ts +2 -0
  357. package/version.d.ts.map +1 -0
  358. package/version.js +5 -0
  359. package/version.js.map +1 -0
  360. package/version.mjs +2 -0
  361. package/version.mjs.map +1 -0
  362. package/dist/cjs/agent.d.ts +0 -156
  363. package/dist/cjs/agent.d.ts.map +0 -1
  364. package/dist/cjs/agent.js +0 -211
  365. package/dist/cjs/agent.js.map +0 -1
  366. package/dist/cjs/agent.test.d.ts +0 -5
  367. package/dist/cjs/agent.test.d.ts.map +0 -1
  368. package/dist/cjs/agent.test.js +0 -441
  369. package/dist/cjs/agent.test.js.map +0 -1
  370. package/dist/cjs/client.d.ts +0 -58
  371. package/dist/cjs/client.d.ts.map +0 -1
  372. package/dist/cjs/client.js +0 -58
  373. package/dist/cjs/client.js.map +0 -1
  374. package/dist/cjs/client.test.d.ts +0 -5
  375. package/dist/cjs/client.test.d.ts.map +0 -1
  376. package/dist/cjs/client.test.js +0 -255
  377. package/dist/cjs/client.test.js.map +0 -1
  378. package/dist/cjs/exceptions.d.ts +0 -57
  379. package/dist/cjs/exceptions.d.ts.map +0 -1
  380. package/dist/cjs/exceptions.js +0 -95
  381. package/dist/cjs/exceptions.js.map +0 -1
  382. package/dist/cjs/exceptions.test.d.ts +0 -5
  383. package/dist/cjs/exceptions.test.d.ts.map +0 -1
  384. package/dist/cjs/exceptions.test.js +0 -239
  385. package/dist/cjs/exceptions.test.js.map +0 -1
  386. package/dist/cjs/extract.d.ts +0 -151
  387. package/dist/cjs/extract.d.ts.map +0 -1
  388. package/dist/cjs/extract.js +0 -165
  389. package/dist/cjs/extract.js.map +0 -1
  390. package/dist/cjs/extract.test.d.ts +0 -5
  391. package/dist/cjs/extract.test.d.ts.map +0 -1
  392. package/dist/cjs/extract.test.js +0 -250
  393. package/dist/cjs/extract.test.js.map +0 -1
  394. package/dist/cjs/generate.d.ts +0 -113
  395. package/dist/cjs/generate.d.ts.map +0 -1
  396. package/dist/cjs/generate.js +0 -124
  397. package/dist/cjs/generate.js.map +0 -1
  398. package/dist/cjs/generate.test.d.ts +0 -5
  399. package/dist/cjs/generate.test.d.ts.map +0 -1
  400. package/dist/cjs/generate.test.js +0 -314
  401. package/dist/cjs/generate.test.js.map +0 -1
  402. package/dist/cjs/index.d.ts +0 -52
  403. package/dist/cjs/index.d.ts.map +0 -1
  404. package/dist/cjs/index.js +0 -72
  405. package/dist/cjs/index.js.map +0 -1
  406. package/dist/cjs/package.json +0 -3
  407. package/dist/cjs/types.d.ts +0 -73
  408. package/dist/cjs/types.d.ts.map +0 -1
  409. package/dist/cjs/types.js +0 -118
  410. package/dist/cjs/types.js.map +0 -1
  411. package/dist/cjs/types.test.d.ts +0 -5
  412. package/dist/cjs/types.test.d.ts.map +0 -1
  413. package/dist/cjs/types.test.js +0 -370
  414. package/dist/cjs/types.test.js.map +0 -1
  415. package/dist/cjs/util/http.d.ts +0 -29
  416. package/dist/cjs/util/http.d.ts.map +0 -1
  417. package/dist/cjs/util/http.js +0 -201
  418. package/dist/cjs/util/http.js.map +0 -1
  419. package/dist/cjs/util/http.test.d.ts +0 -5
  420. package/dist/cjs/util/http.test.d.ts.map +0 -1
  421. package/dist/cjs/util/http.test.js +0 -237
  422. package/dist/cjs/util/http.test.js.map +0 -1
  423. package/dist/esm/agent.d.ts +0 -156
  424. package/dist/esm/agent.d.ts.map +0 -1
  425. package/dist/esm/agent.js +0 -207
  426. package/dist/esm/agent.js.map +0 -1
  427. package/dist/esm/agent.test.d.ts +0 -5
  428. package/dist/esm/agent.test.d.ts.map +0 -1
  429. package/dist/esm/agent.test.js +0 -439
  430. package/dist/esm/agent.test.js.map +0 -1
  431. package/dist/esm/client.d.ts +0 -58
  432. package/dist/esm/client.d.ts.map +0 -1
  433. package/dist/esm/client.js +0 -54
  434. package/dist/esm/client.js.map +0 -1
  435. package/dist/esm/client.test.d.ts +0 -5
  436. package/dist/esm/client.test.d.ts.map +0 -1
  437. package/dist/esm/client.test.js +0 -253
  438. package/dist/esm/client.test.js.map +0 -1
  439. package/dist/esm/exceptions.d.ts +0 -57
  440. package/dist/esm/exceptions.d.ts.map +0 -1
  441. package/dist/esm/exceptions.js +0 -85
  442. package/dist/esm/exceptions.js.map +0 -1
  443. package/dist/esm/exceptions.test.d.ts +0 -5
  444. package/dist/esm/exceptions.test.d.ts.map +0 -1
  445. package/dist/esm/exceptions.test.js +0 -237
  446. package/dist/esm/exceptions.test.js.map +0 -1
  447. package/dist/esm/extract.d.ts +0 -151
  448. package/dist/esm/extract.d.ts.map +0 -1
  449. package/dist/esm/extract.js +0 -161
  450. package/dist/esm/extract.js.map +0 -1
  451. package/dist/esm/extract.test.d.ts +0 -5
  452. package/dist/esm/extract.test.d.ts.map +0 -1
  453. package/dist/esm/extract.test.js +0 -248
  454. package/dist/esm/extract.test.js.map +0 -1
  455. package/dist/esm/generate.d.ts +0 -113
  456. package/dist/esm/generate.d.ts.map +0 -1
  457. package/dist/esm/generate.js +0 -120
  458. package/dist/esm/generate.js.map +0 -1
  459. package/dist/esm/generate.test.d.ts +0 -5
  460. package/dist/esm/generate.test.d.ts.map +0 -1
  461. package/dist/esm/generate.test.js +0 -312
  462. package/dist/esm/generate.test.js.map +0 -1
  463. package/dist/esm/index.d.ts +0 -52
  464. package/dist/esm/index.d.ts.map +0 -1
  465. package/dist/esm/index.js +0 -53
  466. package/dist/esm/index.js.map +0 -1
  467. package/dist/esm/package.json +0 -3
  468. package/dist/esm/types.d.ts +0 -73
  469. package/dist/esm/types.d.ts.map +0 -1
  470. package/dist/esm/types.js +0 -110
  471. package/dist/esm/types.js.map +0 -1
  472. package/dist/esm/types.test.d.ts +0 -5
  473. package/dist/esm/types.test.d.ts.map +0 -1
  474. package/dist/esm/types.test.js +0 -368
  475. package/dist/esm/types.test.js.map +0 -1
  476. package/dist/esm/util/http.d.ts +0 -29
  477. package/dist/esm/util/http.d.ts.map +0 -1
  478. package/dist/esm/util/http.js +0 -164
  479. package/dist/esm/util/http.js.map +0 -1
  480. package/dist/esm/util/http.test.d.ts +0 -5
  481. package/dist/esm/util/http.test.d.ts.map +0 -1
  482. package/dist/esm/util/http.test.js +0 -232
  483. package/dist/esm/util/http.test.js.map +0 -1
  484. package/dist/types/agent.d.ts +0 -156
  485. package/dist/types/agent.d.ts.map +0 -1
  486. package/dist/types/agent.test.d.ts +0 -5
  487. package/dist/types/agent.test.d.ts.map +0 -1
  488. package/dist/types/client.d.ts +0 -58
  489. package/dist/types/client.d.ts.map +0 -1
  490. package/dist/types/client.test.d.ts +0 -5
  491. package/dist/types/client.test.d.ts.map +0 -1
  492. package/dist/types/exceptions.d.ts +0 -57
  493. package/dist/types/exceptions.d.ts.map +0 -1
  494. package/dist/types/exceptions.test.d.ts +0 -5
  495. package/dist/types/exceptions.test.d.ts.map +0 -1
  496. package/dist/types/extract.d.ts +0 -151
  497. package/dist/types/extract.d.ts.map +0 -1
  498. package/dist/types/extract.test.d.ts +0 -5
  499. package/dist/types/extract.test.d.ts.map +0 -1
  500. package/dist/types/generate.d.ts +0 -113
  501. package/dist/types/generate.d.ts.map +0 -1
  502. package/dist/types/generate.test.d.ts +0 -5
  503. package/dist/types/generate.test.d.ts.map +0 -1
  504. package/dist/types/index.d.ts +0 -52
  505. package/dist/types/index.d.ts.map +0 -1
  506. package/dist/types/types.d.ts +0 -73
  507. package/dist/types/types.d.ts.map +0 -1
  508. package/dist/types/types.test.d.ts +0 -5
  509. package/dist/types/types.test.d.ts.map +0 -1
  510. package/dist/types/util/http.d.ts +0 -29
  511. package/dist/types/util/http.d.ts.map +0 -1
  512. package/dist/types/util/http.test.d.ts +0 -5
  513. package/dist/types/util/http.test.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,458 +1,384 @@
1
- # Tabstack TypeScript SDK
1
+ # Tabstack TypeScript API Library
2
2
 
3
- > [!WARNING]
4
- > **Early Release**: This SDK is in early development. The API may change in future releases as we refine and improve the library based on user feedback.
3
+ [![NPM version](<https://img.shields.io/npm/v/@tabstack/sdk.svg?label=npm%20(stable)>)](https://npmjs.org/package/@tabstack/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@tabstack/sdk)
5
4
 
6
- TypeScript/JavaScript SDK for [Tabstack](https://tabstack.ai) - Extract, Generate, and Automate web content with AI.
5
+ This library provides convenient access to the Tabstack REST API from server-side TypeScript or JavaScript.
7
6
 
8
- ## Features
7
+ The full API of this library can be found in [api.md](api.md).
9
8
 
10
- - **Extract**: Convert web pages to Markdown and extract structured JSON data
11
- - **Generate**: Transform web content using AI with custom instructions
12
- - **Agent**: Execute complex browser automation tasks with natural language
13
- - **Type-Safe**: Full TypeScript support with comprehensive type definitions
14
- - **Zero Dependencies**: Uses only Node.js standard library
15
- - **Universal Module Support**: Works with CommonJS, ESM, and all TypeScript configurations
9
+ It is generated with [Stainless](https://www.stainless.com/).
16
10
 
17
- ## Installation
11
+ ## MCP Server
12
+
13
+ Use the Tabstack MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
14
+
15
+ [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=tabstack-mcp&config=eyJuYW1lIjoidGFic3RhY2stbWNwIiwidHJhbnNwb3J0IjoiaHR0cCIsInVybCI6Imh0dHBzOi8vdGFic3RhY2suc3RsbWNwLmNvbSIsImhlYWRlcnMiOnsieC10YWJzdGFjay1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)
16
+ [![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22tabstack-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Ftabstack.stlmcp.com%22%2C%22headers%22%3A%7B%22x-tabstack-api-key%22%3A%22My%20API%20Key%22%7D%7D)
18
17
 
19
- Install the SDK using your preferred package manager:
18
+ > Note: You may need to set environment variables in your MCP client.
20
19
 
21
- ### npm
22
- ```bash
20
+ ## Installation
21
+
22
+ ```sh
23
23
  npm install @tabstack/sdk
24
24
  ```
25
25
 
26
- ### Yarn
27
- ```bash
28
- yarn add @tabstack/sdk
29
- ```
26
+ ## Usage
30
27
 
31
- ### pnpm
32
- ```bash
33
- pnpm add @tabstack/sdk
34
- ```
28
+ The full API of this library can be found in [api.md](api.md).
35
29
 
36
- ### Bun
37
- ```bash
38
- bun add @tabstack/sdk
39
- ```
30
+ <!-- prettier-ignore -->
31
+ ```js
32
+ import Tabstack from '@tabstack/sdk';
40
33
 
41
- ### From Source
34
+ const client = new Tabstack({
35
+ apiKey: process.env['TABSTACK_API_KEY'], // This is the default and can be omitted
36
+ });
42
37
 
43
- Clone and build the SDK locally:
38
+ const automateEvent = await client.agent.automate({
39
+ task: 'Find the top 3 trending repositories and extract their names, descriptions, and star counts',
40
+ });
44
41
 
45
- ```bash
46
- git clone https://github.com/tabstack/tabs-typescript.git
47
- cd tabs-typescript
48
- npm install
49
- npm run build
42
+ console.log(automateEvent.data);
50
43
  ```
51
44
 
52
- To use the local build in your project:
45
+ ### Request & Response types
46
+
47
+ This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
53
48
 
54
- ```bash
55
- # Link the package globally
56
- npm link
49
+ <!-- prettier-ignore -->
50
+ ```ts
51
+ import Tabstack from '@tabstack/sdk';
57
52
 
58
- # In your project directory
59
- npm link @tabstack/sdk
53
+ const client = new Tabstack({
54
+ apiKey: process.env['TABSTACK_API_KEY'], // This is the default and can be omitted
55
+ });
56
+
57
+ const params: Tabstack.AgentAutomateParams = {
58
+ task: 'Find the top 3 trending repositories and extract their names, descriptions, and star counts',
59
+ };
60
+ const automateEvent: Tabstack.AutomateEvent = await client.agent.automate(params);
60
61
  ```
61
62
 
62
- Or install directly from the local path:
63
+ Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
64
+
65
+ ## Handling errors
66
+
67
+ When the library is unable to connect to the API,
68
+ or if the API returns a non-success status code (i.e., 4xx or 5xx response),
69
+ a subclass of `APIError` will be thrown:
63
70
 
64
- ```bash
65
- npm install /path/to/tabs-typescript
71
+ <!-- prettier-ignore -->
72
+ ```ts
73
+ const automateEvent = await client.agent
74
+ .automate({
75
+ task: 'Find the top 3 trending repositories and extract their names, descriptions, and star counts',
76
+ })
77
+ .catch(async (err) => {
78
+ if (err instanceof Tabstack.APIError) {
79
+ console.log(err.status); // 400
80
+ console.log(err.name); // BadRequestError
81
+ console.log(err.headers); // {server: 'nginx', ...}
82
+ } else {
83
+ throw err;
84
+ }
85
+ });
66
86
  ```
67
87
 
68
- ## Quick Start
88
+ Error codes are as follows:
69
89
 
70
- ### Get Your API Key
90
+ | Status Code | Error Type |
91
+ | ----------- | -------------------------- |
92
+ | 400 | `BadRequestError` |
93
+ | 401 | `AuthenticationError` |
94
+ | 403 | `PermissionDeniedError` |
95
+ | 404 | `NotFoundError` |
96
+ | 422 | `UnprocessableEntityError` |
97
+ | 429 | `RateLimitError` |
98
+ | >=500 | `InternalServerError` |
99
+ | N/A | `APIConnectionError` |
71
100
 
72
- Sign up at [tabstack.ai](https://tabstack.ai) to get your API key.
101
+ ### Retries
73
102
 
74
- ### Basic Usage
103
+ Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
104
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
105
+ 429 Rate Limit, and >=500 Internal errors will all be retried by default.
75
106
 
76
- #### ES Modules (ESM)
77
- ```typescript
78
- import { Tabstack } from '@tabstack/sdk';
107
+ You can use the `maxRetries` option to configure or disable this:
79
108
 
80
- const tabs = new Tabstack({
81
- apiKey: process.env.TABSTACK_API_KEY!
109
+ <!-- prettier-ignore -->
110
+ ```js
111
+ // Configure the default for all requests:
112
+ const client = new Tabstack({
113
+ maxRetries: 0, // default is 2
82
114
  });
83
115
 
84
- // Extract markdown from a URL
85
- const markdown = await tabs.extract.markdown('https://example.com');
86
- console.log(markdown.content);
87
-
88
- // Extract structured data with JSON schema
89
- const schema = {
90
- type: 'object',
91
- properties: {
92
- stories: {
93
- type: 'array',
94
- items: {
95
- type: 'object',
96
- properties: {
97
- title: { type: 'string' },
98
- points: { type: 'number' },
99
- author: { type: 'string' }
100
- },
101
- required: ['title', 'points', 'author']
102
- }
103
- }
104
- },
105
- required: ['stories']
106
- };
107
-
108
- const data = await tabs.extract.json('https://news.ycombinator.com', schema);
109
- console.log(data.data);
116
+ // Or, configure per-request:
117
+ await client.agent.automate({ task: 'Find the top 3 trending repositories and extract their names, descriptions, and star counts' }, {
118
+ maxRetries: 5,
119
+ });
110
120
  ```
111
121
 
112
- #### CommonJS
113
- ```javascript
114
- const { Tabstack } = require('@tabstack/sdk');
122
+ ### Timeouts
115
123
 
116
- const tabs = new Tabstack({
117
- apiKey: process.env.TABSTACK_API_KEY
124
+ Requests time out after 1 minute by default. You can configure this with a `timeout` option:
125
+
126
+ <!-- prettier-ignore -->
127
+ ```ts
128
+ // Configure the default for all requests:
129
+ const client = new Tabstack({
130
+ timeout: 20 * 1000, // 20 seconds (default is 1 minute)
118
131
  });
119
132
 
120
- // Extract markdown
121
- tabs.extract.markdown('https://example.com')
122
- .then(result => {
123
- console.log(result.content);
124
- })
125
- .catch(error => {
126
- console.error('Error:', error.message);
127
- });
133
+ // Override per-request:
134
+ await client.agent.automate({ task: 'Find the top 3 trending repositories and extract their names, descriptions, and star counts' }, {
135
+ timeout: 5 * 1000,
136
+ });
128
137
  ```
129
138
 
130
- ## Core Features
139
+ On timeout, an `APIConnectionTimeoutError` is thrown.
131
140
 
132
- ### Extract Markdown
141
+ Note that requests which time out will be [retried twice by default](#retries).
133
142
 
134
- Convert web pages to clean Markdown format:
143
+ ## Advanced Usage
135
144
 
136
- ```typescript
137
- const result = await tabs.extract.markdown('https://example.com/blog/article', {
138
- metadata: true, // optional: include page metadata
139
- nocache: false // optional: bypass cache
140
- });
145
+ ### Accessing raw Response data (e.g., headers)
141
146
 
142
- console.log(result.content);
143
- console.log(result.metadata); // if metadata: true
144
- ```
147
+ The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
148
+ This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
145
149
 
146
- ### Extract Structured Data
147
-
148
- Extract data matching a JSON schema:
149
-
150
- ```typescript
151
- const schema = {
152
- type: 'object',
153
- properties: {
154
- products: {
155
- type: 'array',
156
- items: {
157
- type: 'object',
158
- properties: {
159
- name: { type: 'string' },
160
- price: { type: 'number' },
161
- inStock: { type: 'boolean' }
162
- },
163
- required: ['name', 'price', 'inStock']
164
- }
165
- }
166
- },
167
- required: ['products']
168
- };
150
+ You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
151
+ Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
152
+
153
+ <!-- prettier-ignore -->
154
+ ```ts
155
+ const client = new Tabstack();
156
+
157
+ const response = await client.agent
158
+ .automate({
159
+ task: 'Find the top 3 trending repositories and extract their names, descriptions, and star counts',
160
+ })
161
+ .asResponse();
162
+ console.log(response.headers.get('X-My-Header'));
163
+ console.log(response.statusText); // access the underlying Response object
169
164
 
170
- const result = await tabs.extract.json('https://example.com/products', schema);
171
- console.log(result.data);
165
+ const { data: automateEvent, response: raw } = await client.agent
166
+ .automate({
167
+ task: 'Find the top 3 trending repositories and extract their names, descriptions, and star counts',
168
+ })
169
+ .withResponse();
170
+ console.log(raw.headers.get('X-My-Header'));
171
+ console.log(automateEvent.data);
172
172
  ```
173
173
 
174
- ### Generate Content
175
-
176
- Transform web content using AI:
177
-
178
- ```typescript
179
- const schema = {
180
- type: 'object',
181
- properties: {
182
- summaries: {
183
- type: 'array',
184
- items: {
185
- type: 'object',
186
- properties: {
187
- title: { type: 'string' },
188
- category: { type: 'string' },
189
- summary: { type: 'string' }
190
- },
191
- required: ['title', 'category', 'summary']
192
- }
193
- }
194
- },
195
- required: ['summaries']
196
- };
174
+ ### Logging
197
175
 
198
- const result = await tabs.generate.json(
199
- 'https://news.ycombinator.com',
200
- schema,
201
- 'Categorize each story and write a one-sentence summary'
202
- );
176
+ > [!IMPORTANT]
177
+ > All log messages are intended for debugging only. The format and content of log messages
178
+ > may change between releases.
203
179
 
204
- console.log(result.data);
205
- ```
180
+ #### Log levels
206
181
 
207
- ### Automate Tasks
208
-
209
- Execute browser automation tasks with streaming updates:
210
-
211
- ```typescript
212
- for await (const event of tabs.agent.automate(
213
- 'Find the top 3 trending repositories and extract their details',
214
- {
215
- url: 'https://github.com/trending',
216
- guardrails: 'browse and extract only',
217
- maxIterations: 50
218
- }
219
- )) {
220
- console.log(`Event: ${event.type}`);
221
-
222
- if (event.type === 'task:completed') {
223
- console.log('Result:', event.data.get('finalAnswer'));
224
- } else if (event.type === 'agent:extracted') {
225
- console.log('Extracted:', event.data.get('extractedData'));
226
- }
227
- }
228
- ```
182
+ The log level can be configured in two ways:
229
183
 
230
- ## Working with JSON Schemas
231
-
232
- The SDK uses standard [JSON Schema](https://json-schema.org/) format for defining data structures:
233
-
234
- ```typescript
235
- const schema = {
236
- type: 'object',
237
- properties: {
238
- name: { type: 'string', description: 'Person name' },
239
- age: { type: 'number', description: 'Person age' },
240
- isActive: { type: 'boolean', description: 'Active status' },
241
- tags: {
242
- type: 'array',
243
- items: { type: 'string' }
244
- },
245
- addresses: {
246
- type: 'array',
247
- items: {
248
- type: 'object',
249
- properties: {
250
- street: { type: 'string' },
251
- city: { type: 'string' },
252
- zipCode: { type: 'number' }
253
- },
254
- required: ['street', 'city', 'zipCode']
255
- }
256
- },
257
- metadata: {
258
- type: 'object',
259
- properties: {
260
- createdAt: { type: 'string' },
261
- updatedAt: { type: 'string' }
262
- },
263
- required: ['createdAt', 'updatedAt']
264
- }
265
- },
266
- required: ['name', 'age']
267
- };
268
- ```
184
+ 1. Via the `TABSTACK_LOG` environment variable
185
+ 2. Using the `logLevel` client option (overrides the environment variable if set)
269
186
 
270
- ## Error Handling
271
-
272
- Handle errors with specific error classes:
273
-
274
- ```typescript
275
- import {
276
- TabstackError,
277
- UnauthorizedError,
278
- InvalidURLError,
279
- BadRequestError,
280
- ServerError
281
- } from '@tabstack/sdk';
282
-
283
- try {
284
- const result = await tabs.extract.markdown('https://example.com');
285
- } catch (error) {
286
- if (error instanceof UnauthorizedError) {
287
- console.error('Invalid API key');
288
- } else if (error instanceof InvalidURLError) {
289
- console.error('Invalid or inaccessible URL');
290
- } else if (error instanceof TabstackError) {
291
- console.error(`API error: ${error.message}`);
292
- }
293
- }
187
+ ```ts
188
+ import Tabstack from '@tabstack/sdk';
189
+
190
+ const client = new Tabstack({
191
+ logLevel: 'debug', // Show all log messages
192
+ });
294
193
  ```
295
194
 
296
- ### Error Classes
195
+ Available log levels, from most to least verbose:
297
196
 
298
- - `TabstackError` - Base error class
299
- - `BadRequestError` - 400: Malformed request
300
- - `UnauthorizedError` - 401: Invalid API key
301
- - `InvalidURLError` - 422: Invalid or inaccessible URL
302
- - `ServerError` - 500: Internal server error
303
- - `ServiceUnavailableError` - 503: Service unavailable
304
- - `APIError` - Generic API error with status code
197
+ - `'debug'` - Show debug messages, info, warnings, and errors
198
+ - `'info'` - Show info messages, warnings, and errors
199
+ - `'warn'` - Show warnings and errors (default)
200
+ - `'error'` - Show only errors
201
+ - `'off'` - Disable all logging
305
202
 
306
- ## Requirements
203
+ At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
204
+ Some authentication-related headers are redacted, but sensitive data in request and response bodies
205
+ may still be visible.
307
206
 
308
- - Node.js >= 20.0.0
309
- - Tabstack API key ([get one here](https://tabstack.ai))
207
+ #### Custom logger
310
208
 
311
- ## Development & Testing
209
+ By default, this library logs to `globalThis.console`. You can also provide a custom logger.
210
+ Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.
312
211
 
313
- This SDK includes a comprehensive testing suite with excellent code coverage and type safety.
212
+ When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
213
+ below the configured level will not be sent to your logger.
314
214
 
315
- ### Running Tests
215
+ ```ts
216
+ import Tabstack from '@tabstack/sdk';
217
+ import pino from 'pino';
316
218
 
317
- ```bash
318
- # Run all tests
319
- npm test
219
+ const logger = pino();
220
+
221
+ const client = new Tabstack({
222
+ logger: logger.child({ name: 'Tabstack' }),
223
+ logLevel: 'debug', // Send all messages to pino, allowing it to filter
224
+ });
225
+ ```
320
226
 
321
- # Run unit tests only
322
- npm run test:unit
227
+ ### Making custom/undocumented requests
323
228
 
324
- # Run E2E tests only
325
- npm run test:e2e
229
+ This library is typed for convenient access to the documented API. If you need to access undocumented
230
+ endpoints, params, or response properties, the library can still be used.
326
231
 
327
- # Run tests in watch mode
328
- npm run test:watch
232
+ #### Undocumented endpoints
329
233
 
330
- # Run tests with coverage report
331
- npm run test:coverage
234
+ To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
235
+ Options on the client, such as retries, will be respected when making these requests.
332
236
 
333
- # Run TypeScript type tests
334
- npm run test:types
237
+ ```ts
238
+ await client.post('/some/path', {
239
+ body: { some_prop: 'foo' },
240
+ query: { some_query_arg: 'bar' },
241
+ });
335
242
  ```
336
243
 
337
- ### Test Structure
244
+ #### Undocumented request params
338
245
 
339
- The SDK includes multiple types of tests:
246
+ To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
247
+ parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
248
+ send will be sent as-is.
340
249
 
341
- **Unit Tests** (`src/**/*.test.ts`)
342
- - HTTPClient tests - HTTP request/response handling, error scenarios
343
- - Exception classes tests - Error creation and inheritance
344
- - Type classes tests - Serialization, deserialization, data access
345
- - Extract operator tests - Markdown, schema, and JSON extraction
346
- - Generate operator tests - AI-powered content generation
347
- - Automate operator tests - SSE streaming and event parsing
348
- - Client tests - Main client initialization and configuration
250
+ ```ts
251
+ client.agent.automate({
252
+ // ...
253
+ // @ts-expect-error baz is not yet public
254
+ baz: 'undocumented option',
255
+ });
256
+ ```
349
257
 
350
- **E2E Tests** (`test/e2e/`)
351
- - Complete workflows from client to operators
352
- - Real-world use case scenarios
353
- - Error handling and edge cases
354
- - Multi-operation workflows
258
+ For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
259
+ extra param in the body.
355
260
 
356
- **Type Tests** (`test/types/`)
357
- - TypeScript type safety validation using `tsd`
358
- - Generic type inference
359
- - Type guard verification
360
- - Compile-time type checking
261
+ If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
262
+ options.
361
263
 
362
- ### Test Coverage
264
+ #### Undocumented response properties
363
265
 
364
- The SDK maintains high test coverage across all modules:
266
+ To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
267
+ the response object, or cast the response object to the requisite type. Like the request params, we do not
268
+ validate or strip extra properties from the response from the API.
365
269
 
366
- - **172+ test cases** covering all major functionality
367
- - **~70%+ code coverage** across branches, functions, lines, and statements
368
- - **Mocked HTTP requests** using `nock` for fast, reliable tests
369
- - **Type-safe tests** with full TypeScript support
270
+ ### Customizing the fetch client
370
271
 
371
- ### Test Technologies
272
+ By default, this library expects a global `fetch` function is defined.
372
273
 
373
- - **Jest** - Test runner and assertion library
374
- - **ts-jest** - TypeScript support for Jest
375
- - **nock** - HTTP request mocking
376
- - **tsd** - TypeScript type definition testing
274
+ If you want to use a different `fetch` function, you can either polyfill the global:
377
275
 
378
- ### Writing Tests
276
+ ```ts
277
+ import fetch from 'my-fetch';
379
278
 
380
- When contributing to the SDK, please:
279
+ globalThis.fetch = fetch;
280
+ ```
381
281
 
382
- 1. Write tests for all new features and bug fixes
383
- 2. Maintain or improve code coverage
384
- 3. Use descriptive test names that explain the behavior being tested
385
- 4. Mock external HTTP requests using `nock`
386
- 5. Test both success and error scenarios
387
- 6. Add type tests for new public APIs
282
+ Or pass it to the client:
388
283
 
389
- Example test structure:
284
+ ```ts
285
+ import Tabstack from '@tabstack/sdk';
286
+ import fetch from 'my-fetch';
390
287
 
391
- ```typescript
392
- describe('Feature', () => {
393
- describe('method', () => {
394
- it('should handle success case', async () => {
395
- // Arrange
396
- const mockData = { result: 'success' };
397
- nock('https://api.tabstack.ai')
398
- .post('/endpoint')
399
- .reply(200, mockData);
288
+ const client = new Tabstack({ fetch });
289
+ ```
400
290
 
401
- // Act
402
- const result = await client.feature.method();
291
+ ### Fetch options
403
292
 
404
- // Assert
405
- expect(result).toEqual(mockData);
406
- });
293
+ 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.)
407
294
 
408
- it('should handle error case', async () => {
409
- nock('https://api.tabstack.ai')
410
- .post('/endpoint')
411
- .reply(400, { error: 'Bad request' });
295
+ ```ts
296
+ import Tabstack from '@tabstack/sdk';
412
297
 
413
- await expect(client.feature.method()).rejects.toThrow(BadRequestError);
414
- });
415
- });
298
+ const client = new Tabstack({
299
+ fetchOptions: {
300
+ // `RequestInit` options
301
+ },
416
302
  });
417
303
  ```
418
304
 
419
- ## Contributing
305
+ #### Configuring proxies
306
+
307
+ To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
308
+ options to requests:
420
309
 
421
- We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
310
+ <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>
422
311
 
423
- ### Quick Start for Contributors
312
+ ```ts
313
+ import Tabstack from '@tabstack/sdk';
314
+ import * as undici from 'undici';
424
315
 
425
- ```bash
426
- # Fork and clone the repository
427
- git clone https://github.com/YOUR_USERNAME/tabs-typescript.git
428
- cd tabs-typescript
316
+ const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
317
+ const client = new Tabstack({
318
+ fetchOptions: {
319
+ dispatcher: proxyAgent,
320
+ },
321
+ });
322
+ ```
323
+
324
+ <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>
325
+
326
+ ```ts
327
+ import Tabstack from '@tabstack/sdk';
328
+
329
+ const client = new Tabstack({
330
+ fetchOptions: {
331
+ proxy: 'http://localhost:8888',
332
+ },
333
+ });
334
+ ```
335
+
336
+ <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>
429
337
 
430
- # Install dependencies
431
- npm install
338
+ ```ts
339
+ import Tabstack from 'npm:@tabstack/sdk';
432
340
 
433
- # Run checks locally before submitting PR
434
- npm run lint # Check for linting errors
435
- npm run format:check # Check formatting
436
- npm test # Run all tests
437
- npm run build # Verify builds work
341
+ const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
342
+ const client = new Tabstack({
343
+ fetchOptions: {
344
+ client: httpClient,
345
+ },
346
+ });
438
347
  ```
439
348
 
440
- ### Pull Request Requirements
349
+ ## Frequently Asked Questions
350
+
351
+ ## Semantic versioning
352
+
353
+ 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:
354
+
355
+ 1. Changes that only affect static types, without breaking runtime behavior.
356
+ 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
357
+ 3. Changes that we do not expect to impact the vast majority of users in practice.
441
358
 
442
- All PRs must pass these checks before merging:
359
+ We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
443
360
 
444
- - **Lint** - Code style and formatting (ESLint + Prettier)
445
- - ✅ **Node 20, 22, 24** - Tests and builds on all supported Node versions
446
- - ✅ **Code Review** - Approval from maintainers
361
+ We are keen for your feedback; please open an [issue](https://www.github.com/Mozilla-Ocho/tabstack-typescript/issues) with questions, bugs, or suggestions.
447
362
 
448
- See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
363
+ ## Requirements
364
+
365
+ TypeScript >= 4.9 is supported.
366
+
367
+ The following runtimes are supported:
449
368
 
450
- ## License
369
+ - Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
370
+ - Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
371
+ - Deno v1.28.0 or higher.
372
+ - Bun 1.0 or later.
373
+ - Cloudflare Workers.
374
+ - Vercel Edge Runtime.
375
+ - Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
376
+ - Nitro v2.6 or greater.
451
377
 
452
- Apache
378
+ Note that React Native is not supported at this time.
453
379
 
454
- ## Support
380
+ If you are interested in other runtime environments, please open or upvote an issue on GitHub.
381
+
382
+ ## Contributing
455
383
 
456
- - Documentation: [https://docs.tabstack.ai](https://docs.tabstack.ai)
457
- - GitHub Issues: [https://github.com/tabstack/tabs-typescript/issues](https://github.com/tabstack/tabs-typescript/issues)
458
- - Website: [https://tabstack.ai](https://tabstack.ai)
384
+ See [the contributing documentation](./CONTRIBUTING.md).