@orq-ai/node 4.7.3 → 4.7.6

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 (204) hide show
  1. package/README.md +1 -1
  2. package/funcs/filesCreate.js +3 -2
  3. package/funcs/filesCreate.js.map +1 -1
  4. package/funcs/filesGetContent.d.ts +1 -1
  5. package/funcs/filesGetContent.js +3 -3
  6. package/funcs/filesGetContent.js.map +1 -1
  7. package/funcs/routerAudioTranscriptionsCreate.js +3 -2
  8. package/funcs/routerAudioTranscriptionsCreate.js.map +1 -1
  9. package/funcs/routerAudioTranslationsCreate.js +3 -2
  10. package/funcs/routerAudioTranslationsCreate.js.map +1 -1
  11. package/jsr.json +1 -1
  12. package/lib/config.d.ts +3 -3
  13. package/lib/config.js +3 -3
  14. package/lib/config.js.map +1 -1
  15. package/lib/encodings.d.ts +1 -0
  16. package/lib/encodings.d.ts.map +1 -1
  17. package/lib/encodings.js +7 -0
  18. package/lib/encodings.js.map +1 -1
  19. package/models/components/reasoningpart.js +1 -1
  20. package/models/operations/createcontact.js +1 -1
  21. package/models/operations/createdataset.js +1 -1
  22. package/models/operations/createdatasetitem.js +4 -4
  23. package/models/operations/createdatasource.js +1 -1
  24. package/models/operations/createeval.js +16 -16
  25. package/models/operations/createidentity.js +1 -1
  26. package/models/operations/createtool.js +6 -6
  27. package/models/operations/filecontent.d.ts +3 -3
  28. package/models/operations/filecontent.d.ts.map +1 -1
  29. package/models/operations/filecontent.js +2 -2
  30. package/models/operations/filecontent.js.map +1 -1
  31. package/models/operations/getalltools.js +6 -6
  32. package/models/operations/getevals.js +16 -16
  33. package/models/operations/getv2humanevals.js +6 -6
  34. package/models/operations/getv2humanevalsets.js +2 -2
  35. package/models/operations/getv2humanevalsetsid.js +2 -2
  36. package/models/operations/getv2humanevalsid.js +6 -6
  37. package/models/operations/listdatasetdatapoints.js +4 -4
  38. package/models/operations/listdatasets.js +1 -1
  39. package/models/operations/listdatasources.js +1 -1
  40. package/models/operations/listidentities.js +1 -1
  41. package/models/operations/patchv2humanevalsetsid.js +2 -2
  42. package/models/operations/patchv2humanevalsid.js +12 -12
  43. package/models/operations/postv2feedbackevaluation.js +3 -3
  44. package/models/operations/postv2humanevals.js +12 -12
  45. package/models/operations/postv2humanevalsets.js +2 -2
  46. package/models/operations/retrievedatapoint.js +4 -4
  47. package/models/operations/retrievedataset.js +1 -1
  48. package/models/operations/retrievedatasource.js +1 -1
  49. package/models/operations/retrieveidentity.js +1 -1
  50. package/models/operations/retrievetool.js +6 -6
  51. package/models/operations/runagent.js +1 -1
  52. package/models/operations/streamrunagent.js +1 -1
  53. package/models/operations/updatedatapoint.js +4 -4
  54. package/models/operations/updatedataset.js +1 -1
  55. package/models/operations/updatedatasource.js +1 -1
  56. package/models/operations/updateeval.js +16 -16
  57. package/models/operations/updateidentity.js +1 -1
  58. package/models/operations/updatetool.js +7 -7
  59. package/package.json +1 -1
  60. package/packages/orq-rc/src/funcs/agentsCreate.ts +2 -2
  61. package/packages/orq-rc/src/funcs/filesCreate.ts +4 -3
  62. package/packages/orq-rc/src/funcs/guardrailRulesCreate.ts +161 -0
  63. package/packages/orq-rc/src/funcs/guardrailRulesDelete.ts +170 -0
  64. package/packages/orq-rc/src/funcs/guardrailRulesGet.ts +168 -0
  65. package/packages/orq-rc/src/funcs/guardrailRulesList.ts +170 -0
  66. package/packages/orq-rc/src/funcs/guardrailRulesUpdate.ts +170 -0
  67. package/packages/orq-rc/src/funcs/policiesCreate.ts +160 -0
  68. package/packages/orq-rc/src/funcs/policiesDelete.ts +166 -0
  69. package/packages/orq-rc/src/funcs/policiesGet.ts +165 -0
  70. package/packages/orq-rc/src/funcs/policiesList.ts +168 -0
  71. package/packages/orq-rc/src/funcs/policiesUpdate.ts +166 -0
  72. package/packages/orq-rc/src/funcs/routerAudioTranscriptionsCreate.ts +4 -3
  73. package/packages/orq-rc/src/funcs/routerAudioTranslationsCreate.ts +4 -3
  74. package/packages/orq-rc/src/funcs/routingRulesCreate.ts +161 -0
  75. package/packages/orq-rc/src/funcs/routingRulesDelete.ts +166 -0
  76. package/packages/orq-rc/src/funcs/routingRulesGet.ts +165 -0
  77. package/packages/orq-rc/src/funcs/routingRulesList.ts +168 -0
  78. package/packages/orq-rc/src/funcs/routingRulesUpdate.ts +166 -0
  79. package/packages/orq-rc/src/lib/config.ts +3 -3
  80. package/packages/orq-rc/src/lib/encodings.ts +9 -0
  81. package/packages/orq-rc/src/models/components/agentstartedstreamingevent.ts +9 -6
  82. package/packages/orq-rc/src/models/components/budgetlimit.ts +83 -0
  83. package/packages/orq-rc/src/models/components/evaluatorref.ts +89 -0
  84. package/packages/orq-rc/src/models/components/expression.ts +51 -0
  85. package/packages/orq-rc/src/models/components/guardrailref.ts +75 -0
  86. package/packages/orq-rc/src/models/components/guardrailruledocument.ts +66 -0
  87. package/packages/orq-rc/src/models/components/index.ts +13 -0
  88. package/packages/orq-rc/src/models/components/limits.ts +70 -0
  89. package/packages/orq-rc/src/models/components/modelref.ts +64 -0
  90. package/packages/orq-rc/src/models/components/modelsconfig.ts +73 -0
  91. package/packages/orq-rc/src/models/components/policydocument.ts +76 -0
  92. package/packages/orq-rc/src/models/components/reasoningpart.ts +1 -1
  93. package/packages/orq-rc/src/models/components/requestlimit.ts +69 -0
  94. package/packages/orq-rc/src/models/components/retryconfig.ts +60 -0
  95. package/packages/orq-rc/src/models/components/routingruledocument.ts +67 -0
  96. package/packages/orq-rc/src/models/components/tokenlimit.ts +69 -0
  97. package/packages/orq-rc/src/models/operations/createagentrequest.ts +0 -3
  98. package/packages/orq-rc/src/models/operations/createcontact.ts +1 -1
  99. package/packages/orq-rc/src/models/operations/createdataset.ts +1 -1
  100. package/packages/orq-rc/src/models/operations/createdatasetitem.ts +4 -4
  101. package/packages/orq-rc/src/models/operations/createdatasource.ts +1 -1
  102. package/packages/orq-rc/src/models/operations/createeval.ts +958 -132
  103. package/packages/orq-rc/src/models/operations/createidentity.ts +1 -1
  104. package/packages/orq-rc/src/models/operations/createtool.ts +6 -21
  105. package/packages/orq-rc/src/models/operations/getalltools.ts +6 -21
  106. package/packages/orq-rc/src/models/operations/getevals.ts +447 -16
  107. package/packages/orq-rc/src/models/operations/getv2humanevals.ts +6 -6
  108. package/packages/orq-rc/src/models/operations/getv2humanevalsets.ts +2 -2
  109. package/packages/orq-rc/src/models/operations/getv2humanevalsetsid.ts +2 -2
  110. package/packages/orq-rc/src/models/operations/getv2humanevalsid.ts +6 -6
  111. package/packages/orq-rc/src/models/operations/guardrailrulecreate.ts +124 -0
  112. package/packages/orq-rc/src/models/operations/guardrailruledelete.ts +39 -0
  113. package/packages/orq-rc/src/models/operations/guardrailruleget.ts +102 -0
  114. package/packages/orq-rc/src/models/operations/guardrailrulelist.ts +94 -0
  115. package/packages/orq-rc/src/models/operations/guardrailruleupdate.ts +153 -0
  116. package/packages/orq-rc/src/models/operations/index.ts +15 -0
  117. package/packages/orq-rc/src/models/operations/listagents.ts +0 -3
  118. package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +4 -4
  119. package/packages/orq-rc/src/models/operations/listdatasets.ts +1 -1
  120. package/packages/orq-rc/src/models/operations/listdatasources.ts +1 -1
  121. package/packages/orq-rc/src/models/operations/listidentities.ts +1 -1
  122. package/packages/orq-rc/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  123. package/packages/orq-rc/src/models/operations/patchv2humanevalsid.ts +12 -12
  124. package/packages/orq-rc/src/models/operations/policycreate.ts +138 -0
  125. package/packages/orq-rc/src/models/operations/policydelete.ts +39 -0
  126. package/packages/orq-rc/src/models/operations/policyget.ts +110 -0
  127. package/packages/orq-rc/src/models/operations/policylist.ts +94 -0
  128. package/packages/orq-rc/src/models/operations/policyupdate.ts +167 -0
  129. package/packages/orq-rc/src/models/operations/postv2agentsa2a.ts +0 -3
  130. package/packages/orq-rc/src/models/operations/postv2feedbackevaluation.ts +3 -3
  131. package/packages/orq-rc/src/models/operations/postv2humanevals.ts +12 -12
  132. package/packages/orq-rc/src/models/operations/postv2humanevalsets.ts +2 -2
  133. package/packages/orq-rc/src/models/operations/retrieveagentrequest.ts +0 -3
  134. package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +4 -4
  135. package/packages/orq-rc/src/models/operations/retrievedataset.ts +1 -1
  136. package/packages/orq-rc/src/models/operations/retrievedatasource.ts +1 -1
  137. package/packages/orq-rc/src/models/operations/retrieveidentity.ts +1 -1
  138. package/packages/orq-rc/src/models/operations/retrievetool.ts +6 -21
  139. package/packages/orq-rc/src/models/operations/routingrulecreate.ts +124 -0
  140. package/packages/orq-rc/src/models/operations/routingruledelete.ts +39 -0
  141. package/packages/orq-rc/src/models/operations/routingruleget.ts +102 -0
  142. package/packages/orq-rc/src/models/operations/routingrulelist.ts +94 -0
  143. package/packages/orq-rc/src/models/operations/routingruleupdate.ts +154 -0
  144. package/packages/orq-rc/src/models/operations/runagent.ts +1 -1
  145. package/packages/orq-rc/src/models/operations/streamrunagent.ts +1 -1
  146. package/packages/orq-rc/src/models/operations/updateagent.ts +0 -3
  147. package/packages/orq-rc/src/models/operations/updatedatapoint.ts +4 -4
  148. package/packages/orq-rc/src/models/operations/updatedataset.ts +1 -1
  149. package/packages/orq-rc/src/models/operations/updatedatasource.ts +1 -1
  150. package/packages/orq-rc/src/models/operations/updateeval.ts +646 -16
  151. package/packages/orq-rc/src/models/operations/updateidentity.ts +1 -1
  152. package/packages/orq-rc/src/models/operations/updatetool.ts +7 -22
  153. package/packages/orq-rc/src/sdk/guardrailrules.ts +99 -0
  154. package/packages/orq-rc/src/sdk/policies.ts +99 -0
  155. package/packages/orq-rc/src/sdk/routingrules.ts +99 -0
  156. package/packages/orq-rc/src/sdk/sdk.ts +18 -0
  157. package/sdk/files.d.ts +7 -7
  158. package/sdk/files.d.ts.map +1 -1
  159. package/sdk/files.js +9 -9
  160. package/sdk/files.js.map +1 -1
  161. package/src/funcs/filesCreate.ts +4 -3
  162. package/src/funcs/filesGetContent.ts +3 -3
  163. package/src/funcs/routerAudioTranscriptionsCreate.ts +4 -3
  164. package/src/funcs/routerAudioTranslationsCreate.ts +4 -3
  165. package/src/lib/config.ts +3 -3
  166. package/src/lib/encodings.ts +9 -0
  167. package/src/models/components/reasoningpart.ts +1 -1
  168. package/src/models/operations/createcontact.ts +1 -1
  169. package/src/models/operations/createdataset.ts +1 -1
  170. package/src/models/operations/createdatasetitem.ts +4 -4
  171. package/src/models/operations/createdatasource.ts +1 -1
  172. package/src/models/operations/createeval.ts +16 -16
  173. package/src/models/operations/createidentity.ts +1 -1
  174. package/src/models/operations/createtool.ts +6 -6
  175. package/src/models/operations/filecontent.ts +5 -5
  176. package/src/models/operations/getalltools.ts +6 -6
  177. package/src/models/operations/getevals.ts +16 -16
  178. package/src/models/operations/getv2humanevals.ts +6 -6
  179. package/src/models/operations/getv2humanevalsets.ts +2 -2
  180. package/src/models/operations/getv2humanevalsetsid.ts +2 -2
  181. package/src/models/operations/getv2humanevalsid.ts +6 -6
  182. package/src/models/operations/listdatasetdatapoints.ts +4 -4
  183. package/src/models/operations/listdatasets.ts +1 -1
  184. package/src/models/operations/listdatasources.ts +1 -1
  185. package/src/models/operations/listidentities.ts +1 -1
  186. package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  187. package/src/models/operations/patchv2humanevalsid.ts +12 -12
  188. package/src/models/operations/postv2feedbackevaluation.ts +3 -3
  189. package/src/models/operations/postv2humanevals.ts +12 -12
  190. package/src/models/operations/postv2humanevalsets.ts +2 -2
  191. package/src/models/operations/retrievedatapoint.ts +4 -4
  192. package/src/models/operations/retrievedataset.ts +1 -1
  193. package/src/models/operations/retrievedatasource.ts +1 -1
  194. package/src/models/operations/retrieveidentity.ts +1 -1
  195. package/src/models/operations/retrievetool.ts +6 -6
  196. package/src/models/operations/runagent.ts +1 -1
  197. package/src/models/operations/streamrunagent.ts +1 -1
  198. package/src/models/operations/updatedatapoint.ts +4 -4
  199. package/src/models/operations/updatedataset.ts +1 -1
  200. package/src/models/operations/updatedatasource.ts +1 -1
  201. package/src/models/operations/updateeval.ts +16 -16
  202. package/src/models/operations/updateidentity.ts +1 -1
  203. package/src/models/operations/updatetool.ts +7 -7
  204. package/src/sdk/files.ts +17 -17
