@orq-ai/node 3.3.1 → 3.4.0-rc.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 (273) hide show
  1. package/bin/mcp-server.js +40 -43
  2. package/bin/mcp-server.js.map +24 -24
  3. package/jsr.json +1 -1
  4. package/lib/config.d.ts +2 -2
  5. package/lib/config.js +2 -2
  6. package/lib/config.js.map +1 -1
  7. package/mcp-server/mcp-server.js +1 -1
  8. package/mcp-server/mcp-server.js.map +1 -1
  9. package/mcp-server/server.js +1 -1
  10. package/mcp-server/server.js.map +1 -1
  11. package/models/operations/bulkcreatedatapoints.js +2 -2
  12. package/models/operations/createcontact.js +2 -2
  13. package/models/operations/createdataset.js +2 -2
  14. package/models/operations/createdatasetitem.js +2 -2
  15. package/models/operations/createdatasource.js +2 -2
  16. package/models/operations/fileget.js +2 -2
  17. package/models/operations/filelist.js +2 -2
  18. package/models/operations/fileupload.js +2 -2
  19. package/models/operations/listdatasetdatapoints.js +2 -2
  20. package/models/operations/listdatasets.js +2 -2
  21. package/models/operations/listdatasources.js +2 -2
  22. package/models/operations/retrievedatapoint.js +2 -2
  23. package/models/operations/retrievedataset.js +2 -2
  24. package/models/operations/retrievedatasource.js +2 -2
  25. package/models/operations/updatedatapoint.js +2 -2
  26. package/models/operations/updatedataset.js +2 -2
  27. package/models/operations/updatedatasource.js +2 -2
  28. package/package.json +3 -2
  29. package/src/lib/config.ts +2 -2
  30. package/src/mcp-server/mcp-server.ts +1 -1
  31. package/src/mcp-server/server.ts +1 -1
  32. package/src/models/operations/bulkcreatedatapoints.ts +2 -2
  33. package/src/models/operations/createcontact.ts +2 -2
  34. package/src/models/operations/createdataset.ts +2 -2
  35. package/src/models/operations/createdatasetitem.ts +2 -2
  36. package/src/models/operations/createdatasource.ts +2 -2
  37. package/src/models/operations/fileget.ts +2 -2
  38. package/src/models/operations/filelist.ts +2 -2
  39. package/src/models/operations/fileupload.ts +2 -2
  40. package/src/models/operations/listdatasetdatapoints.ts +2 -2
  41. package/src/models/operations/listdatasets.ts +2 -2
  42. package/src/models/operations/listdatasources.ts +2 -2
  43. package/src/models/operations/retrievedatapoint.ts +2 -2
  44. package/src/models/operations/retrievedataset.ts +2 -2
  45. package/src/models/operations/retrievedatasource.ts +2 -2
  46. package/src/models/operations/updatedatapoint.ts +2 -2
  47. package/src/models/operations/updatedataset.ts +2 -2
  48. package/src/models/operations/updatedatasource.ts +2 -2
  49. package/packages/orq-rc/FUNCTIONS.md +0 -106
  50. package/packages/orq-rc/README.md +0 -698
  51. package/packages/orq-rc/RUNTIMES.md +0 -48
  52. package/packages/orq-rc/docs/sdks/contacts/README.md +0 -84
  53. package/packages/orq-rc/docs/sdks/datasets/README.md +0 -940
  54. package/packages/orq-rc/docs/sdks/deployments/README.md +0 -316
  55. package/packages/orq-rc/docs/sdks/feedback/README.md +0 -92
  56. package/packages/orq-rc/docs/sdks/files/README.md +0 -311
  57. package/packages/orq-rc/docs/sdks/knowledge/README.md +0 -1279
  58. package/packages/orq-rc/docs/sdks/metrics/README.md +0 -86
  59. package/packages/orq-rc/docs/sdks/orq/README.md +0 -10
  60. package/packages/orq-rc/docs/sdks/prompts/README.md +0 -614
  61. package/packages/orq-rc/docs/sdks/remoteconfigs/README.md +0 -80
  62. package/packages/orq-rc/jsr.json +0 -28
  63. package/packages/orq-rc/package-lock.json +0 -3217
  64. package/packages/orq-rc/package.json +0 -45
  65. package/packages/orq-rc/src/core.ts +0 -13
  66. package/packages/orq-rc/src/funcs/contactsCreate.ts +0 -154
  67. package/packages/orq-rc/src/funcs/datasetsClear.ts +0 -161
  68. package/packages/orq-rc/src/funcs/datasetsCreate.ts +0 -159
  69. package/packages/orq-rc/src/funcs/datasetsCreateDatapoint.ts +0 -161
  70. package/packages/orq-rc/src/funcs/datasetsCreateDatapoints.ts +0 -165
  71. package/packages/orq-rc/src/funcs/datasetsDelete.ts +0 -161
  72. package/packages/orq-rc/src/funcs/datasetsDeleteDatapoint.ts +0 -176
  73. package/packages/orq-rc/src/funcs/datasetsList.ts +0 -161
  74. package/packages/orq-rc/src/funcs/datasetsListDatapoints.ts +0 -168
  75. package/packages/orq-rc/src/funcs/datasetsRetrieve.ts +0 -169
  76. package/packages/orq-rc/src/funcs/datasetsRetrieveDatapoint.ts +0 -175
  77. package/packages/orq-rc/src/funcs/datasetsUpdate.ts +0 -170
  78. package/packages/orq-rc/src/funcs/datasetsUpdateDatapoint.ts +0 -173
  79. package/packages/orq-rc/src/funcs/deploymentsGetConfig.ts +0 -162
  80. package/packages/orq-rc/src/funcs/deploymentsInvoke.ts +0 -170
  81. package/packages/orq-rc/src/funcs/deploymentsList.ts +0 -170
  82. package/packages/orq-rc/src/funcs/deploymentsMetricsCreate.ts +0 -162
  83. package/packages/orq-rc/src/funcs/deploymentsStream.ts +0 -178
  84. package/packages/orq-rc/src/funcs/feedbackCreate.ts +0 -154
  85. package/packages/orq-rc/src/funcs/filesCreate.ts +0 -174
  86. package/packages/orq-rc/src/funcs/filesDelete.ts +0 -158
  87. package/packages/orq-rc/src/funcs/filesGet.ts +0 -160
  88. package/packages/orq-rc/src/funcs/filesList.ts +0 -161
  89. package/packages/orq-rc/src/funcs/knowledgeCreate.ts +0 -152
  90. package/packages/orq-rc/src/funcs/knowledgeCreateChunks.ts +0 -165
  91. package/packages/orq-rc/src/funcs/knowledgeCreateDatasource.ts +0 -160
  92. package/packages/orq-rc/src/funcs/knowledgeDelete.ts +0 -161
  93. package/packages/orq-rc/src/funcs/knowledgeDeleteChunk.ts +0 -168
  94. package/packages/orq-rc/src/funcs/knowledgeDeleteDatasource.ts +0 -167
  95. package/packages/orq-rc/src/funcs/knowledgeList.ts +0 -163
  96. package/packages/orq-rc/src/funcs/knowledgeListChunks.ts +0 -172
  97. package/packages/orq-rc/src/funcs/knowledgeListDatasources.ts +0 -168
  98. package/packages/orq-rc/src/funcs/knowledgeRetrieve.ts +0 -160
  99. package/packages/orq-rc/src/funcs/knowledgeRetrieveChunk.ts +0 -167
  100. package/packages/orq-rc/src/funcs/knowledgeRetrieveDatasource.ts +0 -163
  101. package/packages/orq-rc/src/funcs/knowledgeSearch.ts +0 -158
  102. package/packages/orq-rc/src/funcs/knowledgeUpdate.ts +0 -158
  103. package/packages/orq-rc/src/funcs/knowledgeUpdateChunk.ts +0 -168
  104. package/packages/orq-rc/src/funcs/knowledgeUpdateDatasource.ts +0 -164
  105. package/packages/orq-rc/src/funcs/promptsCreate.ts +0 -154
  106. package/packages/orq-rc/src/funcs/promptsDelete.ts +0 -158
  107. package/packages/orq-rc/src/funcs/promptsGetVersion.ts +0 -175
  108. package/packages/orq-rc/src/funcs/promptsList.ts +0 -161
  109. package/packages/orq-rc/src/funcs/promptsListVersions.ts +0 -167
  110. package/packages/orq-rc/src/funcs/promptsRetrieve.ts +0 -160
  111. package/packages/orq-rc/src/funcs/promptsUpdate.ts +0 -167
  112. package/packages/orq-rc/src/funcs/remoteconfigsRetrieve.ts +0 -155
  113. package/packages/orq-rc/src/hooks/global.ts +0 -44
  114. package/packages/orq-rc/src/hooks/hooks.ts +0 -132
  115. package/packages/orq-rc/src/hooks/index.ts +0 -6
  116. package/packages/orq-rc/src/hooks/registration.ts +0 -15
  117. package/packages/orq-rc/src/hooks/types.ts +0 -110
  118. package/packages/orq-rc/src/index.ts +0 -7
  119. package/packages/orq-rc/src/lib/base64.ts +0 -37
  120. package/packages/orq-rc/src/lib/config.ts +0 -70
  121. package/packages/orq-rc/src/lib/dlv.ts +0 -53
  122. package/packages/orq-rc/src/lib/encodings.ts +0 -483
  123. package/packages/orq-rc/src/lib/env.ts +0 -73
  124. package/packages/orq-rc/src/lib/event-streams.ts +0 -264
  125. package/packages/orq-rc/src/lib/files.ts +0 -40
  126. package/packages/orq-rc/src/lib/http.ts +0 -323
  127. package/packages/orq-rc/src/lib/is-plain-object.ts +0 -43
  128. package/packages/orq-rc/src/lib/logger.ts +0 -9
  129. package/packages/orq-rc/src/lib/matchers.ts +0 -325
  130. package/packages/orq-rc/src/lib/primitives.ts +0 -150
  131. package/packages/orq-rc/src/lib/retries.ts +0 -218
  132. package/packages/orq-rc/src/lib/schemas.ts +0 -91
  133. package/packages/orq-rc/src/lib/sdks.ts +0 -395
  134. package/packages/orq-rc/src/lib/security.ts +0 -261
  135. package/packages/orq-rc/src/lib/url.ts +0 -33
  136. package/packages/orq-rc/src/mcp-server/cli/start/command.ts +0 -125
  137. package/packages/orq-rc/src/mcp-server/cli/start/impl.ts +0 -140
  138. package/packages/orq-rc/src/mcp-server/cli.ts +0 -13
  139. package/packages/orq-rc/src/mcp-server/console-logger.ts +0 -71
  140. package/packages/orq-rc/src/mcp-server/extensions.ts +0 -17
  141. package/packages/orq-rc/src/mcp-server/mcp-server.ts +0 -26
  142. package/packages/orq-rc/src/mcp-server/prompts.ts +0 -110
  143. package/packages/orq-rc/src/mcp-server/resources.ts +0 -158
  144. package/packages/orq-rc/src/mcp-server/scopes.ts +0 -7
  145. package/packages/orq-rc/src/mcp-server/server.ts +0 -157
  146. package/packages/orq-rc/src/mcp-server/shared.ts +0 -75
  147. package/packages/orq-rc/src/mcp-server/tools/contactsCreate.ts +0 -37
  148. package/packages/orq-rc/src/mcp-server/tools/datasetsClear.ts +0 -35
  149. package/packages/orq-rc/src/mcp-server/tools/datasetsCreate.ts +0 -37
  150. package/packages/orq-rc/src/mcp-server/tools/datasetsCreateDatapoint.ts +0 -37
  151. package/packages/orq-rc/src/mcp-server/tools/datasetsCreateDatapoints.ts +0 -37
  152. package/packages/orq-rc/src/mcp-server/tools/datasetsDelete.ts +0 -35
  153. package/packages/orq-rc/src/mcp-server/tools/datasetsDeleteDatapoint.ts +0 -35
  154. package/packages/orq-rc/src/mcp-server/tools/datasetsList.ts +0 -37
  155. package/packages/orq-rc/src/mcp-server/tools/datasetsListDatapoints.ts +0 -37
  156. package/packages/orq-rc/src/mcp-server/tools/datasetsRetrieve.ts +0 -37
  157. package/packages/orq-rc/src/mcp-server/tools/datasetsRetrieveDatapoint.ts +0 -37
  158. package/packages/orq-rc/src/mcp-server/tools/datasetsUpdate.ts +0 -37
  159. package/packages/orq-rc/src/mcp-server/tools/datasetsUpdateDatapoint.ts +0 -35
  160. package/packages/orq-rc/src/mcp-server/tools/deploymentsGetConfig.ts +0 -37
  161. package/packages/orq-rc/src/mcp-server/tools/deploymentsInvoke.ts +0 -37
  162. package/packages/orq-rc/src/mcp-server/tools/deploymentsList.ts +0 -37
  163. package/packages/orq-rc/src/mcp-server/tools/deploymentsMetricsCreate.ts +0 -37
  164. package/packages/orq-rc/src/mcp-server/tools/deploymentsStream.ts +0 -37
  165. package/packages/orq-rc/src/mcp-server/tools/feedbackCreate.ts +0 -37
  166. package/packages/orq-rc/src/mcp-server/tools/filesCreate.ts +0 -37
  167. package/packages/orq-rc/src/mcp-server/tools/filesDelete.ts +0 -33
  168. package/packages/orq-rc/src/mcp-server/tools/filesGet.ts +0 -37
  169. package/packages/orq-rc/src/mcp-server/tools/filesList.ts +0 -37
  170. package/packages/orq-rc/src/mcp-server/tools/knowledgeCreate.ts +0 -35
  171. package/packages/orq-rc/src/mcp-server/tools/knowledgeCreateChunks.ts +0 -35
  172. package/packages/orq-rc/src/mcp-server/tools/knowledgeCreateDatasource.ts +0 -35
  173. package/packages/orq-rc/src/mcp-server/tools/knowledgeDelete.ts +0 -35
  174. package/packages/orq-rc/src/mcp-server/tools/knowledgeDeleteChunk.ts +0 -33
  175. package/packages/orq-rc/src/mcp-server/tools/knowledgeDeleteDatasource.ts +0 -35
  176. package/packages/orq-rc/src/mcp-server/tools/knowledgeList.ts +0 -37
  177. package/packages/orq-rc/src/mcp-server/tools/knowledgeListChunks.ts +0 -35
  178. package/packages/orq-rc/src/mcp-server/tools/knowledgeListDatasources.ts +0 -35
  179. package/packages/orq-rc/src/mcp-server/tools/knowledgeRetrieve.ts +0 -37
  180. package/packages/orq-rc/src/mcp-server/tools/knowledgeRetrieveChunk.ts +0 -35
  181. package/packages/orq-rc/src/mcp-server/tools/knowledgeRetrieveDatasource.ts +0 -35
  182. package/packages/orq-rc/src/mcp-server/tools/knowledgeSearch.ts +0 -35
  183. package/packages/orq-rc/src/mcp-server/tools/knowledgeUpdate.ts +0 -35
  184. package/packages/orq-rc/src/mcp-server/tools/knowledgeUpdateChunk.ts +0 -35
  185. package/packages/orq-rc/src/mcp-server/tools/knowledgeUpdateDatasource.ts +0 -35
  186. package/packages/orq-rc/src/mcp-server/tools/promptsCreate.ts +0 -35
  187. package/packages/orq-rc/src/mcp-server/tools/promptsDelete.ts +0 -33
  188. package/packages/orq-rc/src/mcp-server/tools/promptsGetVersion.ts +0 -37
  189. package/packages/orq-rc/src/mcp-server/tools/promptsList.ts +0 -37
  190. package/packages/orq-rc/src/mcp-server/tools/promptsListVersions.ts +0 -37
  191. package/packages/orq-rc/src/mcp-server/tools/promptsRetrieve.ts +0 -37
  192. package/packages/orq-rc/src/mcp-server/tools/promptsUpdate.ts +0 -35
  193. package/packages/orq-rc/src/mcp-server/tools/remoteconfigsRetrieve.ts +0 -36
  194. package/packages/orq-rc/src/mcp-server/tools.ts +0 -126
  195. package/packages/orq-rc/src/models/components/deployments.ts +0 -4164
  196. package/packages/orq-rc/src/models/components/index.ts +0 -6
  197. package/packages/orq-rc/src/models/components/security.ts +0 -71
  198. package/packages/orq-rc/src/models/errors/apierror.ts +0 -27
  199. package/packages/orq-rc/src/models/errors/getpromptversion.ts +0 -71
  200. package/packages/orq-rc/src/models/errors/honoapierror.ts +0 -82
  201. package/packages/orq-rc/src/models/errors/httpclienterrors.ts +0 -62
  202. package/packages/orq-rc/src/models/errors/index.ts +0 -10
  203. package/packages/orq-rc/src/models/errors/sdkvalidationerror.ts +0 -97
  204. package/packages/orq-rc/src/models/errors/updateprompt.ts +0 -71
  205. package/packages/orq-rc/src/models/operations/bulkcreatedatapoints.ts +0 -1816
  206. package/packages/orq-rc/src/models/operations/cleardataset.ts +0 -75
  207. package/packages/orq-rc/src/models/operations/createchunk.ts +0 -680
  208. package/packages/orq-rc/src/models/operations/createcontact.ts +0 -256
  209. package/packages/orq-rc/src/models/operations/createdataset.ts +0 -296
  210. package/packages/orq-rc/src/models/operations/createdatasetitem.ts +0 -1740
  211. package/packages/orq-rc/src/models/operations/createdatasource.ts +0 -852
  212. package/packages/orq-rc/src/models/operations/createfeedback.ts +0 -286
  213. package/packages/orq-rc/src/models/operations/createknowledge.ts +0 -676
  214. package/packages/orq-rc/src/models/operations/createprompt.ts +0 -3743
  215. package/packages/orq-rc/src/models/operations/deletechunk.ts +0 -96
  216. package/packages/orq-rc/src/models/operations/deletedatapoint.ts +0 -81
  217. package/packages/orq-rc/src/models/operations/deletedataset.ts +0 -75
  218. package/packages/orq-rc/src/models/operations/deletedatasource.ts +0 -87
  219. package/packages/orq-rc/src/models/operations/deleteknowledge.ts +0 -78
  220. package/packages/orq-rc/src/models/operations/deleteprompt.ts +0 -69
  221. package/packages/orq-rc/src/models/operations/deploymentcreatemetric.ts +0 -4936
  222. package/packages/orq-rc/src/models/operations/deploymentgetconfig.ts +0 -6090
  223. package/packages/orq-rc/src/models/operations/deploymentinvoke.ts +0 -1199
  224. package/packages/orq-rc/src/models/operations/deployments.ts +0 -2155
  225. package/packages/orq-rc/src/models/operations/deploymentstream.ts +0 -5960
  226. package/packages/orq-rc/src/models/operations/filedelete.ts +0 -78
  227. package/packages/orq-rc/src/models/operations/fileget.ts +0 -223
  228. package/packages/orq-rc/src/models/operations/filelist.ts +0 -337
  229. package/packages/orq-rc/src/models/operations/fileupload.ts +0 -324
  230. package/packages/orq-rc/src/models/operations/getallprompts.ts +0 -2127
  231. package/packages/orq-rc/src/models/operations/getonechunk.ts +0 -265
  232. package/packages/orq-rc/src/models/operations/getoneknowledge.ts +0 -444
  233. package/packages/orq-rc/src/models/operations/getoneprompt.ts +0 -1993
  234. package/packages/orq-rc/src/models/operations/getpromptversion.ts +0 -1991
  235. package/packages/orq-rc/src/models/operations/index.ts +0 -51
  236. package/packages/orq-rc/src/models/operations/listchunks.ts +0 -444
  237. package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +0 -1071
  238. package/packages/orq-rc/src/models/operations/listdatasets.ts +0 -406
  239. package/packages/orq-rc/src/models/operations/listdatasources.ts +0 -447
  240. package/packages/orq-rc/src/models/operations/listknowledgebases.ts +0 -568
  241. package/packages/orq-rc/src/models/operations/listpromptversions.ts +0 -2125
  242. package/packages/orq-rc/src/models/operations/remoteconfigsgetconfig.ts +0 -190
  243. package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +0 -924
  244. package/packages/orq-rc/src/models/operations/retrievedataset.ts +0 -288
  245. package/packages/orq-rc/src/models/operations/retrievedatasource.ts +0 -273
  246. package/packages/orq-rc/src/models/operations/searchknowledge.ts +0 -1673
  247. package/packages/orq-rc/src/models/operations/updatechunk.ts +0 -418
  248. package/packages/orq-rc/src/models/operations/updatedatapoint.ts +0 -1729
  249. package/packages/orq-rc/src/models/operations/updatedataset.ts +0 -393
  250. package/packages/orq-rc/src/models/operations/updatedatasource.ts +0 -345
  251. package/packages/orq-rc/src/models/operations/updateknowledge.ts +0 -790
  252. package/packages/orq-rc/src/models/operations/updateprompt.ts +0 -3929
  253. package/packages/orq-rc/src/sdk/contacts.ts +0 -27
  254. package/packages/orq-rc/src/sdk/datasets.ts +0 -222
  255. package/packages/orq-rc/src/sdk/deployments.ts +0 -89
  256. package/packages/orq-rc/src/sdk/feedback.ts +0 -27
  257. package/packages/orq-rc/src/sdk/files.ts +0 -78
  258. package/packages/orq-rc/src/sdk/index.ts +0 -5
  259. package/packages/orq-rc/src/sdk/knowledge.ts +0 -261
  260. package/packages/orq-rc/src/sdk/metrics.ts +0 -27
  261. package/packages/orq-rc/src/sdk/prompts.ts +0 -126
  262. package/packages/orq-rc/src/sdk/remoteconfigs.ts +0 -24
  263. package/packages/orq-rc/src/sdk/sdk.ts +0 -55
  264. package/packages/orq-rc/src/types/async.ts +0 -68
  265. package/packages/orq-rc/src/types/blobs.ts +0 -31
  266. package/packages/orq-rc/src/types/constdatetime.ts +0 -15
  267. package/packages/orq-rc/src/types/enums.ts +0 -16
  268. package/packages/orq-rc/src/types/fp.ts +0 -50
  269. package/packages/orq-rc/src/types/index.ts +0 -11
  270. package/packages/orq-rc/src/types/operations.ts +0 -105
  271. package/packages/orq-rc/src/types/rfcdate.ts +0 -54
  272. package/packages/orq-rc/src/types/streams.ts +0 -21
  273. package/packages/orq-rc/tsconfig.json +0 -41
