@tabstack/sdk 1.0.4 → 2.0.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 +90 -0
  2. package/LICENSE +22 -11
  3. package/README.md +276 -377
  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 +74 -0
  256. package/resources/agent.d.mts.map +1 -0
  257. package/resources/agent.d.ts +74 -0
  258. package/resources/agent.d.ts.map +1 -0
  259. package/resources/agent.js +45 -0
  260. package/resources/agent.js.map +1 -0
  261. package/resources/agent.mjs +41 -0
  262. package/resources/agent.mjs.map +1 -0
  263. package/resources/extract.d.mts +118 -0
  264. package/resources/extract.d.mts.map +1 -0
  265. package/resources/extract.d.ts +118 -0
  266. package/resources/extract.d.ts.map +1 -0
  267. package/resources/extract.js +37 -0
  268. package/resources/extract.js.map +1 -0
  269. package/resources/extract.mjs +33 -0
  270. package/resources/extract.mjs.map +1 -0
  271. package/resources/generate.d.mts +45 -0
  272. package/resources/generate.d.mts.map +1 -0
  273. package/resources/generate.d.ts +45 -0
  274. package/resources/generate.d.ts.map +1 -0
  275. package/resources/generate.js +26 -0
  276. package/resources/generate.js.map +1 -0
  277. package/resources/generate.mjs +22 -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 +756 -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 +93 -0
  330. package/src/resources/extract.ts +147 -0
  331. package/src/resources/generate.ts +53 -0
  332. package/src/resources/index.ts +11 -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/automate.d.ts +0 -156
  363. package/dist/cjs/automate.d.ts.map +0 -1
  364. package/dist/cjs/automate.js +0 -211
  365. package/dist/cjs/automate.js.map +0 -1
  366. package/dist/cjs/automate.test.d.ts +0 -5
  367. package/dist/cjs/automate.test.d.ts.map +0 -1
  368. package/dist/cjs/automate.test.js +0 -441
  369. package/dist/cjs/automate.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 -256
  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 -206
  387. package/dist/cjs/extract.d.ts.map +0 -1
  388. package/dist/cjs/extract.js +0 -223
  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 -364
  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/automate.d.ts +0 -156
  424. package/dist/esm/automate.d.ts.map +0 -1
  425. package/dist/esm/automate.js +0 -207
  426. package/dist/esm/automate.js.map +0 -1
  427. package/dist/esm/automate.test.d.ts +0 -5
  428. package/dist/esm/automate.test.d.ts.map +0 -1
  429. package/dist/esm/automate.test.js +0 -439
  430. package/dist/esm/automate.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 -254
  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 -206
  448. package/dist/esm/extract.d.ts.map +0 -1
  449. package/dist/esm/extract.js +0 -219
  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 -362
  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/automate.d.ts +0 -156
  485. package/dist/types/automate.d.ts.map +0 -1
  486. package/dist/types/automate.test.d.ts +0 -5
  487. package/dist/types/automate.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 -206
  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,485 +1,384 @@
1
- # TABStack AI TypeScript SDK
1
+ # Tabstack TypeScript API Library
2
2
 
3
- TypeScript/JavaScript SDK for [TABStack AI](https://tabstack.ai) - Extract, Generate, and Automate web content with AI.
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)
4
4
 
5
- ## Features
5
+ This library provides convenient access to the Tabstack REST API from server-side TypeScript or JavaScript.
6
6
 
7
- - **Extract**: Convert web pages to Markdown, generate schemas, and extract structured JSON data
8
- - **Generate**: Transform web content using AI with custom instructions
9
- - **Automate**: Execute complex browser automation tasks with natural language
10
- - **Type-Safe**: Full TypeScript support with comprehensive type definitions
11
- - **Zero Dependencies**: Uses only Node.js standard library
12
- - **Universal Module Support**: Works with CommonJS, ESM, and all TypeScript configurations
7
+ The full API of this library can be found in [api.md](api.md).
13
8
 
14
- ## Installation
9
+ It is generated with [Stainless](https://www.stainless.com/).
10
+
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=eyJuYW1lIjoidGFic3RhY2stbWNwIiwidHJhbnNwb3J0Ijoic3NlIiwidXJsIjoiaHR0cHM6Ly90YWJzdGFjay5zdGxtY3AuY29tL3NzZSJ9)
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%22sse%22%2C%22url%22%3A%22https%3A%2F%2Ftabstack.stlmcp.com%2Fsse%22%7D)
17
+
18
+ > Note: You may need to set environment variables in your MCP client.
15
19
 
