@orq-ai/node 3.1.6 → 3.2.0-rc.3

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 (165) hide show
  1. package/README.md +0 -38
  2. package/docs/sdks/deployments/README.md +0 -81
  3. package/jsr.json +1 -2
  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/lib/matchers.d.ts.map +1 -1
  8. package/lib/matchers.js +1 -4
  9. package/lib/matchers.js.map +1 -1
  10. package/models/operations/createcontact.js +2 -2
  11. package/models/operations/fileget.js +2 -2
  12. package/models/operations/filelist.js +2 -2
  13. package/models/operations/fileupload.js +2 -2
  14. package/models/operations/index.d.ts +0 -1
  15. package/models/operations/index.d.ts.map +1 -1
  16. package/models/operations/index.js +0 -1
  17. package/models/operations/index.js.map +1 -1
  18. package/package.json +3 -2
  19. package/sdk/deployments.d.ts +0 -8
  20. package/sdk/deployments.d.ts.map +1 -1
  21. package/sdk/deployments.js +0 -10
  22. package/sdk/deployments.js.map +1 -1
  23. package/src/lib/config.ts +2 -2
  24. package/src/lib/matchers.ts +1 -4
  25. package/src/models/operations/createcontact.ts +2 -2
  26. package/src/models/operations/fileget.ts +2 -2
  27. package/src/models/operations/filelist.ts +2 -2
  28. package/src/models/operations/fileupload.ts +2 -2
  29. package/src/models/operations/index.ts +0 -1
  30. package/src/sdk/deployments.ts +0 -19
  31. package/funcs/deploymentsStream.d.ts +0 -16
  32. package/funcs/deploymentsStream.d.ts.map +0 -1
  33. package/funcs/deploymentsStream.js +0 -126
  34. package/funcs/deploymentsStream.js.map +0 -1
  35. package/lib/event-streams.d.ts +0 -17
  36. package/lib/event-streams.d.ts.map +0 -1
  37. package/lib/event-streams.js +0 -220
  38. package/lib/event-streams.js.map +0 -1
  39. package/models/operations/deploymentstream.d.ts +0 -1622
  40. package/models/operations/deploymentstream.d.ts.map +0 -1
  41. package/models/operations/deploymentstream.js +0 -1571
  42. package/models/operations/deploymentstream.js.map +0 -1
  43. package/packages/orq-rc/FUNCTIONS.md +0 -106
  44. package/packages/orq-rc/README.md +0 -559
  45. package/packages/orq-rc/RUNTIMES.md +0 -48
  46. package/packages/orq-rc/docs/sdks/contacts/README.md +0 -84
  47. package/packages/orq-rc/docs/sdks/deployments/README.md +0 -316
  48. package/packages/orq-rc/docs/sdks/feedback/README.md +0 -92
  49. package/packages/orq-rc/docs/sdks/files/README.md +0 -305
  50. package/packages/orq-rc/docs/sdks/metrics/README.md +0 -86
  51. package/packages/orq-rc/docs/sdks/orq/README.md +0 -10
  52. package/packages/orq-rc/docs/sdks/prompts/README.md +0 -608
  53. package/packages/orq-rc/docs/sdks/promptsnippets/README.md +0 -534
  54. package/packages/orq-rc/docs/sdks/remoteconfig/README.md +0 -80
  55. package/packages/orq-rc/jsr.json +0 -28
  56. package/packages/orq-rc/package-lock.json +0 -1861
  57. package/packages/orq-rc/package.json +0 -31
  58. package/packages/orq-rc/src/core.ts +0 -13
  59. package/packages/orq-rc/src/funcs/contactsCreate.ts +0 -126
  60. package/packages/orq-rc/src/funcs/deploymentsGetConfig.ts +0 -134
  61. package/packages/orq-rc/src/funcs/deploymentsInvoke.ts +0 -142
  62. package/packages/orq-rc/src/funcs/deploymentsList.ts +0 -141
  63. package/packages/orq-rc/src/funcs/deploymentsMetricsCreate.ts +0 -134
  64. package/packages/orq-rc/src/funcs/deploymentsStream.ts +0 -150
  65. package/packages/orq-rc/src/funcs/feedbackCreate.ts +0 -126
  66. package/packages/orq-rc/src/funcs/filesDelete.ts +0 -130
  67. package/packages/orq-rc/src/funcs/filesGet.ts +0 -129
  68. package/packages/orq-rc/src/funcs/filesList.ts +0 -131
  69. package/packages/orq-rc/src/funcs/filesUpload.ts +0 -149
  70. package/packages/orq-rc/src/funcs/promptSnippetsCreate.ts +0 -128
  71. package/packages/orq-rc/src/funcs/promptSnippetsDelete.ts +0 -131
  72. package/packages/orq-rc/src/funcs/promptSnippetsGet.ts +0 -130
  73. package/packages/orq-rc/src/funcs/promptSnippetsGetByKey.ts +0 -132
  74. package/packages/orq-rc/src/funcs/promptSnippetsList.ts +0 -132
  75. package/packages/orq-rc/src/funcs/promptSnippetsUpdate.ts +0 -139
  76. package/packages/orq-rc/src/funcs/promptsCreate.ts +0 -126
  77. package/packages/orq-rc/src/funcs/promptsDelete.ts +0 -130
  78. package/packages/orq-rc/src/funcs/promptsGetVersion.ts +0 -146
  79. package/packages/orq-rc/src/funcs/promptsList.ts +0 -133
  80. package/packages/orq-rc/src/funcs/promptsListVersions.ts +0 -139
  81. package/packages/orq-rc/src/funcs/promptsRetrieve.ts +0 -132
  82. package/packages/orq-rc/src/funcs/promptsUpdate.ts +0 -138
  83. package/packages/orq-rc/src/funcs/remoteconfigGetConfig.ts +0 -127
  84. package/packages/orq-rc/src/hooks/global.ts +0 -44
  85. package/packages/orq-rc/src/hooks/hooks.ts +0 -132
  86. package/packages/orq-rc/src/hooks/index.ts +0 -6
  87. package/packages/orq-rc/src/hooks/registration.ts +0 -15
  88. package/packages/orq-rc/src/hooks/types.ts +0 -109
  89. package/packages/orq-rc/src/index.ts +0 -7
  90. package/packages/orq-rc/src/lib/base64.ts +0 -37
  91. package/packages/orq-rc/src/lib/config.ts +0 -70
  92. package/packages/orq-rc/src/lib/dlv.ts +0 -53
  93. package/packages/orq-rc/src/lib/encodings.ts +0 -483
  94. package/packages/orq-rc/src/lib/env.ts +0 -73
  95. package/packages/orq-rc/src/lib/event-streams.ts +0 -264
  96. package/packages/orq-rc/src/lib/files.ts +0 -40
  97. package/packages/orq-rc/src/lib/http.ts +0 -323
  98. package/packages/orq-rc/src/lib/is-plain-object.ts +0 -43
  99. package/packages/orq-rc/src/lib/logger.ts +0 -9
  100. package/packages/orq-rc/src/lib/matchers.ts +0 -325
  101. package/packages/orq-rc/src/lib/primitives.ts +0 -136
  102. package/packages/orq-rc/src/lib/retries.ts +0 -218
  103. package/packages/orq-rc/src/lib/schemas.ts +0 -91
  104. package/packages/orq-rc/src/lib/sdks.ts +0 -400
  105. package/packages/orq-rc/src/lib/security.ts +0 -254
  106. package/packages/orq-rc/src/lib/url.ts +0 -33
  107. package/packages/orq-rc/src/models/components/deployments.ts +0 -1666
  108. package/packages/orq-rc/src/models/components/index.ts +0 -6
  109. package/packages/orq-rc/src/models/components/security.ts +0 -71
  110. package/packages/orq-rc/src/models/errors/apierror.ts +0 -27
  111. package/packages/orq-rc/src/models/errors/getpromptversion.ts +0 -71
  112. package/packages/orq-rc/src/models/errors/honoapierror.ts +0 -82
  113. package/packages/orq-rc/src/models/errors/httpclienterrors.ts +0 -62
  114. package/packages/orq-rc/src/models/errors/index.ts +0 -11
  115. package/packages/orq-rc/src/models/errors/sdkvalidationerror.ts +0 -97
  116. package/packages/orq-rc/src/models/errors/updateprompt.ts +0 -71
  117. package/packages/orq-rc/src/models/errors/updatepromptsnippet.ts +0 -71
  118. package/packages/orq-rc/src/models/operations/createcontact.ts +0 -256
  119. package/packages/orq-rc/src/models/operations/createfeedback.ts +0 -286
  120. package/packages/orq-rc/src/models/operations/createprompt.ts +0 -3819
  121. package/packages/orq-rc/src/models/operations/createpromptsnippet.ts +0 -6239
  122. package/packages/orq-rc/src/models/operations/deleteprompt.ts +0 -69
  123. package/packages/orq-rc/src/models/operations/deletepromptsnippet.ts +0 -69
  124. package/packages/orq-rc/src/models/operations/deploymentcreatemetric.ts +0 -1790
  125. package/packages/orq-rc/src/models/operations/deploymentgetconfig.ts +0 -3527
  126. package/packages/orq-rc/src/models/operations/deploymentinvoke.ts +0 -1144
  127. package/packages/orq-rc/src/models/operations/deployments.ts +0 -2148
  128. package/packages/orq-rc/src/models/operations/deploymentstream.ts +0 -3062
  129. package/packages/orq-rc/src/models/operations/filedelete.ts +0 -78
  130. package/packages/orq-rc/src/models/operations/fileget.ts +0 -222
  131. package/packages/orq-rc/src/models/operations/filelist.ts +0 -321
  132. package/packages/orq-rc/src/models/operations/fileupload.ts +0 -322
  133. package/packages/orq-rc/src/models/operations/findonebykeypromptsnippet.ts +0 -4483
  134. package/packages/orq-rc/src/models/operations/findonepromptsnippet.ts +0 -4343
  135. package/packages/orq-rc/src/models/operations/getallprompts.ts +0 -2116
  136. package/packages/orq-rc/src/models/operations/getallpromptsnippets.ts +0 -4472
  137. package/packages/orq-rc/src/models/operations/getoneprompt.ts +0 -1982
  138. package/packages/orq-rc/src/models/operations/getpromptversion.ts +0 -2012
  139. package/packages/orq-rc/src/models/operations/index.ts +0 -29
  140. package/packages/orq-rc/src/models/operations/listpromptversions.ts +0 -2146
  141. package/packages/orq-rc/src/models/operations/remoteconfigsgetconfig.ts +0 -190
  142. package/packages/orq-rc/src/models/operations/updateprompt.ts +0 -3917
  143. package/packages/orq-rc/src/models/operations/updatepromptsnippet.ts +0 -6544
  144. package/packages/orq-rc/src/sdk/contacts.ts +0 -27
  145. package/packages/orq-rc/src/sdk/deployments.ts +0 -89
  146. package/packages/orq-rc/src/sdk/feedback.ts +0 -27
  147. package/packages/orq-rc/src/sdk/files.ts +0 -72
  148. package/packages/orq-rc/src/sdk/index.ts +0 -5
  149. package/packages/orq-rc/src/sdk/metrics.ts +0 -27
  150. package/packages/orq-rc/src/sdk/prompts.ts +0 -126
  151. package/packages/orq-rc/src/sdk/promptsnippets.ts +0 -99
  152. package/packages/orq-rc/src/sdk/remoteconfig.ts +0 -24
  153. package/packages/orq-rc/src/sdk/sdk.ts +0 -49
  154. package/packages/orq-rc/src/types/blobs.ts +0 -31
  155. package/packages/orq-rc/src/types/constdatetime.ts +0 -15
  156. package/packages/orq-rc/src/types/enums.ts +0 -16
  157. package/packages/orq-rc/src/types/fp.ts +0 -50
  158. package/packages/orq-rc/src/types/index.ts +0 -11
  159. package/packages/orq-rc/src/types/operations.ts +0 -105
  160. package/packages/orq-rc/src/types/rfcdate.ts +0 -54
  161. package/packages/orq-rc/src/types/streams.ts +0 -21
  162. package/packages/orq-rc/tsconfig.json +0 -41
  163. package/src/funcs/deploymentsStream.ts +0 -151
  164. package/src/lib/event-streams.ts +0 -264
  165. package/src/models/operations/deploymentstream.ts +0 -3062
