@orq-ai/node 3.2.8 → 3.3.0-rc.1

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 (215) hide show
  1. package/bin/mcp-server.js +32 -35
  2. package/bin/mcp-server.js.map +20 -20
  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/fileget.js +2 -2
  16. package/models/operations/filelist.js +2 -2
  17. package/models/operations/fileupload.js +2 -2
  18. package/models/operations/listdatasetdatapoints.js +2 -2
  19. package/models/operations/listdatasets.js +2 -2
  20. package/models/operations/retrievedatapoint.js +2 -2
  21. package/models/operations/retrievedataset.js +2 -2
  22. package/models/operations/updatedatapoint.js +2 -2
  23. package/models/operations/updatedataset.js +2 -2
  24. package/package.json +3 -2
  25. package/src/lib/config.ts +2 -2
  26. package/src/mcp-server/mcp-server.ts +1 -1
  27. package/src/mcp-server/server.ts +1 -1
  28. package/src/models/operations/bulkcreatedatapoints.ts +2 -2
  29. package/src/models/operations/createcontact.ts +2 -2
  30. package/src/models/operations/createdataset.ts +2 -2
  31. package/src/models/operations/createdatasetitem.ts +2 -2
  32. package/src/models/operations/fileget.ts +2 -2
  33. package/src/models/operations/filelist.ts +2 -2
  34. package/src/models/operations/fileupload.ts +2 -2
  35. package/src/models/operations/listdatasetdatapoints.ts +2 -2
  36. package/src/models/operations/listdatasets.ts +2 -2
  37. package/src/models/operations/retrievedatapoint.ts +2 -2
  38. package/src/models/operations/retrievedataset.ts +2 -2
  39. package/src/models/operations/updatedatapoint.ts +2 -2
  40. package/src/models/operations/updatedataset.ts +2 -2
  41. package/packages/orq-rc/FUNCTIONS.md +0 -106
  42. package/packages/orq-rc/README.md +0 -660
  43. package/packages/orq-rc/RUNTIMES.md +0 -48
  44. package/packages/orq-rc/docs/sdks/contacts/README.md +0 -84
  45. package/packages/orq-rc/docs/sdks/datasets/README.md +0 -934
  46. package/packages/orq-rc/docs/sdks/deployments/README.md +0 -316
  47. package/packages/orq-rc/docs/sdks/feedback/README.md +0 -92
  48. package/packages/orq-rc/docs/sdks/files/README.md +0 -305
  49. package/packages/orq-rc/docs/sdks/metrics/README.md +0 -86
  50. package/packages/orq-rc/docs/sdks/orq/README.md +0 -10
  51. package/packages/orq-rc/docs/sdks/prompts/README.md +0 -608
  52. package/packages/orq-rc/docs/sdks/remoteconfigs/README.md +0 -80
  53. package/packages/orq-rc/jsr.json +0 -28
  54. package/packages/orq-rc/package-lock.json +0 -3217
  55. package/packages/orq-rc/package.json +0 -45
  56. package/packages/orq-rc/src/core.ts +0 -13
  57. package/packages/orq-rc/src/funcs/contactsCreate.ts +0 -154
  58. package/packages/orq-rc/src/funcs/datasetsClear.ts +0 -161
  59. package/packages/orq-rc/src/funcs/datasetsCreate.ts +0 -159
  60. package/packages/orq-rc/src/funcs/datasetsCreateDatapoint.ts +0 -161
  61. package/packages/orq-rc/src/funcs/datasetsCreateDatapoints.ts +0 -165
  62. package/packages/orq-rc/src/funcs/datasetsDelete.ts +0 -161
  63. package/packages/orq-rc/src/funcs/datasetsDeleteDatapoint.ts +0 -176
  64. package/packages/orq-rc/src/funcs/datasetsList.ts +0 -162
  65. package/packages/orq-rc/src/funcs/datasetsListDatapoints.ts +0 -169
  66. package/packages/orq-rc/src/funcs/datasetsRetrieve.ts +0 -169
  67. package/packages/orq-rc/src/funcs/datasetsRetrieveDatapoint.ts +0 -175
  68. package/packages/orq-rc/src/funcs/datasetsUpdate.ts +0 -170
  69. package/packages/orq-rc/src/funcs/datasetsUpdateDatapoint.ts +0 -173
  70. package/packages/orq-rc/src/funcs/deploymentsGetConfig.ts +0 -162
  71. package/packages/orq-rc/src/funcs/deploymentsInvoke.ts +0 -170
  72. package/packages/orq-rc/src/funcs/deploymentsList.ts +0 -171
  73. package/packages/orq-rc/src/funcs/deploymentsMetricsCreate.ts +0 -162
  74. package/packages/orq-rc/src/funcs/deploymentsStream.ts +0 -178
  75. package/packages/orq-rc/src/funcs/feedbackCreate.ts +0 -154
  76. package/packages/orq-rc/src/funcs/filesCreate.ts +0 -177
  77. package/packages/orq-rc/src/funcs/filesDelete.ts +0 -158
  78. package/packages/orq-rc/src/funcs/filesGet.ts +0 -160
  79. package/packages/orq-rc/src/funcs/filesList.ts +0 -162
  80. package/packages/orq-rc/src/funcs/promptsCreate.ts +0 -154
  81. package/packages/orq-rc/src/funcs/promptsDelete.ts +0 -158
  82. package/packages/orq-rc/src/funcs/promptsGetVersion.ts +0 -175
  83. package/packages/orq-rc/src/funcs/promptsList.ts +0 -162
  84. package/packages/orq-rc/src/funcs/promptsListVersions.ts +0 -168
  85. package/packages/orq-rc/src/funcs/promptsRetrieve.ts +0 -160
  86. package/packages/orq-rc/src/funcs/promptsUpdate.ts +0 -167
  87. package/packages/orq-rc/src/funcs/remoteconfigsRetrieve.ts +0 -155
  88. package/packages/orq-rc/src/hooks/global.ts +0 -44
  89. package/packages/orq-rc/src/hooks/hooks.ts +0 -132
  90. package/packages/orq-rc/src/hooks/index.ts +0 -6
  91. package/packages/orq-rc/src/hooks/registration.ts +0 -15
  92. package/packages/orq-rc/src/hooks/types.ts +0 -110
  93. package/packages/orq-rc/src/index.ts +0 -7
  94. package/packages/orq-rc/src/lib/base64.ts +0 -37
  95. package/packages/orq-rc/src/lib/config.ts +0 -70
  96. package/packages/orq-rc/src/lib/dlv.ts +0 -53
  97. package/packages/orq-rc/src/lib/encodings.ts +0 -483
  98. package/packages/orq-rc/src/lib/env.ts +0 -73
  99. package/packages/orq-rc/src/lib/event-streams.ts +0 -264
  100. package/packages/orq-rc/src/lib/files.ts +0 -40
  101. package/packages/orq-rc/src/lib/http.ts +0 -323
  102. package/packages/orq-rc/src/lib/is-plain-object.ts +0 -43
  103. package/packages/orq-rc/src/lib/logger.ts +0 -9
  104. package/packages/orq-rc/src/lib/matchers.ts +0 -325
  105. package/packages/orq-rc/src/lib/primitives.ts +0 -150
  106. package/packages/orq-rc/src/lib/retries.ts +0 -218
  107. package/packages/orq-rc/src/lib/schemas.ts +0 -91
  108. package/packages/orq-rc/src/lib/sdks.ts +0 -395
  109. package/packages/orq-rc/src/lib/security.ts +0 -261
  110. package/packages/orq-rc/src/lib/url.ts +0 -33
  111. package/packages/orq-rc/src/mcp-server/cli/start/command.ts +0 -125
  112. package/packages/orq-rc/src/mcp-server/cli/start/impl.ts +0 -140
  113. package/packages/orq-rc/src/mcp-server/cli.ts +0 -13
  114. package/packages/orq-rc/src/mcp-server/console-logger.ts +0 -71
  115. package/packages/orq-rc/src/mcp-server/extensions.ts +0 -17
  116. package/packages/orq-rc/src/mcp-server/mcp-server.ts +0 -26
  117. package/packages/orq-rc/src/mcp-server/prompts.ts +0 -110
  118. package/packages/orq-rc/src/mcp-server/resources.ts +0 -158
  119. package/packages/orq-rc/src/mcp-server/scopes.ts +0 -7
  120. package/packages/orq-rc/src/mcp-server/server.ts +0 -125
  121. package/packages/orq-rc/src/mcp-server/shared.ts +0 -75
  122. package/packages/orq-rc/src/mcp-server/tools/contactsCreate.ts +0 -37
  123. package/packages/orq-rc/src/mcp-server/tools/datasetsClear.ts +0 -35
  124. package/packages/orq-rc/src/mcp-server/tools/datasetsCreate.ts +0 -37
  125. package/packages/orq-rc/src/mcp-server/tools/datasetsCreateDatapoint.ts +0 -37
  126. package/packages/orq-rc/src/mcp-server/tools/datasetsCreateDatapoints.ts +0 -37
  127. package/packages/orq-rc/src/mcp-server/tools/datasetsDelete.ts +0 -35
  128. package/packages/orq-rc/src/mcp-server/tools/datasetsDeleteDatapoint.ts +0 -35
  129. package/packages/orq-rc/src/mcp-server/tools/datasetsList.ts +0 -37
  130. package/packages/orq-rc/src/mcp-server/tools/datasetsListDatapoints.ts +0 -37
  131. package/packages/orq-rc/src/mcp-server/tools/datasetsRetrieve.ts +0 -37
  132. package/packages/orq-rc/src/mcp-server/tools/datasetsRetrieveDatapoint.ts +0 -37
  133. package/packages/orq-rc/src/mcp-server/tools/datasetsUpdate.ts +0 -37
  134. package/packages/orq-rc/src/mcp-server/tools/datasetsUpdateDatapoint.ts +0 -35
  135. package/packages/orq-rc/src/mcp-server/tools/deploymentsGetConfig.ts +0 -37
  136. package/packages/orq-rc/src/mcp-server/tools/deploymentsInvoke.ts +0 -37
  137. package/packages/orq-rc/src/mcp-server/tools/deploymentsList.ts +0 -37
  138. package/packages/orq-rc/src/mcp-server/tools/deploymentsMetricsCreate.ts +0 -37
  139. package/packages/orq-rc/src/mcp-server/tools/deploymentsStream.ts +0 -37
  140. package/packages/orq-rc/src/mcp-server/tools/feedbackCreate.ts +0 -37
  141. package/packages/orq-rc/src/mcp-server/tools/filesCreate.ts +0 -37
  142. package/packages/orq-rc/src/mcp-server/tools/filesDelete.ts +0 -33
  143. package/packages/orq-rc/src/mcp-server/tools/filesGet.ts +0 -37
  144. package/packages/orq-rc/src/mcp-server/tools/filesList.ts +0 -37
  145. package/packages/orq-rc/src/mcp-server/tools/promptsCreate.ts +0 -35
  146. package/packages/orq-rc/src/mcp-server/tools/promptsDelete.ts +0 -33
  147. package/packages/orq-rc/src/mcp-server/tools/promptsGetVersion.ts +0 -37
  148. package/packages/orq-rc/src/mcp-server/tools/promptsList.ts +0 -37
  149. package/packages/orq-rc/src/mcp-server/tools/promptsListVersions.ts +0 -37
  150. package/packages/orq-rc/src/mcp-server/tools/promptsRetrieve.ts +0 -37
  151. package/packages/orq-rc/src/mcp-server/tools/promptsUpdate.ts +0 -35
  152. package/packages/orq-rc/src/mcp-server/tools/remoteconfigsRetrieve.ts +0 -36
  153. package/packages/orq-rc/src/mcp-server/tools.ts +0 -126
  154. package/packages/orq-rc/src/models/components/deployments.ts +0 -4164
  155. package/packages/orq-rc/src/models/components/index.ts +0 -6
  156. package/packages/orq-rc/src/models/components/security.ts +0 -71
  157. package/packages/orq-rc/src/models/errors/apierror.ts +0 -27
  158. package/packages/orq-rc/src/models/errors/getpromptversion.ts +0 -71
  159. package/packages/orq-rc/src/models/errors/honoapierror.ts +0 -82
  160. package/packages/orq-rc/src/models/errors/httpclienterrors.ts +0 -62
  161. package/packages/orq-rc/src/models/errors/index.ts +0 -10
  162. package/packages/orq-rc/src/models/errors/sdkvalidationerror.ts +0 -97
  163. package/packages/orq-rc/src/models/errors/updateprompt.ts +0 -71
  164. package/packages/orq-rc/src/models/operations/bulkcreatedatapoints.ts +0 -1816
  165. package/packages/orq-rc/src/models/operations/cleardataset.ts +0 -75
  166. package/packages/orq-rc/src/models/operations/createcontact.ts +0 -256
  167. package/packages/orq-rc/src/models/operations/createdataset.ts +0 -296
  168. package/packages/orq-rc/src/models/operations/createdatasetitem.ts +0 -1740
  169. package/packages/orq-rc/src/models/operations/createfeedback.ts +0 -286
  170. package/packages/orq-rc/src/models/operations/createprompt.ts +0 -3735
  171. package/packages/orq-rc/src/models/operations/deletedatapoint.ts +0 -81
  172. package/packages/orq-rc/src/models/operations/deletedataset.ts +0 -75
  173. package/packages/orq-rc/src/models/operations/deleteprompt.ts +0 -69
  174. package/packages/orq-rc/src/models/operations/deploymentcreatemetric.ts +0 -4936
  175. package/packages/orq-rc/src/models/operations/deploymentgetconfig.ts +0 -6090
  176. package/packages/orq-rc/src/models/operations/deploymentinvoke.ts +0 -1199
  177. package/packages/orq-rc/src/models/operations/deployments.ts +0 -2194
  178. package/packages/orq-rc/src/models/operations/deploymentstream.ts +0 -5960
  179. package/packages/orq-rc/src/models/operations/filedelete.ts +0 -78
  180. package/packages/orq-rc/src/models/operations/fileget.ts +0 -223
  181. package/packages/orq-rc/src/models/operations/filelist.ts +0 -377
  182. package/packages/orq-rc/src/models/operations/fileupload.ts +0 -324
  183. package/packages/orq-rc/src/models/operations/getallprompts.ts +0 -2165
  184. package/packages/orq-rc/src/models/operations/getoneprompt.ts +0 -1989
  185. package/packages/orq-rc/src/models/operations/getpromptversion.ts +0 -1987
  186. package/packages/orq-rc/src/models/operations/index.ts +0 -35
  187. package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +0 -1115
  188. package/packages/orq-rc/src/models/operations/listdatasets.ts +0 -448
  189. package/packages/orq-rc/src/models/operations/listpromptversions.ts +0 -2163
  190. package/packages/orq-rc/src/models/operations/remoteconfigsgetconfig.ts +0 -190
  191. package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +0 -924
  192. package/packages/orq-rc/src/models/operations/retrievedataset.ts +0 -288
  193. package/packages/orq-rc/src/models/operations/updatedatapoint.ts +0 -1729
  194. package/packages/orq-rc/src/models/operations/updatedataset.ts +0 -374
  195. package/packages/orq-rc/src/models/operations/updateprompt.ts +0 -3914
  196. package/packages/orq-rc/src/sdk/contacts.ts +0 -27
  197. package/packages/orq-rc/src/sdk/datasets.ts +0 -222
  198. package/packages/orq-rc/src/sdk/deployments.ts +0 -89
  199. package/packages/orq-rc/src/sdk/feedback.ts +0 -27
  200. package/packages/orq-rc/src/sdk/files.ts +0 -78
  201. package/packages/orq-rc/src/sdk/index.ts +0 -5
  202. package/packages/orq-rc/src/sdk/metrics.ts +0 -27
  203. package/packages/orq-rc/src/sdk/prompts.ts +0 -126
  204. package/packages/orq-rc/src/sdk/remoteconfigs.ts +0 -24
  205. package/packages/orq-rc/src/sdk/sdk.ts +0 -49
  206. package/packages/orq-rc/src/types/async.ts +0 -68
  207. package/packages/orq-rc/src/types/blobs.ts +0 -31
  208. package/packages/orq-rc/src/types/constdatetime.ts +0 -15
  209. package/packages/orq-rc/src/types/enums.ts +0 -16
  210. package/packages/orq-rc/src/types/fp.ts +0 -50
  211. package/packages/orq-rc/src/types/index.ts +0 -11
  212. package/packages/orq-rc/src/types/operations.ts +0 -105
  213. package/packages/orq-rc/src/types/rfcdate.ts +0 -54
  214. package/packages/orq-rc/src/types/streams.ts +0 -21
  215. package/packages/orq-rc/tsconfig.json +0 -41