16
- Install the SDK using your preferred package manager:
20
+ ## Installation
17
21
 
18
- ### npm
19
- ```bash
22
+ ```sh
20
23
  npm install @tabstack/sdk
21
24
  ```
22
25
 
23
- ### Yarn
24
- ```bash
25
- yarn add @tabstack/sdk
26
- ```
26
+ ## Usage
27
27
 
28
- ### pnpm
29
- ```bash
30
- pnpm add @tabstack/sdk
31
- ```
28
+ The full API of this library can be found in [api.md](api.md).
32
29
 
33
- ### Bun
34
- ```bash
35
- bun add @tabstack/sdk
36
- ```
30
+ <!-- prettier-ignore -->
31
+ ```js
32
+ import Tabstack from '@tabstack/sdk';
37
33
 
38
- ### From Source
34
+ const client = new Tabstack({
35
+ apiKey: process.env['TABSTACK_API_KEY'], // This is the default and can be omitted
36
+ });
39
37
 
40
- 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
+ });
41
41
 
42
- ```bash
43
- git clone https://github.com/tabstack/tabs-typescript.git
44
- cd tabs-typescript
45
- npm install
46
- npm run build
42
+ console.log(automateEvent.data);
47
43
  ```
48
44
 
49
- To use the local build in your project:
45
+ ### Request & Response types
50
46
 
51
- ```bash
52
- # Link the package globally
53
- npm link
47
+ This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
54
48
 
55
- # In your project directory
56
- npm link @tabstack/sdk
57
- ```
49
+ <!-- prettier-ignore -->
50
+ ```ts
51
+ import Tabstack from '@tabstack/sdk';
58
52
 
59
- Or install directly from the local path:
53
+ const client = new Tabstack({
54
+ apiKey: process.env['TABSTACK_API_KEY'], // This is the default and can be omitted
55
+ });
60
56
 
61
- ```bash
62
- npm install /path/to/tabs-typescript
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);
63
61
  ```
64
62
 
65
- ## Quick Start
63
+ Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
66
64
 
67
- ### Get Your API Key
65
+ ## Handling errors
68
66
 
69
- Sign up at [tabstack.ai](https://tabstack.ai) to get your API key.
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:
70
70
 
71
- ### Basic Usage
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
+ });
86
+ ```
72
87
 
73
- #### ES Modules (ESM)
74
- ```typescript
75
- import { TABStack } from '@tabstack/sdk';
88
+ Error codes are as follows:
76
89
 
77
- const tabs = new TABStack({
78
- apiKey: process.env.TABSTACK_API_KEY!
79
- });
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` |
80
100
 
81
- // Extract markdown from a URL
82
- const markdown = await tabs.extract.markdown('https://example.com');
83
- console.log(markdown.content);
84
-
85
- // Extract structured data with JSON schema
86
- const schema = {
87
- type: 'object',
88
- properties: {
89
- stories: {
90
- type: 'array',
91
- items: {
92
- type: 'object',
93
- properties: {
94
- title: { type: 'string' },
95
- points: { type: 'number' },
96
- author: { type: 'string' }
97
- },
98
- required: ['title', 'points', 'author']
99
- }
100
- }
101
- },
102
- required: ['stories']
103
- };
101
+ ### Retries
104
102
 
105
- const data = await tabs.extract.json('https://news.ycombinator.com', schema);
106
- console.log(data.data);
107
- ```
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.
108
106
 
109
- #### CommonJS
110
- ```javascript
111
- const { TABStack } = require('@tabstack/sdk');
107
+ You can use the `maxRetries` option to configure or disable this:
112
108
 
113
- const tabs = new TABStack({
114
- 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
115
114
  });
116
115
 
117
- // Extract markdown
118
- tabs.extract.markdown('https://example.com')
119
- .then(result => {
120
- console.log(result.content);
121
- })
122
- .catch(error => {
123
- console.error('Error:', error.message);
124
- });
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
+ });
125
120
  ```
126
121
 
127
- ## Core Features
128
-
129
- ### Extract Markdown
122
+ ### Timeouts
130
123
 
131
- Convert web pages to clean Markdown format:
124
+ Requests time out after 1 minute by default. You can configure this with a `timeout` option:
132
125
 
133
- ```typescript
134
- const result = await tabs.extract.markdown('https://example.com/blog/article', {
135
- metadata: true, // optional: include page metadata
136
- nocache: false // optional: bypass cache
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)
137
131
  });
138
132
 