@@ -0,0 +1,170 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { OrqCore } from "../core.js";
7
+ import { encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import { OrqError } from "../models/errors/orqerror.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Delete guardrail rule
30
+ *
31
+ * @remarks
32
+ * Deletes an existing guardrail rule by ID.
33
+ */
34
+ export function guardrailRulesDelete(
35
+ client: OrqCore,
36
+ request: operations.GuardrailRuleDeleteRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ void,
41
+ | OrqError
42
+ | ResponseValidationError
43
+ | ConnectionError
44
+ | RequestAbortedError
45
+ | RequestTimeoutError
46
+ | InvalidRequestError
47
+ | UnexpectedClientError
48
+ | SDKValidationError
49
+ >
50
+ > {
51
+ return new APIPromise($do(
52
+ client,
53
+ request,
54
+ options,
55
+ ));
56
+ }
57
+
58
+ async function $do(
59
+ client: OrqCore,
60
+ request: operations.GuardrailRuleDeleteRequest,
61
+ options?: RequestOptions,
62
+ ): Promise<
63
+ [
64
+ Result<
65
+ void,
66
+ | OrqError
67
+ | ResponseValidationError
68
+ | ConnectionError
69
+ | RequestAbortedError
70
+ | RequestTimeoutError
71
+ | InvalidRequestError
72
+ | UnexpectedClientError
73
+ | SDKValidationError
74
+ >,
75
+ APICall,
76
+ ]
77
+ > {
78
+ const parsed = safeParse(
79
+ request,
80
+ (value) =>
81
+ operations.GuardrailRuleDeleteRequest$outboundSchema.parse(value),
82
+ "Input validation failed",
83
+ );
84
+ if (!parsed.ok) {
85
+ return [parsed, { status: "invalid" }];
86
+ }
87
+ const payload = parsed.value;
88
+ const body = null;
89
+
90
+ const pathParams = {
91
+ guardrail_rule_id: encodeSimple(
92
+ "guardrail_rule_id",
93
+ payload.guardrail_rule_id,
94
+ { explode: false, charEncoding: "percent" },
95
+ ),
96
+ };
97
+ const path = pathToFunc("/v2/guardrail-rules/{guardrail_rule_id}")(
98
+ pathParams,
99
+ );
100
+
101
+ const headers = new Headers(compactMap({
102
+ Accept: "*/*",
103
+ }));
104
+
105
+ const secConfig = await extractSecurity(client._options.apiKey);
106
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
107
+ const requestSecurity = resolveGlobalSecurity(securityInput);
108
+
109
+ const context = {
110
+ options: client._options,
111
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
112
+ operationID: "GuardrailRuleDelete",
113
+ oAuth2Scopes: null,
114
+
115
+ resolvedSecurity: requestSecurity,
116
+
117
+ securitySource: client._options.apiKey,
118
+ retryConfig: options?.retries
119
+ || client._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
122
+ };
123
+
124
+ const requestRes = client._createRequest(context, {
125
+ security: requestSecurity,
126
+ method: "DELETE",
127
+ baseURL: options?.serverURL,
128
+ path: path,
129
+ headers: headers,
130
+ body: body,
131
+ userAgent: client._options.userAgent,
132
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req = requestRes.value;
138
+
139
+ const doResult = await client._do(req, {
140
+ context,
141
+ errorCodes: ["404", "4XX", "5XX"],
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req }];
147
+ }
148
+ const response = doResult.value;
149
+
150
+ const [result] = await M.match<
151
+ void,
152
+ | OrqError
153
+ | ResponseValidationError
154
+ | ConnectionError
155
+ | RequestAbortedError
156
+ | RequestTimeoutError
157
+ | InvalidRequestError
158
+ | UnexpectedClientError
159
+ | SDKValidationError
160
+ >(
161
+ M.nil(204, z.void()),
162
+ M.fail([404, "4XX"]),
163
+ M.fail("5XX"),
164
+ )(response, req);
165
+ if (!result.ok) {
166
+ return [result, { status: "complete", request: req, response }];
167
+ }
168
+
169
+ return [result, { status: "complete", request: req, response }];
170
+ }
@@ -0,0 +1,168 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { OrqError } from "../models/errors/orqerror.js";
21
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Get guardrail rule
29
+ *
30
+ * @remarks
31
+ * Retrieves the details of an existing guardrail rule by ID.
32
+ */
33
+ export function guardrailRulesGet(
34
+ client: OrqCore,
35
+ request: operations.GuardrailRuleGetRequest,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.GuardrailRuleGetResponseBody,
40
+ | OrqError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: OrqCore,
59
+ request: operations.GuardrailRuleGetRequest,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ operations.GuardrailRuleGetResponseBody,
65
+ | OrqError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) => operations.GuardrailRuleGetRequest$outboundSchema.parse(value),
80
+ "Input validation failed",
81
+ );
82
+ if (!parsed.ok) {
83
+ return [parsed, { status: "invalid" }];
84
+ }
85
+ const payload = parsed.value;
86
+ const body = null;
87
+
88
+ const pathParams = {
89
+ guardrail_rule_id: encodeSimple(
90
+ "guardrail_rule_id",
91
+ payload.guardrail_rule_id,
92
+ { explode: false, charEncoding: "percent" },
93
+ ),
94
+ };
95
+ const path = pathToFunc("/v2/guardrail-rules/{guardrail_rule_id}")(
96
+ pathParams,
97
+ );
98
+
99
+ const headers = new Headers(compactMap({
100
+ Accept: "application/json",
101
+ }));
102
+
103
+ const secConfig = await extractSecurity(client._options.apiKey);
104
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
105
+ const requestSecurity = resolveGlobalSecurity(securityInput);
106
+
107
+ const context = {
108
+ options: client._options,
109
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
110
+ operationID: "GuardrailRuleGet",
111
+ oAuth2Scopes: null,
112
+
113
+ resolvedSecurity: requestSecurity,
114
+
115
+ securitySource: client._options.apiKey,
116
+ retryConfig: options?.retries
117
+ || client._options.retryConfig
118
+ || { strategy: "none" },
119
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
120
+ };
121
+
122
+ const requestRes = client._createRequest(context, {
123
+ security: requestSecurity,
124
+ method: "GET",
125
+ baseURL: options?.serverURL,
126
+ path: path,
127
+ headers: headers,
128
+ body: body,
129
+ userAgent: client._options.userAgent,
130
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
131
+ }, options);
132
+ if (!requestRes.ok) {
133
+ return [requestRes, { status: "invalid" }];
134
+ }
135
+ const req = requestRes.value;
136
+
137
+ const doResult = await client._do(req, {
138
+ context,
139
+ errorCodes: ["404", "4XX", "5XX"],
140
+ retryConfig: context.retryConfig,
141
+ retryCodes: context.retryCodes,
142
+ });
143
+ if (!doResult.ok) {
144
+ return [doResult, { status: "request-error", request: req }];
145
+ }
146
+ const response = doResult.value;
147
+
148
+ const [result] = await M.match<
149
+ operations.GuardrailRuleGetResponseBody,
150
+ | OrqError
151
+ | ResponseValidationError
152
+ | ConnectionError
153
+ | RequestAbortedError
154
+ | RequestTimeoutError
155
+ | InvalidRequestError
156
+ | UnexpectedClientError
157
+ | SDKValidationError
158
+ >(
159
+ M.json(200, operations.GuardrailRuleGetResponseBody$inboundSchema),
160
+ M.fail([404, "4XX"]),
161
+ M.fail("5XX"),
162
+ )(response, req);
163
+ if (!result.ok) {
164
+ return [result, { status: "complete", request: req, response }];
165
+ }
166
+
167
+ return [result, { status: "complete", request: req, response }];
168
+ }
@@ -0,0 +1,170 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeFormQuery } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { OrqError } from "../models/errors/orqerror.js";
21
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * List guardrail rules
29
+ *
30
+ * @remarks
31
+ * Returns a paginated list of guardrail rules for the current project.
32
+ */
33
+ export function guardrailRulesList(
34
+ client: OrqCore,
35
+ request?: operations.GuardrailRuleListRequest | undefined,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.GuardrailRuleListResponseBody,
40
+ | OrqError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: OrqCore,
59
+ request?: operations.GuardrailRuleListRequest | undefined,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ operations.GuardrailRuleListResponseBody,
65
+ | OrqError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) =>
80
+ operations.GuardrailRuleListRequest$outboundSchema.optional().parse(
81
+ value,
82
+ ),
83
+ "Input validation failed",
84
+ );
85
+ if (!parsed.ok) {
86
+ return [parsed, { status: "invalid" }];
87
+ }
88
+ const payload = parsed.value;
89
+ const body = null;
90
+
91
+ const path = pathToFunc("/v2/guardrail-rules")();
92
+
93
+ const query = encodeFormQuery({
94
+ "ending_before": payload?.ending_before,
95
+ "limit": payload?.limit,
96
+ "project_id": payload?.project_id,
97
+ "starting_after": payload?.starting_after,
98
+ }, { explode: false });
99
+
100
+ const headers = new Headers(compactMap({
101
+ Accept: "application/json",
102
+ }));
103
+
104
+ const secConfig = await extractSecurity(client._options.apiKey);
105
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
106
+ const requestSecurity = resolveGlobalSecurity(securityInput);
107
+
108
+ const context = {
109
+ options: client._options,
110
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
111
+ operationID: "GuardrailRuleList",
112
+ oAuth2Scopes: null,
113
+
114
+ resolvedSecurity: requestSecurity,
115
+
116
+ securitySource: client._options.apiKey,
117
+ retryConfig: options?.retries
118
+ || client._options.retryConfig
119
+ || { strategy: "none" },
120
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
121
+ };
122
+
123
+ const requestRes = client._createRequest(context, {
124
+ security: requestSecurity,
125
+ method: "GET",
126
+ baseURL: options?.serverURL,
127
+ path: path,
128
+ headers: headers,
129
+ query: query,
130
+ body: body,
131
+ userAgent: client._options.userAgent,
132
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req = requestRes.value;
138
+
139
+ const doResult = await client._do(req, {
140
+ context,
141
+ errorCodes: ["4XX", "5XX"],
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req }];
147
+ }
148
+ const response = doResult.value;
149
+
150
+ const [result] = await M.match<
151
+ operations.GuardrailRuleListResponseBody,
152
+ | OrqError
153
+ | ResponseValidationError
154
+ | ConnectionError
155
+ | RequestAbortedError
156
+ | RequestTimeoutError
157
+ | InvalidRequestError
158
+ | UnexpectedClientError
159
+ | SDKValidationError
160
+ >(
161
+ M.json(200, operations.GuardrailRuleListResponseBody$inboundSchema),
162
+ M.fail("4XX"),
163
+ M.fail("5XX"),
164
+ )(response, req);
165
+ if (!result.ok) {
166
+ return [result, { status: "complete", request: req, response }];
167
+ }
168
+
169
+ return [result, { status: "complete", request: req, response }];
170
+ }
@@ -0,0 +1,170 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { OrqError } from "../models/errors/orqerror.js";
21
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Update guardrail rule
29
+ *
30
+ * @remarks
31
+ * Partially updates an existing guardrail rule. Only provided fields are updated.
32
+ */
33
+ export function guardrailRulesUpdate(
34
+ client: OrqCore,
35
+ request: operations.GuardrailRuleUpdateRequest,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.GuardrailRuleUpdateResponseBody,
40
+ | OrqError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: OrqCore,
59
+ request: operations.GuardrailRuleUpdateRequest,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ operations.GuardrailRuleUpdateResponseBody,
65
+ | OrqError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) =>
80
+ operations.GuardrailRuleUpdateRequest$outboundSchema.parse(value),
81
+ "Input validation failed",
82
+ );
83
+ if (!parsed.ok) {
84
+ return [parsed, { status: "invalid" }];
85
+ }
86
+ const payload = parsed.value;
87
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
88
+
89
+ const pathParams = {
90
+ guardrail_rule_id: encodeSimple(
91
+ "guardrail_rule_id",
92
+ payload.guardrail_rule_id,
93
+ { explode: false, charEncoding: "percent" },
94
+ ),
95
+ };
96
+ const path = pathToFunc("/v2/guardrail-rules/{guardrail_rule_id}")(
97
+ pathParams,
98
+ );
99
+
100
+ const headers = new Headers(compactMap({
101
+ "Content-Type": "application/json",
102
+ Accept: "application/json",
103
+ }));
104
+
105
+ const secConfig = await extractSecurity(client._options.apiKey);
106
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
107
+ const requestSecurity = resolveGlobalSecurity(securityInput);
108
+
109
+ const context = {
110
+ options: client._options,
111
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
112
+ operationID: "GuardrailRuleUpdate",
113
+ oAuth2Scopes: null,
114
+
115
+ resolvedSecurity: requestSecurity,
116
+
117
+ securitySource: client._options.apiKey,
118
+ retryConfig: options?.retries
119
+ || client._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
122
+ };
123
+
124
+ const requestRes = client._createRequest(context, {
125
+ security: requestSecurity,
126
+ method: "PATCH",
127
+ baseURL: options?.serverURL,
128
+ path: path,
129
+ headers: headers,
130
+ body: body,
131
+ userAgent: client._options.userAgent,
132
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req = requestRes.value;
138
+
139
+ const doResult = await client._do(req, {
140
+ context,
141
+ errorCodes: ["400", "404", "4XX", "5XX"],
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req }];
147
+ }
148
+ const response = doResult.value;
149
+
150
+ const [result] = await M.match<
151
+ operations.GuardrailRuleUpdateResponseBody,
152
+ | OrqError
153
+ | ResponseValidationError
154
+ | ConnectionError
155
+ | RequestAbortedError
156
+ | RequestTimeoutError
157
+ | InvalidRequestError
158
+ | UnexpectedClientError
159
+ | SDKValidationError
160
+ >(
161
+ M.json(200, operations.GuardrailRuleUpdateResponseBody$inboundSchema),
162
+ M.fail([400, 404, "4XX"]),
163
+ M.fail("5XX"),
164
+ )(response, req);
165
+ if (!result.ok) {
166
+ return [result, { status: "complete", request: req, response }];
167
+ }
168
+
169
+ return [result, { status: "complete", request: req, response }];
170
+ }