@@ -1,698 +0,0 @@
1
- # @orq-ai/node
2
-
3
- Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@orq-ai/node* API.
4
-
5
- <div align="left">
6
- <a href="https://www.speakeasy.com/?utm_source=@orq-ai/node&utm_campaign=typescript"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
7
- <a href="https://opensource.org/licenses/MIT">
8
- <img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
9
- </a>
10
- </div>
11
-
12
- <!-- Start Summary [summary] -->
13
- ## Summary
14
-
15
- [Dev] orq.ai API: orq.ai API documentation
16
-
17
- For more information about the API: [orq.ai Documentation](https://docs.orq.ai)
18
- <!-- End Summary [summary] -->
19
-
20
- <!-- Start Table of Contents [toc] -->
21
- ## Table of Contents
22
- <!-- $toc-max-depth=2 -->
23
- * [@orq-ai/node](#orq-ainode)
24
- * [SDK Installation](#sdk-installation)
25
- * [Requirements](#requirements)
26
- * [SDK Example Usage](#sdk-example-usage)
27
- * [Authentication](#authentication)
28
- * [Available Resources and Operations](#available-resources-and-operations)
29
- * [Standalone functions](#standalone-functions)
30
- * [Server-sent event streaming](#server-sent-event-streaming)
31
- * [File uploads](#file-uploads)
32
- * [Retries](#retries)
33
- * [Error Handling](#error-handling)
34
- * [Server Selection](#server-selection)
35
- * [Custom HTTP Client](#custom-http-client)
36
- * [Debugging](#debugging)
37
- * [Development](#development)
38
- * [Maturity](#maturity)
39
- * [Contributions](#contributions)
40
-
41
- <!-- End Table of Contents [toc] -->
42
-
43
- <!-- Start SDK Installation [installation] -->
44
- ## SDK Installation
45
-
46
- The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
47
-
48
- ### NPM
49
-
50
- ```bash
51
- npm add @orq-ai/node
52
- ```
53
-
54
- ### PNPM
55
-
56
- ```bash
57
- pnpm add @orq-ai/node
58
- ```
59
-
60
- ### Bun
61
-
62
- ```bash
63
- bun add @orq-ai/node
64
- ```
65
-
66
- ### Yarn
67
-
68
- ```bash
69
- yarn add @orq-ai/node zod
70
-
71
- # Note that Yarn does not install peer dependencies automatically. You will need
72
- # to install zod as shown above.
73
- ```
74
-
75
-
76
-
77
- ### Model Context Protocol (MCP) Server
78
-
79
- This SDK is also an installable MCP server where the various SDK methods are
80
- exposed as tools that can be invoked by AI applications.
81
-
82
- > Node.js v20 or greater is required to run the MCP server from npm.
83
-
84
- <details>
85
- <summary>Claude installation steps</summary>
86
-
87
- Add the following server definition to your `claude_desktop_config.json` file:
88
-
89
- ```json
90
- {
91
- "mcpServers": {
92
- "Orq": {
93
- "command": "npx",
94
- "args": [
95
- "-y", "--package", "@orq-ai/node",
96
- "--",
97
- "mcp", "start",
98
- "--api-key", "...",
99
- "--contact-id", "...",
100
- "--environment", "..."
101
- ]
102
- }
103
- }
104
- }
105
- ```
106
-
107
- </details>
108
-
109
- <details>
110
- <summary>Cursor installation steps</summary>
111
-
112
- Create a `.cursor/mcp.json` file in your project root with the following content:
113
-
114
- ```json
115
- {
116
- "mcpServers": {
117
- "Orq": {
118
- "command": "npx",
119
- "args": [
120
- "-y", "--package", "@orq-ai/node",
121
- "--",
122
- "mcp", "start",
123
- "--api-key", "...",
124
- "--contact-id", "...",
125
- "--environment", "..."
126
- ]
127
- }
128
- }
129
- }
130
- ```
131
-
132
- </details>
133
-
134
- You can also run MCP servers as a standalone binary with no additional dependencies. You must pull these binaries from available Github releases:
135
-
136
- ```bash
137
- curl -L -o mcp-server \
138
- https://github.com/{org}/{repo}/releases/download/{tag}/mcp-server-bun-darwin-arm64 && \
139
- chmod +x mcp-server
140
- ```
141
-
142
- If the repo is a private repo you must add your Github PAT to download a release `-H "Authorization: Bearer {GITHUB_PAT}"`.
143
-
144
-
145
- ```json
146
- {
147
- "mcpServers": {
148
- "Todos": {
149
- "command": "./DOWNLOAD/PATH/mcp-server",
150
- "args": [
151
- "start"
152
- ]
153
- }
154
- }
155
- }
156
- ```
157
-
158
- For a full list of server arguments, run:
159
-
160
- ```sh
161
- npx -y --package @orq-ai/node -- mcp start --help
162
- ```
163
- <!-- End SDK Installation [installation] -->
164
-
165
- <!-- Start Requirements [requirements] -->
166
- ## Requirements
167
-
168
- For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
169
- <!-- End Requirements [requirements] -->
170
-
171
- <!-- Start SDK Example Usage [usage] -->
172
- ## SDK Example Usage
173
-
174
- ### Example
175
-
176
- ```typescript
177
- import { Orq } from "@orq-ai/node";
178
-
179
- const orq = new Orq({
180
- apiKey: process.env["ORQ_API_KEY"] ?? "",
181
- });
182
-
183
- async function run() {
184
- const result = await orq.contacts.create({
185
- externalId: "<id>",
186
- });
187
-
188
- // Handle the result
189
- console.log(result);
190
- }
191
-
192
- run();
193
-
194
- ```
195
- <!-- End SDK Example Usage [usage] -->
196
-
197
- <!-- Start Authentication [security] -->
198
- ## Authentication
199
-
200
- ### Per-Client Security Schemes
201
-
202
- This SDK supports the following security scheme globally:
203
-
204
- | Name | Type | Scheme | Environment Variable |
205
- | -------- | ---- | ----------- | -------------------- |
206
- | `apiKey` | http | HTTP Bearer | `ORQ_API_KEY` |
207
-
208
- To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
209
- ```typescript
210
- import { Orq } from "@orq-ai/node";
211
-
212
- const orq = new Orq({
213
- apiKey: process.env["ORQ_API_KEY"] ?? "",
214
- });
215
-
216
- async function run() {
217
- const result = await orq.contacts.create({
218
- externalId: "<id>",
219
- });
220
-
221
- // Handle the result
222
- console.log(result);
223
- }
224
-
225
- run();
226
-
227
- ```
228
- <!-- End Authentication [security] -->
229
-
230
- <!-- Start Available Resources and Operations [operations] -->
231
- ## Available Resources and Operations
232
-
233
- <details open>
234
- <summary>Available methods</summary>
235
-
236
- ### [contacts](docs/sdks/contacts/README.md)
237
-
238
- * [create](docs/sdks/contacts/README.md#create) - Update user information
239
-
240
- ### [datasets](docs/sdks/datasets/README.md)
241
-
242
- * [list](docs/sdks/datasets/README.md#list) - List datasets
243
- * [create](docs/sdks/datasets/README.md#create) - Create a dataset
244
- * [retrieve](docs/sdks/datasets/README.md#retrieve) - Retrieve a dataset
245
- * [update](docs/sdks/datasets/README.md#update) - Update a dataset
246
- * [delete](docs/sdks/datasets/README.md#delete) - Delete a dataset
247
- * [listDatapoints](docs/sdks/datasets/README.md#listdatapoints) - List datapoints
248
- * [createDatapoint](docs/sdks/datasets/README.md#createdatapoint) - Create a datapoint
249
- * [retrieveDatapoint](docs/sdks/datasets/README.md#retrievedatapoint) - Retrieve a datapoint
250
- * [updateDatapoint](docs/sdks/datasets/README.md#updatedatapoint) - Update a datapoint
251
- * [deleteDatapoint](docs/sdks/datasets/README.md#deletedatapoint) - Delete a datapoint
252
- * [createDatapoints](docs/sdks/datasets/README.md#createdatapoints) - Create multiple datapoints
253
- * [clear](docs/sdks/datasets/README.md#clear) - Delete all datapoints
254
-
255
- ### [deployments](docs/sdks/deployments/README.md)
256
-
257
- * [list](docs/sdks/deployments/README.md#list) - List all deployments
258
- * [getConfig](docs/sdks/deployments/README.md#getconfig) - Get config
259
- * [invoke](docs/sdks/deployments/README.md#invoke) - Invoke
260
- * [stream](docs/sdks/deployments/README.md#stream) - Stream
261
-
262
- #### [deployments.metrics](docs/sdks/metrics/README.md)
263
-
264
- * [create](docs/sdks/metrics/README.md#create) - Add metrics
265
-
266
- ### [feedback](docs/sdks/feedback/README.md)
267
-
268
- * [create](docs/sdks/feedback/README.md#create) - Submit feedback
269
-
270
- ### [files](docs/sdks/files/README.md)
271
-
272
- * [create](docs/sdks/files/README.md#create) - Create file
273
- * [list](docs/sdks/files/README.md#list) - List all files
274
- * [get](docs/sdks/files/README.md#get) - Retrieve a file
275
- * [delete](docs/sdks/files/README.md#delete) - Delete file
276
-
277
- ### [knowledge](docs/sdks/knowledge/README.md)
278
-
279
- * [list](docs/sdks/knowledge/README.md#list) - List all knowledge bases
280
- * [create](docs/sdks/knowledge/README.md#create) - Create a knowledge
281
- * [retrieve](docs/sdks/knowledge/README.md#retrieve) - Retrieves a knowledge base
282
- * [update](docs/sdks/knowledge/README.md#update) - Updates a knowledge
283
- * [delete](docs/sdks/knowledge/README.md#delete) - Deletes a knowledge
284
- * [search](docs/sdks/knowledge/README.md#search) - Retrieves the documents used for retrieval
285
- * [listDatasources](docs/sdks/knowledge/README.md#listdatasources) - List all datasources
286
- * [createDatasource](docs/sdks/knowledge/README.md#createdatasource) - Create a new datasource
287
- * [retrieveDatasource](docs/sdks/knowledge/README.md#retrievedatasource) - Retrieve a datasource
288
- * [deleteDatasource](docs/sdks/knowledge/README.md#deletedatasource) - Deletes a datasource
289
- * [updateDatasource](docs/sdks/knowledge/README.md#updatedatasource) - Update a datasource
290
- * [createChunks](docs/sdks/knowledge/README.md#createchunks) - Create chunks for a datasource
291
- * [listChunks](docs/sdks/knowledge/README.md#listchunks) - List all chunks for a datasource
292
- * [updateChunk](docs/sdks/knowledge/README.md#updatechunk) - Update a chunk
293
- * [deleteChunk](docs/sdks/knowledge/README.md#deletechunk) - Delete a chunk
294
- * [retrieveChunk](docs/sdks/knowledge/README.md#retrievechunk) - Retrieve a chunk
295
-
296
-
297
- ### [prompts](docs/sdks/prompts/README.md)
298
-
299
- * [list](docs/sdks/prompts/README.md#list) - List all prompts
300
- * [create](docs/sdks/prompts/README.md#create) - Create a prompt
301
- * [retrieve](docs/sdks/prompts/README.md#retrieve) - Retrieve a prompt
302
- * [update](docs/sdks/prompts/README.md#update) - Update a prompt
303
- * [delete](docs/sdks/prompts/README.md#delete) - Delete a prompt
304
- * [listVersions](docs/sdks/prompts/README.md#listversions) - List all prompt versions
305
- * [getVersion](docs/sdks/prompts/README.md#getversion) - Retrieve a prompt version
306
-
307
- ### [remoteconfigs](docs/sdks/remoteconfigs/README.md)
308
-
309
- * [retrieve](docs/sdks/remoteconfigs/README.md#retrieve) - Retrieve a remote config
310
-
311
- </details>
312
- <!-- End Available Resources and Operations [operations] -->
313
-
314
- <!-- Start Standalone functions [standalone-funcs] -->
315
- ## Standalone functions
316
-
317
- All the methods listed above are available as standalone functions. These
318
- functions are ideal for use in applications running in the browser, serverless
319
- runtimes or other environments where application bundle size is a primary
320
- concern. When using a bundler to build your application, all unused
321
- functionality will be either excluded from the final bundle or tree-shaken away.
322
-
323
- To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
324
-
325
- <details>
326
-
327
- <summary>Available standalone functions</summary>
328
-
329
- - [`contactsCreate`](docs/sdks/contacts/README.md#create) - Update user information
330
- - [`datasetsClear`](docs/sdks/datasets/README.md#clear) - Delete all datapoints
331
- - [`datasetsCreate`](docs/sdks/datasets/README.md#create) - Create a dataset
332
- - [`datasetsCreateDatapoint`](docs/sdks/datasets/README.md#createdatapoint) - Create a datapoint
333
- - [`datasetsCreateDatapoints`](docs/sdks/datasets/README.md#createdatapoints) - Create multiple datapoints
334
- - [`datasetsDelete`](docs/sdks/datasets/README.md#delete) - Delete a dataset
335
- - [`datasetsDeleteDatapoint`](docs/sdks/datasets/README.md#deletedatapoint) - Delete a datapoint
336
- - [`datasetsList`](docs/sdks/datasets/README.md#list) - List datasets
337
- - [`datasetsListDatapoints`](docs/sdks/datasets/README.md#listdatapoints) - List datapoints
338
- - [`datasetsRetrieve`](docs/sdks/datasets/README.md#retrieve) - Retrieve a dataset
339
- - [`datasetsRetrieveDatapoint`](docs/sdks/datasets/README.md#retrievedatapoint) - Retrieve a datapoint
340
- - [`datasetsUpdate`](docs/sdks/datasets/README.md#update) - Update a dataset
341
- - [`datasetsUpdateDatapoint`](docs/sdks/datasets/README.md#updatedatapoint) - Update a datapoint
342
- - [`deploymentsGetConfig`](docs/sdks/deployments/README.md#getconfig) - Get config
343
- - [`deploymentsInvoke`](docs/sdks/deployments/README.md#invoke) - Invoke
344
- - [`deploymentsList`](docs/sdks/deployments/README.md#list) - List all deployments
345
- - [`deploymentsMetricsCreate`](docs/sdks/metrics/README.md#create) - Add metrics
346
- - [`deploymentsStream`](docs/sdks/deployments/README.md#stream) - Stream
347
- - [`feedbackCreate`](docs/sdks/feedback/README.md#create) - Submit feedback
348
- - [`filesCreate`](docs/sdks/files/README.md#create) - Create file
349
- - [`filesDelete`](docs/sdks/files/README.md#delete) - Delete file
350
- - [`filesGet`](docs/sdks/files/README.md#get) - Retrieve a file
351
- - [`filesList`](docs/sdks/files/README.md#list) - List all files
352
- - [`knowledgeCreate`](docs/sdks/knowledge/README.md#create) - Create a knowledge
353
- - [`knowledgeCreateChunks`](docs/sdks/knowledge/README.md#createchunks) - Create chunks for a datasource
354
- - [`knowledgeCreateDatasource`](docs/sdks/knowledge/README.md#createdatasource) - Create a new datasource
355
- - [`knowledgeDelete`](docs/sdks/knowledge/README.md#delete) - Deletes a knowledge
356
- - [`knowledgeDeleteChunk`](docs/sdks/knowledge/README.md#deletechunk) - Delete a chunk
357
- - [`knowledgeDeleteDatasource`](docs/sdks/knowledge/README.md#deletedatasource) - Deletes a datasource
358
- - [`knowledgeList`](docs/sdks/knowledge/README.md#list) - List all knowledge bases
359
- - [`knowledgeListChunks`](docs/sdks/knowledge/README.md#listchunks) - List all chunks for a datasource
360
- - [`knowledgeListDatasources`](docs/sdks/knowledge/README.md#listdatasources) - List all datasources
361
- - [`knowledgeRetrieve`](docs/sdks/knowledge/README.md#retrieve) - Retrieves a knowledge base
362
- - [`knowledgeRetrieveChunk`](docs/sdks/knowledge/README.md#retrievechunk) - Retrieve a chunk
363
- - [`knowledgeRetrieveDatasource`](docs/sdks/knowledge/README.md#retrievedatasource) - Retrieve a datasource
364
- - [`knowledgeSearch`](docs/sdks/knowledge/README.md#search) - Retrieves the documents used for retrieval
365
- - [`knowledgeUpdate`](docs/sdks/knowledge/README.md#update) - Updates a knowledge
366
- - [`knowledgeUpdateChunk`](docs/sdks/knowledge/README.md#updatechunk) - Update a chunk
367
- - [`knowledgeUpdateDatasource`](docs/sdks/knowledge/README.md#updatedatasource) - Update a datasource
368
- - [`promptsCreate`](docs/sdks/prompts/README.md#create) - Create a prompt
369
- - [`promptsDelete`](docs/sdks/prompts/README.md#delete) - Delete a prompt
370
- - [`promptsGetVersion`](docs/sdks/prompts/README.md#getversion) - Retrieve a prompt version
371
- - [`promptsList`](docs/sdks/prompts/README.md#list) - List all prompts
372
- - [`promptsListVersions`](docs/sdks/prompts/README.md#listversions) - List all prompt versions
373
- - [`promptsRetrieve`](docs/sdks/prompts/README.md#retrieve) - Retrieve a prompt
374
- - [`promptsUpdate`](docs/sdks/prompts/README.md#update) - Update a prompt
375
- - [`remoteconfigsRetrieve`](docs/sdks/remoteconfigs/README.md#retrieve) - Retrieve a remote config
376
-
377
- </details>
378
- <!-- End Standalone functions [standalone-funcs] -->
379
-
380
- <!-- Start Server-sent event streaming [eventstream] -->
381
- ## Server-sent event streaming
382
-
383
- [Server-sent events][mdn-sse] are used to stream content from certain
384
- operations. These operations will expose the stream as an async iterable that
385
- can be consumed using a [`for await...of`][mdn-for-await-of] loop. The loop will
386
- terminate when the server no longer has any events to send and closes the
387
- underlying connection.
388
-
389
- ```typescript
390
- import { Orq } from "@orq-ai/node";
391
-
392
- const orq = new Orq({
393
- apiKey: process.env["ORQ_API_KEY"] ?? "",
394
- });
395
-
396
- async function run() {
397
- const result = await orq.deployments.stream({
398
- key: "<key>",
399
- });
400
-
401
- for await (const event of result) {
402
- // Handle the event
403
- console.log(event);
404
- }
405
- }
406
-
407
- run();
408
-
409
- ```
410
-
411
- [mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
412
- [mdn-for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
413
- <!-- End Server-sent event streaming [eventstream] -->
414
-
415
- <!-- Start File uploads [file-upload] -->
416
- ## File uploads
417
-
418
- Certain SDK methods accept files as part of a multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
419
-
420
- > [!TIP]
421
- >
422
- > Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
423
- >
424
- > - **Node.js v20+:** Since v20, Node.js comes with a native `openAsBlob` function in [`node:fs`](https://nodejs.org/docs/latest-v20.x/api/fs.html#fsopenasblobpath-options).
425
- > - **Bun:** The native [`Bun.file`](https://bun.sh/docs/api/file-io#reading-files-bun-file) function produces a file handle that can be used for streaming file uploads.
426
- > - **Browsers:** All supported browsers return an instance to a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) when reading the value from an `<input type="file">` element.
427
- > - **Node.js v18:** A file stream can be created using the `fileFrom` helper from [`fetch-blob/from.js`](https://www.npmjs.com/package/fetch-blob).
428
-
429
- ```typescript
430
- import { Orq } from "@orq-ai/node";
431
- import { openAsBlob } from "node:fs";
432
-
433
- const orq = new Orq({
434
- apiKey: process.env["ORQ_API_KEY"] ?? "",
435
- });
436
-
437
- async function run() {
438
- const result = await orq.files.create({
439
- file: await openAsBlob("example.file"),
440
- });
441
-
442
- // Handle the result
443
- console.log(result);
444
- }
445
-
446
- run();
447
-
448
- ```
449
- <!-- End File uploads [file-upload] -->
450
-
451
- <!-- Start Retries [retries] -->
452
- ## Retries
453
-
454
- Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
455
-
456
- To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
457
- ```typescript
458
- import { Orq } from "@orq-ai/node";
459
-
460
- const orq = new Orq({
461
- apiKey: process.env["ORQ_API_KEY"] ?? "",
462
- });
463
-
464
- async function run() {
465
- const result = await orq.contacts.create({
466
- externalId: "<id>",
467
- }, {
468
- retries: {
469
- strategy: "backoff",
470
- backoff: {
471
- initialInterval: 1,
472
- maxInterval: 50,
473
- exponent: 1.1,
474
- maxElapsedTime: 100,
475
- },
476
- retryConnectionErrors: false,
477
- },
478
- });
479
-
480
- // Handle the result
481
- console.log(result);
482
- }
483
-
484
- run();
485
-
486
- ```
487
-
488
- If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
489
- ```typescript
490
- import { Orq } from "@orq-ai/node";
491
-
492
- const orq = new Orq({
493
- retryConfig: {
494
- strategy: "backoff",
495
- backoff: {
496
- initialInterval: 1,
497
- maxInterval: 50,
498
- exponent: 1.1,
499
- maxElapsedTime: 100,
500
- },
501
- retryConnectionErrors: false,
502
- },
503
- apiKey: process.env["ORQ_API_KEY"] ?? "",
504
- });
505
-
506
- async function run() {
507
- const result = await orq.contacts.create({
508
- externalId: "<id>",
509
- });
510
-
511
- // Handle the result
512
- console.log(result);
513
- }
514
-
515
- run();
516
-
517
- ```
518
- <!-- End Retries [retries] -->
519
-
520
- <!-- Start Error Handling [errors] -->
521
- ## Error Handling
522
-
523
- Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `list` method may throw the following errors:
524
-
525
- | Error Type | Status Code | Content Type |
526
- | ------------------- | ----------- | ---------------- |
527
- | errors.HonoApiError | 500 | application/json |
528
- | errors.APIError | 4XX, 5XX | \*/\* |
529
-
530
- If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
531
-
532
- ```typescript
533
- import { Orq } from "@orq-ai/node";
534
- import { HonoApiError, SDKValidationError } from "@orq-ai/node/models/errors";
535
-
536
- const orq = new Orq({
537
- apiKey: process.env["ORQ_API_KEY"] ?? "",
538
- });
539
-
540
- async function run() {
541
- let result;
542
- try {
543
- result = await orq.deployments.list({});
544
-
545
- // Handle the result
546
- console.log(result);
547
- } catch (err) {
548
- switch (true) {
549
- // The server response does not match the expected SDK schema
550
- case (err instanceof SDKValidationError): {
551
- // Pretty-print will provide a human-readable multi-line error message
552
- console.error(err.pretty());
553
- // Raw value may also be inspected
554
- console.error(err.rawValue);
555
- return;
556
- }
557
- case (err instanceof HonoApiError): {
558
- // Handle err.data$: HonoApiErrorData
559
- console.error(err);
560
- return;
561
- }
562
- default: {
563
- // Other errors such as network errors, see HTTPClientErrors for more details
564
- throw err;
565
- }
566
- }
567
- }
568
- }
569
-
570
- run();
571
-
572
- ```
573
-
574
- Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
575
-
576
- In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
577
-
578
- | HTTP Client Error | Description |
579
- | ---------------------------------------------------- | ---------------------------------------------------- |
580
- | RequestAbortedError | HTTP request was aborted by the client |
581
- | RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
582
- | ConnectionError | HTTP client was unable to make a request to a server |
583
- | InvalidRequestError | Any input used to create a request is invalid |
584
- | UnexpectedClientError | Unrecognised or unexpected error |
585
- <!-- End Error Handling [errors] -->
586
-
587
- <!-- Start Server Selection [server] -->
588
- ## Server Selection
589
-
590
- ### Override Server URL Per-Client
591
-
592
- The default server can be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
593
- ```typescript
594
- import { Orq } from "@orq-ai/node";
595
-
596
- const orq = new Orq({
597
- serverURL: "https://my.orq.ai",
598
- apiKey: process.env["ORQ_API_KEY"] ?? "",
599
- });
600
-
601
- async function run() {
602
- const result = await orq.contacts.create({
603
- externalId: "<id>",
604
- });
605
-
606
- // Handle the result
607
- console.log(result);
608
- }
609
-
610
- run();
611
-
612
- ```
613
- <!-- End Server Selection [server] -->
614
-
615
- <!-- Start Custom HTTP Client [http-client] -->
616
- ## Custom HTTP Client
617
-
618
- The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
619
- [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
620
- client is a thin wrapper around `fetch` and provides the ability to attach hooks
621
- around the request lifecycle that can be used to modify the request or handle
622
- errors and response.
623
-
624
- The `HTTPClient` constructor takes an optional `fetcher` argument that can be
625
- used to integrate a third-party HTTP client or when writing tests to mock out
626
- the HTTP client and feed in fixtures.
627
-
628
- The following example shows how to use the `"beforeRequest"` hook to to add a
629
- custom header and a timeout to requests and how to use the `"requestError"` hook
630
- to log errors:
631
-
632
- ```typescript
633
- import { Orq } from "@orq-ai/node";
634
- import { HTTPClient } from "@orq-ai/node/lib/http";
635
-
636
- const httpClient = new HTTPClient({
637
- // fetcher takes a function that has the same signature as native `fetch`.
638
- fetcher: (request) => {
639
- return fetch(request);
640
- }
641
- });
642
-
643
- httpClient.addHook("beforeRequest", (request) => {
644
- const nextRequest = new Request(request, {
645
- signal: request.signal || AbortSignal.timeout(5000)
646
- });
647
-
648
- nextRequest.headers.set("x-custom-header", "custom value");
649
-
650
- return nextRequest;
651
- });
652
-
653
- httpClient.addHook("requestError", (error, request) => {
654
- console.group("Request Error");
655
- console.log("Reason:", `${error}`);
656
- console.log("Endpoint:", `${request.method} ${request.url}`);
657
- console.groupEnd();
658
- });
659
-
660
- const sdk = new Orq({ httpClient });
661
- ```
662
- <!-- End Custom HTTP Client [http-client] -->
663
-
664
- <!-- Start Debugging [debug] -->
665
- ## Debugging
666
-
667
- You can setup your SDK to emit debug logs for SDK requests and responses.
668
-
669
- You can pass a logger that matches `console`'s interface as an SDK option.
670
-
671
- > [!WARNING]
672
- > Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
673
-
674
- ```typescript
675
- import { Orq } from "@orq-ai/node";
676
-
677
- const sdk = new Orq({ debugLogger: console });
678
- ```
679
-
680
- You can also enable a default debug logger by setting an environment variable `ORQ_DEBUG` to true.
681
- <!-- End Debugging [debug] -->
682
-
683
- <!-- Placeholder for Future Speakeasy SDK Sections -->
684
-
685
- # Development
686
-
687
- ## Maturity
688
-
689
- This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
690
- to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
691
- looking for the latest version.
692
-
693
- ## Contributions
694
-
695
- While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
696
- We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
697
-
698
- ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=@orq-ai/node&utm_campaign=typescript)