139
- console.log(result.content);
140
- console.log(result.metadata); // if metadata: true
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
+ });
141
137
  ```
142
138
 
143
- ### Extract Structured Data
144
-
145
- Extract data matching a JSON schema:
146
-
147
- ```typescript
148
- const schema = {
149
- type: 'object',
150
- properties: {
151
- products: {
152
- type: 'array',
153
- items: {
154
- type: 'object',
155
- properties: {
156
- name: { type: 'string' },
157
- price: { type: 'number' },
158
- inStock: { type: 'boolean' }
159
- },
160
- required: ['name', 'price', 'inStock']
161
- }
162
- }
163
- },
164
- required: ['products']
165
- };
139
+ On timeout, an `APIConnectionTimeoutError` is thrown.
166
140
 
167
- const result = await tabs.extract.json('https://example.com/products', schema);
168
- console.log(result.data);
169
- ```
141
+ Note that requests which time out will be [retried twice by default](#retries).
170
142
 
171
- ### Generate Schema
143
+ ## Advanced Usage
172
144
 
173
- Generate a JSON schema from web content:
145
+ ### Accessing raw Response data (e.g., headers)
174
146
 
175
- ```typescript
176
- const schema = await tabs.extract.schema('https://news.ycombinator.com', {
177
- instructions: 'extract top stories with title, points, and author'
178
- });
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.
179
149
 
180
- // Use the generated schema for extraction
181
- const result = await tabs.extract.json('https://news.ycombinator.com', schema);
182
- console.log(result.data);
183
- ```
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.
184
152
 
185
- ### Generate Content
186
-
187
- Transform web content using AI:
188
-
189
- ```typescript
190
- const schema = {
191
- type: 'object',
192
- properties: {
193
- summaries: {
194
- type: 'array',
195
- items: {
196
- type: 'object',
197
- properties: {
198
- title: { type: 'string' },
199
- category: { type: 'string' },
200
- summary: { type: 'string' }
201
- },
202
- required: ['title', 'category', 'summary']
203
- }
204
- }
205
- },
206
- required: ['summaries']
207
- };
153
+ <!-- prettier-ignore -->
154
+ ```ts
155
+ const client = new Tabstack();
208
156
 
209
- const result = await tabs.generate.json(
210
- 'https://news.ycombinator.com',
211
- schema,
212
- 'Categorize each story and write a one-sentence summary'
213
- );
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
214
164
 
215
- 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);
216
172
  ```
217
173
 
218
- ### Automate Tasks
219
-
220
- Execute browser automation tasks with streaming updates:
221
-
222
- ```typescript
223
- for await (const event of tabs.automate.execute(
224
- 'Find the top 3 trending repositories and extract their details',
225
- {
226
- url: 'https://github.com/trending',
227
- guardrails: 'browse and extract only',
228
- maxIterations: 50
229
- }
230
- )) {
231
- console.log(`Event: ${event.type}`);
232
-
233
- if (event.type === 'task:completed') {
234
- console.log('Result:', event.data.get('finalAnswer'));
235
- } else if (event.type === 'agent:extracted') {
236
- console.log('Extracted:', event.data.get('extractedData'));
237
- }
238
- }
239
- ```
174
+ ### Logging
240
175
 