@@ -1,660 +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
-
278
- ### [prompts](docs/sdks/prompts/README.md)
279
-
280
- * [list](docs/sdks/prompts/README.md#list) - List all prompts
281
- * [create](docs/sdks/prompts/README.md#create) - Create a prompt
282
- * [retrieve](docs/sdks/prompts/README.md#retrieve) - Retrieve a prompt
283
- * [update](docs/sdks/prompts/README.md#update) - Update a prompt
284
- * [delete](docs/sdks/prompts/README.md#delete) - Delete a prompt
285
- * [listVersions](docs/sdks/prompts/README.md#listversions) - List all prompt versions
286
- * [getVersion](docs/sdks/prompts/README.md#getversion) - Retrieve a prompt version
287
-
288
- ### [remoteconfigs](docs/sdks/remoteconfigs/README.md)
289
-
290
- * [retrieve](docs/sdks/remoteconfigs/README.md#retrieve) - Retrieve a remote config
291
-
292
- </details>
293
- <!-- End Available Resources and Operations [operations] -->
294
-
295
- <!-- Start Standalone functions [standalone-funcs] -->
296
- ## Standalone functions
297
-
298
- All the methods listed above are available as standalone functions. These
299
- functions are ideal for use in applications running in the browser, serverless
300
- runtimes or other environments where application bundle size is a primary
301
- concern. When using a bundler to build your application, all unused
302
- functionality will be either excluded from the final bundle or tree-shaken away.
303
-
304
- To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
305
-
306
- <details>
307
-
308
- <summary>Available standalone functions</summary>
309
-
310
- - [`contactsCreate`](docs/sdks/contacts/README.md#create) - Update user information
311
- - [`datasetsClear`](docs/sdks/datasets/README.md#clear) - Delete all datapoints
312
- - [`datasetsCreate`](docs/sdks/datasets/README.md#create) - Create a dataset
313
- - [`datasetsCreateDatapoint`](docs/sdks/datasets/README.md#createdatapoint) - Create a datapoint
314
- - [`datasetsCreateDatapoints`](docs/sdks/datasets/README.md#createdatapoints) - Create multiple datapoints
315
- - [`datasetsDelete`](docs/sdks/datasets/README.md#delete) - Delete a dataset
316
- - [`datasetsDeleteDatapoint`](docs/sdks/datasets/README.md#deletedatapoint) - Delete a datapoint
317
- - [`datasetsList`](docs/sdks/datasets/README.md#list) - List datasets
318
- - [`datasetsListDatapoints`](docs/sdks/datasets/README.md#listdatapoints) - List datapoints
319
- - [`datasetsRetrieve`](docs/sdks/datasets/README.md#retrieve) - Retrieve a dataset
320
- - [`datasetsRetrieveDatapoint`](docs/sdks/datasets/README.md#retrievedatapoint) - Retrieve a datapoint
321
- - [`datasetsUpdate`](docs/sdks/datasets/README.md#update) - Update a dataset
322
- - [`datasetsUpdateDatapoint`](docs/sdks/datasets/README.md#updatedatapoint) - Update a datapoint
323
- - [`deploymentsGetConfig`](docs/sdks/deployments/README.md#getconfig) - Get config
324
- - [`deploymentsInvoke`](docs/sdks/deployments/README.md#invoke) - Invoke
325
- - [`deploymentsList`](docs/sdks/deployments/README.md#list) - List all deployments
326
- - [`deploymentsMetricsCreate`](docs/sdks/metrics/README.md#create) - Add metrics
327
- - [`deploymentsStream`](docs/sdks/deployments/README.md#stream) - Stream
328
- - [`feedbackCreate`](docs/sdks/feedback/README.md#create) - Submit feedback
329
- - [`filesCreate`](docs/sdks/files/README.md#create) - Create file
330
- - [`filesDelete`](docs/sdks/files/README.md#delete) - Delete file
331
- - [`filesGet`](docs/sdks/files/README.md#get) - Retrieve a file
332
- - [`filesList`](docs/sdks/files/README.md#list) - List all files
333
- - [`promptsCreate`](docs/sdks/prompts/README.md#create) - Create a prompt
334
- - [`promptsDelete`](docs/sdks/prompts/README.md#delete) - Delete a prompt
335
- - [`promptsGetVersion`](docs/sdks/prompts/README.md#getversion) - Retrieve a prompt version
336
- - [`promptsList`](docs/sdks/prompts/README.md#list) - List all prompts
337
- - [`promptsListVersions`](docs/sdks/prompts/README.md#listversions) - List all prompt versions
338
- - [`promptsRetrieve`](docs/sdks/prompts/README.md#retrieve) - Retrieve a prompt
339
- - [`promptsUpdate`](docs/sdks/prompts/README.md#update) - Update a prompt
340
- - [`remoteconfigsRetrieve`](docs/sdks/remoteconfigs/README.md#retrieve) - Retrieve a remote config
341
-
342
- </details>
343
- <!-- End Standalone functions [standalone-funcs] -->
344
-
345
- <!-- Start Server-sent event streaming [eventstream] -->
346
- ## Server-sent event streaming
347
-
348
- [Server-sent events][mdn-sse] are used to stream content from certain
349
- operations. These operations will expose the stream as an async iterable that
350
- can be consumed using a [`for await...of`][mdn-for-await-of] loop. The loop will
351
- terminate when the server no longer has any events to send and closes the
352
- underlying connection.
353
-
354
- ```typescript
355
- import { Orq } from "@orq-ai/node";
356
-
357
- const orq = new Orq({
358
- apiKey: process.env["ORQ_API_KEY"] ?? "",
359
- });
360
-
361
- async function run() {
362
- const result = await orq.deployments.stream({
363
- key: "<key>",
364
- });
365
-
366
- for await (const event of result) {
367
- // Handle the event
368
- console.log(event);
369
- }
370
- }
371
-
372
- run();
373
-
374
- ```
375
-
376
- [mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
377
- [mdn-for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
378
- <!-- End Server-sent event streaming [eventstream] -->
379
-
380
- <!-- Start File uploads [file-upload] -->
381
- ## File uploads
382
-
383
- 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.
384
-
385
- > [!TIP]
386
- >
387
- > Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
388
- >
389
- > - **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).
390
- > - **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.
391
- > - **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.
392
- > - **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).
393
-
394
- ```typescript
395
- import { Orq } from "@orq-ai/node";
396
-
397
- const orq = new Orq({
398
- apiKey: process.env["ORQ_API_KEY"] ?? "",
399
- });
400
-
401
- async function run() {
402
- const result = await orq.files.create();
403
-
404
- // Handle the result
405
- console.log(result);
406
- }
407
-
408
- run();
409
-
410
- ```
411
- <!-- End File uploads [file-upload] -->
412
-
413
- <!-- Start Retries [retries] -->
414
- ## Retries
415
-
416
- 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.
417
-
418
- To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
419
- ```typescript
420
- import { Orq } from "@orq-ai/node";
421
-
422
- const orq = new Orq({
423
- apiKey: process.env["ORQ_API_KEY"] ?? "",
424
- });
425
-
426
- async function run() {
427
- const result = await orq.contacts.create({
428
- externalId: "<id>",
429
- }, {
430
- retries: {
431
- strategy: "backoff",
432
- backoff: {
433
- initialInterval: 1,
434
- maxInterval: 50,
435
- exponent: 1.1,
436
- maxElapsedTime: 100,
437
- },
438
- retryConnectionErrors: false,
439
- },
440
- });
441
-
442
- // Handle the result
443
- console.log(result);
444
- }
445
-
446
- run();
447
-
448
- ```
449
-
450
- If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
451
- ```typescript
452
- import { Orq } from "@orq-ai/node";
453
-
454
- const orq = new Orq({
455
- retryConfig: {
456
- strategy: "backoff",
457
- backoff: {
458
- initialInterval: 1,
459
- maxInterval: 50,
460
- exponent: 1.1,
461
- maxElapsedTime: 100,
462
- },
463
- retryConnectionErrors: false,
464
- },
465
- apiKey: process.env["ORQ_API_KEY"] ?? "",
466
- });
467
-
468
- async function run() {
469
- const result = await orq.contacts.create({
470
- externalId: "<id>",
471
- });
472
-
473
- // Handle the result
474
- console.log(result);
475
- }
476
-
477
- run();
478
-
479
- ```
480
- <!-- End Retries [retries] -->
481
-
482
- <!-- Start Error Handling [errors] -->
483
- ## Error Handling
484
-
485
- 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:
486
-
487
- | Error Type | Status Code | Content Type |
488
- | ------------------- | ----------- | ---------------- |
489
- | errors.HonoApiError | 500 | application/json |
490
- | errors.APIError | 4XX, 5XX | \*/\* |
491
-
492
- If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
493
-
494
- ```typescript
495
- import { Orq } from "@orq-ai/node";
496
- import { HonoApiError, SDKValidationError } from "@orq-ai/node/models/errors";
497
-
498
- const orq = new Orq({
499
- apiKey: process.env["ORQ_API_KEY"] ?? "",
500
- });
501
-
502
- async function run() {
503
- let result;
504
- try {
505
- result = await orq.deployments.list({});
506
-
507
- // Handle the result
508
- console.log(result);
509
- } catch (err) {
510
- switch (true) {
511
- // The server response does not match the expected SDK schema
512
- case (err instanceof SDKValidationError): {
513
- // Pretty-print will provide a human-readable multi-line error message
514
- console.error(err.pretty());
515
- // Raw value may also be inspected
516
- console.error(err.rawValue);
517
- return;
518
- }
519
- case (err instanceof HonoApiError): {
520
- // Handle err.data$: HonoApiErrorData
521
- console.error(err);
522
- return;
523
- }
524
- default: {
525
- // Other errors such as network errors, see HTTPClientErrors for more details
526
- throw err;
527
- }
528
- }
529
- }
530
- }
531
-
532
- run();
533
-
534
- ```
535
-
536
- 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.
537
-
538
- 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:
539
-
540
- | HTTP Client Error | Description |
541
- | ---------------------------------------------------- | ---------------------------------------------------- |
542
- | RequestAbortedError | HTTP request was aborted by the client |
543
- | RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
544
- | ConnectionError | HTTP client was unable to make a request to a server |
545
- | InvalidRequestError | Any input used to create a request is invalid |
546
- | UnexpectedClientError | Unrecognised or unexpected error |
547
- <!-- End Error Handling [errors] -->
548
-
549
- <!-- Start Server Selection [server] -->
550
- ## Server Selection
551
-
552
- ### Override Server URL Per-Client
553
-
554
- 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:
555
- ```typescript
556
- import { Orq } from "@orq-ai/node";
557
-
558
- const orq = new Orq({
559
- serverURL: "https://my.orq.ai",
560
- apiKey: process.env["ORQ_API_KEY"] ?? "",
561
- });
562
-
563
- async function run() {
564
- const result = await orq.contacts.create({
565
- externalId: "<id>",
566
- });
567
-
568
- // Handle the result
569
- console.log(result);
570
- }
571
-
572
- run();
573
-
574
- ```
575
- <!-- End Server Selection [server] -->
576
-
577
- <!-- Start Custom HTTP Client [http-client] -->
578
- ## Custom HTTP Client
579
-
580
- The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
581
- [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
582
- client is a thin wrapper around `fetch` and provides the ability to attach hooks
583
- around the request lifecycle that can be used to modify the request or handle
584
- errors and response.
585
-
586
- The `HTTPClient` constructor takes an optional `fetcher` argument that can be
587
- used to integrate a third-party HTTP client or when writing tests to mock out
588
- the HTTP client and feed in fixtures.
589
-
590
- The following example shows how to use the `"beforeRequest"` hook to to add a
591
- custom header and a timeout to requests and how to use the `"requestError"` hook
592
- to log errors:
593
-
594
- ```typescript
595
- import { Orq } from "@orq-ai/node";
596
- import { HTTPClient } from "@orq-ai/node/lib/http";
597
-
598
- const httpClient = new HTTPClient({
599
- // fetcher takes a function that has the same signature as native `fetch`.
600
- fetcher: (request) => {
601
- return fetch(request);
602
- }
603
- });
604
-
605
- httpClient.addHook("beforeRequest", (request) => {
606
- const nextRequest = new Request(request, {
607
- signal: request.signal || AbortSignal.timeout(5000)
608
- });
609
-
610
- nextRequest.headers.set("x-custom-header", "custom value");
611
-
612
- return nextRequest;
613
- });
614
-
615
- httpClient.addHook("requestError", (error, request) => {
616
- console.group("Request Error");
617
- console.log("Reason:", `${error}`);
618
- console.log("Endpoint:", `${request.method} ${request.url}`);
619
- console.groupEnd();
620
- });
621
-
622
- const sdk = new Orq({ httpClient });
623
- ```
624
- <!-- End Custom HTTP Client [http-client] -->
625
-
626
- <!-- Start Debugging [debug] -->
627
- ## Debugging
628
-
629
- You can setup your SDK to emit debug logs for SDK requests and responses.
630
-
631
- You can pass a logger that matches `console`'s interface as an SDK option.
632
-
633
- > [!WARNING]
634
- > 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.
635
-
636
- ```typescript
637
- import { Orq } from "@orq-ai/node";
638
-
639
- const sdk = new Orq({ debugLogger: console });
640
- ```
641
-
642
- You can also enable a default debug logger by setting an environment variable `ORQ_DEBUG` to true.
643
- <!-- End Debugging [debug] -->
644
-
645
- <!-- Placeholder for Future Speakeasy SDK Sections -->
646
-
647
- # Development
648
-
649
- ## Maturity
650
-
651
- This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
652
- to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
653
- looking for the latest version.
654
-
655
- ## Contributions
656
-
657
- 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.
658
- 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.
659
-
660
- ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=@orq-ai/node&utm_campaign=typescript)