@@ -1,559 +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
- <!-- End SDK Installation [installation] -->
75
-
76
- <!-- Start Requirements [requirements] -->
77
- ## Requirements
78
-
79
- For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
80
- <!-- End Requirements [requirements] -->
81
-
82
- <!-- Start SDK Example Usage [usage] -->
83
- ## SDK Example Usage
84
-
85
- ### Example
86
-
87
- ```typescript
88
- import { Orq } from "@orq-ai/node";
89
-
90
- const orq = new Orq({
91
- apiKey: process.env["ORQ_API_KEY"] ?? "",
92
- });
93
-
94
- async function run() {
95
- const result = await orq.contacts.create({
96
- externalId: "<id>",
97
- });
98
-
99
- // Handle the result
100
- console.log(result);
101
- }
102
-
103
- run();
104
-
105
- ```
106
- <!-- End SDK Example Usage [usage] -->
107
-
108
- <!-- Start Authentication [security] -->
109
- ## Authentication
110
-
111
- ### Per-Client Security Schemes
112
-
113
- This SDK supports the following security scheme globally:
114
-
115
- | Name | Type | Scheme | Environment Variable |
116
- | -------- | ---- | ----------- | -------------------- |
117
- | `apiKey` | http | HTTP Bearer | `ORQ_API_KEY` |
118
-
119
- To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
120
- ```typescript
121
- import { Orq } from "@orq-ai/node";
122
-
123
- const orq = new Orq({
124
- apiKey: process.env["ORQ_API_KEY"] ?? "",
125
- });
126
-
127
- async function run() {
128
- const result = await orq.contacts.create({
129
- externalId: "<id>",
130
- });
131
-
132
- // Handle the result
133
- console.log(result);
134
- }
135
-
136
- run();
137
-
138
- ```
139
- <!-- End Authentication [security] -->
140
-
141
- <!-- Start Available Resources and Operations [operations] -->
142
- ## Available Resources and Operations
143
-
144
- <details open>
145
- <summary>Available methods</summary>
146
-
147
- ### [contacts](docs/sdks/contacts/README.md)
148
-
149
- * [create](docs/sdks/contacts/README.md#create) - Update user information
150
-
151
- ### [deployments](docs/sdks/deployments/README.md)
152
-
153
- * [list](docs/sdks/deployments/README.md#list) - List all deployments
154
- * [getConfig](docs/sdks/deployments/README.md#getconfig) - Get config
155
- * [invoke](docs/sdks/deployments/README.md#invoke) - Invoke
156
- * [stream](docs/sdks/deployments/README.md#stream) - Stream
157
-
158
- #### [deployments.metrics](docs/sdks/metrics/README.md)
159
-
160
- * [create](docs/sdks/metrics/README.md#create) - Add metrics
161
-
162
- ### [feedback](docs/sdks/feedback/README.md)
163
-
164
- * [create](docs/sdks/feedback/README.md#create) - Submit feedback
165
-
166
- ### [files](docs/sdks/files/README.md)
167
-
168
- * [upload](docs/sdks/files/README.md#upload) - Upload file
169
- * [list](docs/sdks/files/README.md#list) - List all files
170
- * [get](docs/sdks/files/README.md#get) - Get file by ID
171
- * [delete](docs/sdks/files/README.md#delete) - Delete file
172
-
173
-
174
- ### [prompts](docs/sdks/prompts/README.md)
175
-
176
- * [list](docs/sdks/prompts/README.md#list) - List all prompts
177
- * [create](docs/sdks/prompts/README.md#create) - Create a prompt
178
- * [retrieve](docs/sdks/prompts/README.md#retrieve) - Retrieve a prompt
179
- * [update](docs/sdks/prompts/README.md#update) - Update a prompt
180
- * [delete](docs/sdks/prompts/README.md#delete) - Delete a prompt
181
- * [listVersions](docs/sdks/prompts/README.md#listversions) - List all prompt versions
182
- * [getVersion](docs/sdks/prompts/README.md#getversion) - Retrieve a prompt version
183
-
184
- ### [promptSnippets](docs/sdks/promptsnippets/README.md)
185
-
186
- * [list](docs/sdks/promptsnippets/README.md#list) - List all prompts snippets
187
- * [create](docs/sdks/promptsnippets/README.md#create) - Create a prompt snippet
188
- * [update](docs/sdks/promptsnippets/README.md#update) - Update a prompt snippet
189
- * [delete](docs/sdks/promptsnippets/README.md#delete) - Delete a prompt snippet
190
- * [get](docs/sdks/promptsnippets/README.md#get) - Retrieve a prompt snippet
191
- * [getByKey](docs/sdks/promptsnippets/README.md#getbykey) - Retrieve a prompt snippet by key
192
-
193
- ### [remoteconfig](docs/sdks/remoteconfig/README.md)
194
-
195
- * [getConfig](docs/sdks/remoteconfig/README.md#getconfig) - Get Configurations
196
-
197
- </details>
198
- <!-- End Available Resources and Operations [operations] -->
199
-
200
- <!-- Start Standalone functions [standalone-funcs] -->
201
- ## Standalone functions
202
-
203
- All the methods listed above are available as standalone functions. These
204
- functions are ideal for use in applications running in the browser, serverless
205
- runtimes or other environments where application bundle size is a primary
206
- concern. When using a bundler to build your application, all unused
207
- functionality will be either excluded from the final bundle or tree-shaken away.
208
-
209
- To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
210
-
211
- <details>
212
-
213
- <summary>Available standalone functions</summary>
214
-
215
- - [`contactsCreate`](docs/sdks/contacts/README.md#create) - Update user information
216
- - [`deploymentsGetConfig`](docs/sdks/deployments/README.md#getconfig) - Get config
217
- - [`deploymentsInvoke`](docs/sdks/deployments/README.md#invoke) - Invoke
218
- - [`deploymentsList`](docs/sdks/deployments/README.md#list) - List all deployments
219
- - [`deploymentsMetricsCreate`](docs/sdks/metrics/README.md#create) - Add metrics
220
- - [`deploymentsStream`](docs/sdks/deployments/README.md#stream) - Stream
221
- - [`feedbackCreate`](docs/sdks/feedback/README.md#create) - Submit feedback
222
- - [`filesDelete`](docs/sdks/files/README.md#delete) - Delete file
223
- - [`filesGet`](docs/sdks/files/README.md#get) - Get file by ID
224
- - [`filesList`](docs/sdks/files/README.md#list) - List all files
225
- - [`filesUpload`](docs/sdks/files/README.md#upload) - Upload file
226
- - [`promptsCreate`](docs/sdks/prompts/README.md#create) - Create a prompt
227
- - [`promptsDelete`](docs/sdks/prompts/README.md#delete) - Delete a prompt
228
- - [`promptsGetVersion`](docs/sdks/prompts/README.md#getversion) - Retrieve a prompt version
229
- - [`promptsList`](docs/sdks/prompts/README.md#list) - List all prompts
230
- - [`promptsListVersions`](docs/sdks/prompts/README.md#listversions) - List all prompt versions
231
- - [`promptSnippetsCreate`](docs/sdks/promptsnippets/README.md#create) - Create a prompt snippet
232
- - [`promptSnippetsDelete`](docs/sdks/promptsnippets/README.md#delete) - Delete a prompt snippet
233
- - [`promptSnippetsGet`](docs/sdks/promptsnippets/README.md#get) - Retrieve a prompt snippet
234
- - [`promptSnippetsGetByKey`](docs/sdks/promptsnippets/README.md#getbykey) - Retrieve a prompt snippet by key
235
- - [`promptSnippetsList`](docs/sdks/promptsnippets/README.md#list) - List all prompts snippets
236
- - [`promptSnippetsUpdate`](docs/sdks/promptsnippets/README.md#update) - Update a prompt snippet
237
- - [`promptsRetrieve`](docs/sdks/prompts/README.md#retrieve) - Retrieve a prompt
238
- - [`promptsUpdate`](docs/sdks/prompts/README.md#update) - Update a prompt
239
- - [`remoteconfigGetConfig`](docs/sdks/remoteconfig/README.md#getconfig) - Get Configurations
240
-
241
- </details>
242
- <!-- End Standalone functions [standalone-funcs] -->
243
-
244
- <!-- Start Server-sent event streaming [eventstream] -->
245
- ## Server-sent event streaming
246
-
247
- [Server-sent events][mdn-sse] are used to stream content from certain
248
- operations. These operations will expose the stream as an async iterable that
249
- can be consumed using a [`for await...of`][mdn-for-await-of] loop. The loop will
250
- terminate when the server no longer has any events to send and closes the
251
- underlying connection.
252
-
253
- ```typescript
254
- import { Orq } from "@orq-ai/node";
255
-
256
- const orq = new Orq({
257
- apiKey: process.env["ORQ_API_KEY"] ?? "",
258
- });
259
-
260
- async function run() {
261
- const result = await orq.deployments.stream({
262
- key: "<key>",
263
- });
264
-
265
- for await (const event of result) {
266
- // Handle the event
267
- console.log(event);
268
- }
269
- }
270
-
271
- run();
272
-
273
- ```
274
-
275
- [mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
276
- [mdn-for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
277
- <!-- End Server-sent event streaming [eventstream] -->
278
-
279
- <!-- Start File uploads [file-upload] -->
280
- ## File uploads
281
-
282
- 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.
283
-
284
- > [!TIP]
285
- >
286
- > Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
287
- >
288
- > - **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).
289
- > - **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.
290
- > - **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.
291
- > - **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).
292
-
293
- ```typescript
294
- import { Orq } from "@orq-ai/node";
295
-
296
- const orq = new Orq({
297
- apiKey: process.env["ORQ_API_KEY"] ?? "",
298
- });
299
-
300
- async function run() {
301
- const result = await orq.files.upload();
302
-
303
- // Handle the result
304
- console.log(result);
305
- }
306
-
307
- run();
308
-
309
- ```
310
- <!-- End File uploads [file-upload] -->
311
-
312
- <!-- Start Retries [retries] -->
313
- ## Retries
314
-
315
- 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.
316
-
317
- To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
318
- ```typescript
319
- import { Orq } from "@orq-ai/node";
320
-
321
- const orq = new Orq({
322
- apiKey: process.env["ORQ_API_KEY"] ?? "",
323
- });
324
-
325
- async function run() {
326
- const result = await orq.contacts.create({
327
- externalId: "<id>",
328
- }, {
329
- retries: {
330
- strategy: "backoff",
331
- backoff: {
332
- initialInterval: 1,
333
- maxInterval: 50,
334
- exponent: 1.1,
335
- maxElapsedTime: 100,
336
- },
337
- retryConnectionErrors: false,
338
- },
339
- });
340
-
341
- // Handle the result
342
- console.log(result);
343
- }
344
-
345
- run();
346
-
347
- ```
348
-
349
- If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
350
- ```typescript
351
- import { Orq } from "@orq-ai/node";
352
-
353
- const orq = new Orq({
354
- retryConfig: {
355
- strategy: "backoff",
356
- backoff: {
357
- initialInterval: 1,
358
- maxInterval: 50,
359
- exponent: 1.1,
360
- maxElapsedTime: 100,
361
- },
362
- retryConnectionErrors: false,
363
- },
364
- apiKey: process.env["ORQ_API_KEY"] ?? "",
365
- });
366
-
367
- async function run() {
368
- const result = await orq.contacts.create({
369
- externalId: "<id>",
370
- });
371
-
372
- // Handle the result
373
- console.log(result);
374
- }
375
-
376
- run();
377
-
378
- ```
379
- <!-- End Retries [retries] -->
380
-
381
- <!-- Start Error Handling [errors] -->
382
- ## Error Handling
383
-
384
- 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:
385
-
386
- | Error Type | Status Code | Content Type |
387
- | ------------------- | ----------- | ---------------- |
388
- | errors.HonoApiError | 500 | application/json |
389
- | errors.APIError | 4XX, 5XX | \*/\* |
390
-
391
- If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
392
-
393
- ```typescript
394
- import { Orq } from "@orq-ai/node";
395
- import { HonoApiError, SDKValidationError } from "@orq-ai/node/models/errors";
396
-
397
- const orq = new Orq({
398
- apiKey: process.env["ORQ_API_KEY"] ?? "",
399
- });
400
-
401
- async function run() {
402
- let result;
403
- try {
404
- result = await orq.deployments.list({});
405
-
406
- // Handle the result
407
- console.log(result);
408
- } catch (err) {
409
- switch (true) {
410
- // The server response does not match the expected SDK schema
411
- case (err instanceof SDKValidationError): {
412
- // Pretty-print will provide a human-readable multi-line error message
413
- console.error(err.pretty());
414
- // Raw value may also be inspected
415
- console.error(err.rawValue);
416
- return;
417
- }
418
- case (err instanceof HonoApiError): {
419
- // Handle err.data$: HonoApiErrorData
420
- console.error(err);
421
- return;
422
- }
423
- default: {
424
- // Other errors such as network errors, see HTTPClientErrors for more details
425
- throw err;
426
- }
427
- }
428
- }
429
- }
430
-
431
- run();
432
-
433
- ```
434
-
435
- 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.
436
-
437
- 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:
438
-
439
- | HTTP Client Error | Description |
440
- | ---------------------------------------------------- | ---------------------------------------------------- |
441
- | RequestAbortedError | HTTP request was aborted by the client |
442
- | RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
443
- | ConnectionError | HTTP client was unable to make a request to a server |
444
- | InvalidRequestError | Any input used to create a request is invalid |
445
- | UnexpectedClientError | Unrecognised or unexpected error |
446
- <!-- End Error Handling [errors] -->
447
-
448
- <!-- Start Server Selection [server] -->
449
- ## Server Selection
450
-
451
- ### Override Server URL Per-Client
452
-
453
- The default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
454
- ```typescript
455
- import { Orq } from "@orq-ai/node";
456
-
457
- const orq = new Orq({
458
- serverURL: "https://my.orq.ai",
459
- apiKey: process.env["ORQ_API_KEY"] ?? "",
460
- });
461
-
462
- async function run() {
463
- const result = await orq.contacts.create({
464
- externalId: "<id>",
465
- });
466
-
467
- // Handle the result
468
- console.log(result);
469
- }
470
-
471
- run();
472
-
473
- ```
474
- <!-- End Server Selection [server] -->
475
-
476
- <!-- Start Custom HTTP Client [http-client] -->
477
- ## Custom HTTP Client
478
-
479
- The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
480
- [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
481
- client is a thin wrapper around `fetch` and provides the ability to attach hooks
482
- around the request lifecycle that can be used to modify the request or handle
483
- errors and response.
484
-
485
- The `HTTPClient` constructor takes an optional `fetcher` argument that can be
486
- used to integrate a third-party HTTP client or when writing tests to mock out
487
- the HTTP client and feed in fixtures.
488
-
489
- The following example shows how to use the `"beforeRequest"` hook to to add a
490
- custom header and a timeout to requests and how to use the `"requestError"` hook
491
- to log errors:
492
-
493
- ```typescript
494
- import { Orq } from "@orq-ai/node";
495
- import { HTTPClient } from "@orq-ai/node/lib/http";
496
-
497
- const httpClient = new HTTPClient({
498
- // fetcher takes a function that has the same signature as native `fetch`.
499
- fetcher: (request) => {
500
- return fetch(request);
501
- }
502
- });
503
-
504
- httpClient.addHook("beforeRequest", (request) => {
505
- const nextRequest = new Request(request, {
506
- signal: request.signal || AbortSignal.timeout(5000)
507
- });
508
-
509
- nextRequest.headers.set("x-custom-header", "custom value");
510
-
511
- return nextRequest;
512
- });
513
-
514
- httpClient.addHook("requestError", (error, request) => {
515
- console.group("Request Error");
516
- console.log("Reason:", `${error}`);
517
- console.log("Endpoint:", `${request.method} ${request.url}`);
518
- console.groupEnd();
519
- });
520
-
521
- const sdk = new Orq({ httpClient });
522
- ```
523
- <!-- End Custom HTTP Client [http-client] -->
524
-
525
- <!-- Start Debugging [debug] -->
526
- ## Debugging
527
-
528
- You can setup your SDK to emit debug logs for SDK requests and responses.
529
-
530
- You can pass a logger that matches `console`'s interface as an SDK option.
531
-
532
- > [!WARNING]
533
- > 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.
534
-
535
- ```typescript
536
- import { Orq } from "@orq-ai/node";
537
-
538
- const sdk = new Orq({ debugLogger: console });
539
- ```
540
-
541
- You can also enable a default debug logger by setting an environment variable `ORQ_DEBUG` to true.
542
- <!-- End Debugging [debug] -->
543
-
544
- <!-- Placeholder for Future Speakeasy SDK Sections -->
545
-
546
- # Development
547
-
548
- ## Maturity
549
-
550
- This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
551
- to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
552
- looking for the latest version.
553
-
554
- ## Contributions
555
-
556
- 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.
557
- 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.
558
-
559
- ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=@orq-ai/node&utm_campaign=typescript)
@@ -1,48 +0,0 @@
1
- # Supported JavaScript runtimes
2
-
3
- This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features:
4
-
5
- * [Web Fetch API][web-fetch]
6
- * [Web Streams API][web-streams] and in particular `ReadableStream`
7
- * [Async iterables][async-iter] using `Symbol.asyncIterator`
8
-
9
- [web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
10
- [web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
11
- [async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
12
-
13
- Runtime environments that are explicitly supported are:
14
-
15
- - Evergreen browsers which include: Chrome, Safari, Edge, Firefox
16
- - Node.js active and maintenance LTS releases
17
- - Currently, this is v18 and v20
18
- - Bun v1 and above
19
- - Deno v1.39
20
- - Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
21
-
22
- [deno-file-streaming]: https://github.com/denoland/deno/issues/11018
23
-
24
- ## Recommended TypeScript compiler options
25
-
26
- The following `tsconfig.json` options are recommended for projects using this
27
- SDK in order to get static type support for features like async iterables,
28
- streams and `fetch`-related APIs ([`for await...of`][for-await-of],
29
- [`AbortSignal`][abort-signal], [`Request`][request], [`Response`][response] and
30
- so on):
31
-
32
- [for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
33
- [abort-signal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
34
- [request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
35
- [response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
36
-
37
- ```jsonc
38
- {
39
- "compilerOptions": {
40
- "target": "es2020", // or higher
41
- "lib": ["es2020", "dom", "dom.iterable"],
42
- }
43
- }
44
- ```
45
-
46
- While `target` can be set to older ECMAScript versions, it may result in extra,
47
- unnecessary compatibility code being generated if you are not targeting old
48
- runtimes.
@@ -1,84 +0,0 @@
1
- # Contacts
2
- (*contacts*)
3
-
4
- ## Overview
5
-
6
- ### Available Operations
7
-
8
- * [create](#create) - Update user information
9
-
10
- ## create
11
-
12
- Update or add user information to workspace
13
-
14
- ### Example Usage
15
-
16
- ```typescript
17
- import { Orq } from "@orq-ai/node";
18
-
19
- const orq = new Orq({
20
- apiKey: process.env["ORQ_API_KEY"] ?? "",
21
- });
22
-
23
- async function run() {
24
- const result = await orq.contacts.create({
25
- externalId: "<id>",
26
- });
27
-
28
- // Handle the result
29
- console.log(result);
30
- }
31
-
32
- run();
33
- ```
34
-
35
- ### Standalone function
36
-
37
- The standalone function version of this method:
38
-
39
- ```typescript
40
- import { OrqCore } from "@orq-ai/node/core.js";
41
- import { contactsCreate } from "@orq-ai/node/funcs/contactsCreate.js";
42
-
43
- // Use `OrqCore` for best tree-shaking performance.
44
- // You can create one instance of it to use across an application.
45
- const orq = new OrqCore({
46
- apiKey: process.env["ORQ_API_KEY"] ?? "",
47
- });
48
-
49
- async function run() {
50
- const res = await contactsCreate(orq, {
51
- externalId: "<id>",
52
- });
53
-
54
- if (!res.ok) {
55
- throw res.error;
56
- }
57
-
58
- const { value: result } = res;
59
-
60
- // Handle the result
61
- console.log(result);
62
- }
63
-
64
- run();
65
- ```
66
-
67
- ### Parameters
68
-
69
- | Parameter | Type | Required | Description |
70
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
71
- | `request` | [operations.CreateContactRequestBody](../../models/operations/createcontactrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
72
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
73
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
74
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
75
-
76
- ### Response
77
-
78
- **Promise\<[operations.CreateContactResponseBody](../../models/operations/createcontactresponsebody.md)\>**
79
-
80
- ### Errors
81
-
82
- | Error Type | Status Code | Content Type |
83
- | --------------- | --------------- | --------------- |
84
- | errors.APIError | 4XX, 5XX | \*/\* |