241
- ## Working with JSON Schemas
242
-
243
- The SDK uses standard [JSON Schema](https://json-schema.org/) format for defining data structures. You can define schemas manually or generate them automatically:
244
-
245
- ### Manual Schema Definition
246
-
247
- ```typescript
248
- const schema = {
249
- type: 'object',
250
- properties: {
251
- name: { type: 'string', description: 'Person name' },
252
- age: { type: 'number', description: 'Person age' },
253
- isActive: { type: 'boolean', description: 'Active status' },
254
- tags: {
255
- type: 'array',
256
- items: { type: 'string' }
257
- },
258
- addresses: {
259
- type: 'array',
260
- items: {
261
- type: 'object',
262
- properties: {
263
- street: { type: 'string' },
264
- city: { type: 'string' },
265
- zipCode: { type: 'number' }
266
- },
267
- required: ['street', 'city', 'zipCode']
268
- }
269
- },
270
- metadata: {
271
- type: 'object',
272
- properties: {
273
- createdAt: { type: 'string' },
274
- updatedAt: { type: 'string' }
275
- },
276
- required: ['createdAt', 'updatedAt']
277
- }
278
- },
279
- required: ['name', 'age']
280
- };
281
- ```
176
+ > [!IMPORTANT]
177
+ > All log messages are intended for debugging only. The format and content of log messages
178
+ > may change between releases.
282
179
 
283
- ### Automatic Schema Generation
180
+ #### Log levels
284
181
 
285
- Let the AI generate a schema from any webpage:
182
+ The log level can be configured in two ways:
286
183
 
287
- ```typescript
288
- // Generate schema from content
289
- const schema = await tabs.extract.schema('https://news.ycombinator.com', {
290
- instructions: 'extract stories with title, points, and author'
291
- });
184
+ 1. Via the `TABSTACK_LOG` environment variable
185
+ 2. Using the `logLevel` client option (overrides the environment variable if set)
292
186
 
293
- // Use it immediately
294
- const data = await tabs.extract.json('https://news.ycombinator.com', schema);
295
- ```
187
+ ```ts
188
+ import Tabstack from '@tabstack/sdk';
296
189
 
297
- ## Error Handling
298
-
299
- Handle errors with specific error classes:
300
-
301
- ```typescript
302
- import {
303
- TABStackError,
304
- UnauthorizedError,
305
- InvalidURLError,
306
- BadRequestError,
307
- ServerError
308
- } from '@tabstack/sdk';
309
-
310
- try {
311
- const result = await tabs.extract.markdown('https://example.com');
312
- } catch (error) {
313
- if (error instanceof UnauthorizedError) {
314
- console.error('Invalid API key');
315
- } else if (error instanceof InvalidURLError) {
316
- console.error('Invalid or inaccessible URL');
317
- } else if (error instanceof TABStackError) {
318
- console.error(`API error: ${error.message}`);
319
- }
320
- }
190
+ const client = new Tabstack({
191
+ logLevel: 'debug', // Show all log messages
192
+ });
321
193
  ```
322
194
 
323
- ### Error Classes
195
+ Available log levels, from most to least verbose:
324
196
 
325
- - `TABStackError` - Base error class
326
- - `BadRequestError` - 400: Malformed request
327
- - `UnauthorizedError` - 401: Invalid API key
328
- - `InvalidURLError` - 422: Invalid or inaccessible URL
329
- - `ServerError` - 500: Internal server error
330
- - `ServiceUnavailableError` - 503: Service unavailable
331
- - `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
332
202
 
333
- ## 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.
334
206
 
335
- - Node.js >= 20.0.0
336
- - TABStack API key ([get one here](https://tabstack.ai))
207
+ #### Custom logger
337
208
 
338
- ## 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.
339
211
 
340
- 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.
341
214
 
342
- ### Running Tests
215
+ ```ts
216
+ import Tabstack from '@tabstack/sdk';
217
+ import pino from 'pino';
343
218
 
344
- ```bash
345
- # Run all tests
346
- 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
+ ```
347
226
 
348
- # Run unit tests only
349
- npm run test:unit
227
+ ### Making custom/undocumented requests
350
228
 
351
- # Run E2E tests only
352
- 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.
353
231
 
354
- # Run tests in watch mode
355
- npm run test:watch
232
+ #### Undocumented endpoints
356
233
 
357
- # Run tests with coverage report
358
- 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.
359
236
 
360
- # Run TypeScript type tests
361
- npm run test:types
237
+ ```ts
238
+ await client.post('/some/path', {
239
+ body: { some_prop: 'foo' },
240
+ query: { some_query_arg: 'bar' },
241
+ });
362
242
  ```
363
243
 
364
- ### Test Structure
244
+ #### Undocumented request params
365
245
 
366
- 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.
367
249
 
368
- **Unit Tests** (`src/**/*.test.ts`)
369
- - HTTPClient tests - HTTP request/response handling, error scenarios
370
- - Exception classes tests - Error creation and inheritance
371
- - Type classes tests - Serialization, deserialization, data access
372
- - Extract operator tests - Markdown, schema, and JSON extraction
373
- - Generate operator tests - AI-powered content generation
374
- - Automate operator tests - SSE streaming and event parsing
375
- - 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
+ ```
376
257
 
377
- **E2E Tests** (`test/e2e/`)
378
- - Complete workflows from client to operators
379
- - Real-world use case scenarios
380
- - Error handling and edge cases
381
- - 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.
382
260
 
383
- **Type Tests** (`test/types/`)
384
- - TypeScript type safety validation using `tsd`
385
- - Generic type inference
386
- - Type guard verification
387
- - 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.
388
263
 
389
- ### Test Coverage
264
+ #### Undocumented response properties
390
265
 
391
- 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.
392
269
 
393
- - **172+ test cases** covering all major functionality
394
- - **~70%+ code coverage** across branches, functions, lines, and statements
395
- - **Mocked HTTP requests** using `nock` for fast, reliable tests
396
- - **Type-safe tests** with full TypeScript support
270
+ ### Customizing the fetch client
397
271
 
398
- ### Test Technologies
272
+ By default, this library expects a global `fetch` function is defined.
399
273
 
400
- - **Jest** - Test runner and assertion library
401
- - **ts-jest** - TypeScript support for Jest
402
- - **nock** - HTTP request mocking
403
- - **tsd** - TypeScript type definition testing
274
+ If you want to use a different `fetch` function, you can either polyfill the global:
404
275
 
405
- ### Writing Tests
276
+ ```ts
277
+ import fetch from 'my-fetch';
406
278
 
407
- When contributing to the SDK, please:
279
+ globalThis.fetch = fetch;
280
+ ```
408
281
 
409
- 1. Write tests for all new features and bug fixes
410
- 2. Maintain or improve code coverage
411
- 3. Use descriptive test names that explain the behavior being tested
412
- 4. Mock external HTTP requests using `nock`
413
- 5. Test both success and error scenarios
414
- 6. Add type tests for new public APIs
282
+ Or pass it to the client:
415
283
 
416
- Example test structure:
284
+ ```ts
285
+ import Tabstack from '@tabstack/sdk';
286
+ import fetch from 'my-fetch';
417
287
 
418
- ```typescript
419
- describe('Feature', () => {
420
- describe('method', () => {
421
- it('should handle success case', async () => {
422
- // Arrange
423
- const mockData = { result: 'success' };
424
- nock('https://api.tabstack.ai')
425
- .post('/endpoint')
426
- .reply(200, mockData);
288
+ const client = new Tabstack({ fetch });
289
+ ```
427
290
 
428
- // Act
429
- const result = await client.feature.method();
291
+ ### Fetch options
430
292
 
431
- // Assert
432
- expect(result).toEqual(mockData);
433
- });
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.)
434
294
 
435
- it('should handle error case', async () => {
436
- nock('https://api.tabstack.ai')
437
- .post('/endpoint')
438
- .reply(400, { error: 'Bad request' });
295
+ ```ts
296
+ import Tabstack from '@tabstack/sdk';
439
297
 
440
- await expect(client.feature.method()).rejects.toThrow(BadRequestError);
441
- });
442
- });
298
+ const client = new Tabstack({
299
+ fetchOptions: {
300
+ // `RequestInit` options
301
+ },
443
302
  });
444
303
  ```
445
304
 
446
- ## Contributing
305
+ #### Configuring proxies
306
+
307
+ To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
308
+ options to requests:
447
309
 
448
- 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>
449
311
 
450
- ### Quick Start for Contributors
312
+ ```ts
313
+ import Tabstack from '@tabstack/sdk';
314
+ import * as undici from 'undici';
451
315
 
452
- ```bash
453
- # Fork and clone the repository
454
- git clone https://github.com/YOUR_USERNAME/tabs-typescript.git
455
- 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>
456
337
 
457
- # Install dependencies
458
- npm install
338
+ ```ts
339
+ import Tabstack from 'npm:@tabstack/sdk';
459
340
 
460
- # Run checks locally before submitting PR
461
- npm run lint # Check for linting errors
462
- npm run format:check # Check formatting
463
- npm test # Run all tests
464
- 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
+ });
465
347
  ```
466
348
 
467
- ### 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.
468
358
 
469
- 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.
470
360
 
471
- - **Lint** - Code style and formatting (ESLint + Prettier)
472
- - ✅ **Node 20, 22, 24** - Tests and builds on all supported Node versions
473
- - ✅ **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.
474
362
 
475
- See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
363
+ ## Requirements
364
+
365
+ TypeScript >= 4.9 is supported.
366
+
367
+ The following runtimes are supported:
476
368
 
477
- ## 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.
478
377
 
479
- Apache
378
+ Note that React Native is not supported at this time.
480
379
 
481
- ## Support
380
+ If you are interested in other runtime environments, please open or upvote an issue on GitHub.
381
+
382
+ ## Contributing
482
383
 
483
- - Documentation: [https://docs.tabstack.ai](https://docs.tabstack.ai)
484
- - GitHub Issues: [https://github.com/tabstack/tabs-typescript/issues](https://github.com/tabstack/tabs-typescript/issues)
485
- - Website: [https://tabstack.ai](https://tabstack.ai)
384
+ See [the contributing documentation](./CONTRIBUTING.md).