@orq-ai/node 4.11.0 → 4.11.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 (181) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +2 -2
  3. package/lib/config.js +2 -2
  4. package/models/components/evaluatorresponsefunction.js +2 -2
  5. package/models/components/evaluatorresponsehttp.js +2 -2
  6. package/models/components/evaluatorresponsejsonschema.js +2 -2
  7. package/models/components/evaluatorresponsellm.js +2 -2
  8. package/models/components/evaluatorresponsepython.js +2 -2
  9. package/models/components/evaluatorresponseragas.js +2 -2
  10. package/models/components/evaluatorresponsetypescript.js +2 -2
  11. package/models/components/reasoningpart.js +1 -1
  12. package/models/operations/createdataset.js +1 -1
  13. package/models/operations/createdatasetitem.js +4 -4
  14. package/models/operations/createdatasource.js +1 -1
  15. package/models/operations/createtool.js +6 -6
  16. package/models/operations/getalltools.js +6 -6
  17. package/models/operations/getv2humanevalsets.js +2 -2
  18. package/models/operations/getv2humanevalsetsid.js +2 -2
  19. package/models/operations/listdatasetdatapoints.js +4 -4
  20. package/models/operations/listdatasets.js +1 -1
  21. package/models/operations/listdatasources.js +1 -1
  22. package/models/operations/patchv2humanevalsetsid.js +2 -2
  23. package/models/operations/postv2feedbackevaluation.js +3 -3
  24. package/models/operations/postv2humanevalsets.js +2 -2
  25. package/models/operations/retrievedatapoint.js +4 -4
  26. package/models/operations/retrievedataset.js +1 -1
  27. package/models/operations/retrievedatasource.js +1 -1
  28. package/models/operations/retrievetool.js +6 -6
  29. package/models/operations/runagent.js +1 -1
  30. package/models/operations/streamrunagent.js +1 -1
  31. package/models/operations/updatedatapoint.js +4 -4
  32. package/models/operations/updatedataset.js +1 -1
  33. package/models/operations/updatedatasource.js +1 -1
  34. package/models/operations/updatetool.js +7 -7
  35. package/package.json +3 -3
  36. package/packages/orq-rc/src/funcs/notifiersCreate.ts +162 -0
  37. package/packages/orq-rc/src/funcs/notifiersDelete.ts +168 -0
  38. package/packages/orq-rc/src/funcs/notifiersGet.ts +168 -0
  39. package/packages/orq-rc/src/funcs/notifiersList.ts +171 -0
  40. package/packages/orq-rc/src/funcs/notifiersUpdate.ts +171 -0
  41. package/packages/orq-rc/src/funcs/tracesAggregate.ts +162 -0
  42. package/packages/orq-rc/src/funcs/tracesGet.ts +168 -0
  43. package/packages/orq-rc/src/funcs/tracesGetSpan.ts +172 -0
  44. package/packages/orq-rc/src/funcs/tracesListFacetValues.ts +177 -0
  45. package/packages/orq-rc/src/funcs/tracesListFacets.ts +144 -0
  46. package/packages/orq-rc/src/funcs/tracesListFields.ts +144 -0
  47. package/packages/orq-rc/src/funcs/tracesListSpans.ts +174 -0
  48. package/packages/orq-rc/src/funcs/tracesQuery.ts +162 -0
  49. package/packages/orq-rc/src/funcs/tracesSearch.ts +162 -0
  50. package/packages/orq-rc/src/lib/config.ts +3 -3
  51. package/packages/orq-rc/src/models/components/actionreviewrequestedstreamingevent.ts +5 -0
  52. package/packages/orq-rc/src/models/components/agentstartedstreamingevent.ts +5 -0
  53. package/packages/orq-rc/src/models/components/aggregatetracesrequest.ts +65 -0
  54. package/packages/orq-rc/src/models/components/aggregatetracesresponse.ts +37 -0
  55. package/packages/orq-rc/src/models/components/createnotifierrequest.ts +433 -0
  56. package/packages/orq-rc/src/models/components/createnotifierresponse.ts +35 -0
  57. package/packages/orq-rc/src/models/components/deletenotifierresponse.ts +27 -0
  58. package/packages/orq-rc/src/models/components/evaluatorresponsefunction.ts +2 -2
  59. package/packages/orq-rc/src/models/components/evaluatorresponsehttp.ts +2 -2
  60. package/packages/orq-rc/src/models/components/evaluatorresponsejsonschema.ts +2 -2
  61. package/packages/orq-rc/src/models/components/evaluatorresponsellm.ts +2 -2
  62. package/packages/orq-rc/src/models/components/evaluatorresponsepython.ts +2 -2
  63. package/packages/orq-rc/src/models/components/evaluatorresponseragas.ts +2 -2
  64. package/packages/orq-rc/src/models/components/evaluatorresponsetypescript.ts +2 -2
  65. package/packages/orq-rc/src/models/components/getnotifierresponse.ts +35 -0
  66. package/packages/orq-rc/src/models/components/gettraceresponse.ts +32 -0
  67. package/packages/orq-rc/src/models/components/gettracespanresponse.ts +32 -0
  68. package/packages/orq-rc/src/models/components/index.ts +36 -0
  69. package/packages/orq-rc/src/models/components/listnotifiersresponse.ts +50 -0
  70. package/packages/orq-rc/src/models/components/listtracefacetsresponse.ts +32 -0
  71. package/packages/orq-rc/src/models/components/listtracefacetvaluesresponse.ts +44 -0
  72. package/packages/orq-rc/src/models/components/listtracefieldsresponse.ts +32 -0
  73. package/packages/orq-rc/src/models/components/listtracespansresponse.ts +44 -0
  74. package/packages/orq-rc/src/models/components/notifier.ts +465 -0
  75. package/packages/orq-rc/src/models/components/notifiertype.ts +21 -0
  76. package/packages/orq-rc/src/models/components/querytracesrequest.ts +48 -0
  77. package/packages/orq-rc/src/models/components/querytracesresponse.ts +37 -0
  78. package/packages/orq-rc/src/models/components/reasoningpart.ts +1 -1
  79. package/packages/orq-rc/src/models/components/searchtracesrequest.ts +68 -0
  80. package/packages/orq-rc/src/models/components/searchtracesresponse.ts +72 -0
  81. package/packages/orq-rc/src/models/components/spandetail.ts +53 -0
  82. package/packages/orq-rc/src/models/components/spansummary.ts +76 -0
  83. package/packages/orq-rc/src/models/components/traceagent.ts +33 -0
  84. package/packages/orq-rc/src/models/components/traceaggregaterow.ts +33 -0
  85. package/packages/orq-rc/src/models/components/tracecompute.ts +30 -0
  86. package/packages/orq-rc/src/models/components/tracecontext.ts +39 -0
  87. package/packages/orq-rc/src/models/components/tracecost.ts +77 -0
  88. package/packages/orq-rc/src/models/components/tracefacet.ts +35 -0
  89. package/packages/orq-rc/src/models/components/tracefacetvalue.ts +33 -0
  90. package/packages/orq-rc/src/models/components/tracefield.ts +56 -0
  91. package/packages/orq-rc/src/models/components/tracefilter.ts +33 -0
  92. package/packages/orq-rc/src/models/components/tracesearchmeta.ts +45 -0
  93. package/packages/orq-rc/src/models/components/tracesort.ts +30 -0
  94. package/packages/orq-rc/src/models/components/tracesummary.ts +152 -0
  95. package/packages/orq-rc/src/models/components/traceusage.ts +62 -0
  96. package/packages/orq-rc/src/models/components/updatenotifierrequest.ts +130 -0
  97. package/packages/orq-rc/src/models/components/updatenotifierresponse.ts +35 -0
  98. package/packages/orq-rc/src/models/operations/createagentrequest.ts +77 -0
  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/createprompt.ts +2 -0
  103. package/packages/orq-rc/src/models/operations/createtool.ts +6 -6
  104. package/packages/orq-rc/src/models/operations/deploymentinvoke.ts +2 -0
  105. package/packages/orq-rc/src/models/operations/deployments.ts +2 -0
  106. package/packages/orq-rc/src/models/operations/deploymentstream.ts +2 -0
  107. package/packages/orq-rc/src/models/operations/getallprompts.ts +2 -0
  108. package/packages/orq-rc/src/models/operations/getalltools.ts +6 -6
  109. package/packages/orq-rc/src/models/operations/getoneprompt.ts +2 -0
  110. package/packages/orq-rc/src/models/operations/getpromptversion.ts +2 -0
  111. package/packages/orq-rc/src/models/operations/getv2humanevalsets.ts +2 -2
  112. package/packages/orq-rc/src/models/operations/getv2humanevalsetsid.ts +2 -2
  113. package/packages/orq-rc/src/models/operations/index.ts +8 -0
  114. package/packages/orq-rc/src/models/operations/listagents.ts +5 -0
  115. package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +4 -4
  116. package/packages/orq-rc/src/models/operations/listdatasets.ts +1 -1
  117. package/packages/orq-rc/src/models/operations/listdatasources.ts +1 -1
  118. package/packages/orq-rc/src/models/operations/listpromptversions.ts +2 -0
  119. package/packages/orq-rc/src/models/operations/notifierdelete.ts +36 -0
  120. package/packages/orq-rc/src/models/operations/notifierget.ts +36 -0
  121. package/packages/orq-rc/src/models/operations/notifierlist.ts +59 -0
  122. package/packages/orq-rc/src/models/operations/notifierupdate.ts +41 -0
  123. package/packages/orq-rc/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  124. package/packages/orq-rc/src/models/operations/postv2feedbackevaluation.ts +3 -3
  125. package/packages/orq-rc/src/models/operations/postv2humanevalsets.ts +2 -2
  126. package/packages/orq-rc/src/models/operations/retrieveagentrequest.ts +5 -0
  127. package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +4 -4
  128. package/packages/orq-rc/src/models/operations/retrievedataset.ts +1 -1
  129. package/packages/orq-rc/src/models/operations/retrievedatasource.ts +1 -1
  130. package/packages/orq-rc/src/models/operations/retrievetool.ts +6 -6
  131. package/packages/orq-rc/src/models/operations/runagent.ts +67 -1
  132. package/packages/orq-rc/src/models/operations/streamrunagent.ts +67 -1
  133. package/packages/orq-rc/src/models/operations/tracesget.ts +36 -0
  134. package/packages/orq-rc/src/models/operations/tracesgetspan.ts +40 -0
  135. package/packages/orq-rc/src/models/operations/traceslistfacetvalues.ts +50 -0
  136. package/packages/orq-rc/src/models/operations/traceslistspans.ts +43 -0
  137. package/packages/orq-rc/src/models/operations/updateagent.ts +77 -0
  138. package/packages/orq-rc/src/models/operations/updatedatapoint.ts +4 -4
  139. package/packages/orq-rc/src/models/operations/updatedataset.ts +1 -1
  140. package/packages/orq-rc/src/models/operations/updatedatasource.ts +1 -1
  141. package/packages/orq-rc/src/models/operations/updateprompt.ts +2 -0
  142. package/packages/orq-rc/src/models/operations/updatetool.ts +7 -7
  143. package/packages/orq-rc/src/sdk/feedback.ts +2 -2
  144. package/packages/orq-rc/src/sdk/notifiers.ts +100 -0
  145. package/packages/orq-rc/src/sdk/sdk.ts +12 -0
  146. package/packages/orq-rc/src/sdk/traces.ts +168 -0
  147. package/sdk/feedback.d.ts +2 -2
  148. package/sdk/feedback.js +2 -2
  149. package/src/lib/config.ts +2 -2
  150. package/src/models/components/evaluatorresponsefunction.ts +2 -2
  151. package/src/models/components/evaluatorresponsehttp.ts +2 -2
  152. package/src/models/components/evaluatorresponsejsonschema.ts +2 -2
  153. package/src/models/components/evaluatorresponsellm.ts +2 -2
  154. package/src/models/components/evaluatorresponsepython.ts +2 -2
  155. package/src/models/components/evaluatorresponseragas.ts +2 -2
  156. package/src/models/components/evaluatorresponsetypescript.ts +2 -2
  157. package/src/models/components/reasoningpart.ts +1 -1
  158. package/src/models/operations/createdataset.ts +1 -1
  159. package/src/models/operations/createdatasetitem.ts +4 -4
  160. package/src/models/operations/createdatasource.ts +1 -1
  161. package/src/models/operations/createtool.ts +6 -6
  162. package/src/models/operations/getalltools.ts +6 -6
  163. package/src/models/operations/getv2humanevalsets.ts +2 -2
  164. package/src/models/operations/getv2humanevalsetsid.ts +2 -2
  165. package/src/models/operations/listdatasetdatapoints.ts +4 -4
  166. package/src/models/operations/listdatasets.ts +1 -1
  167. package/src/models/operations/listdatasources.ts +1 -1
  168. package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  169. package/src/models/operations/postv2feedbackevaluation.ts +3 -3
  170. package/src/models/operations/postv2humanevalsets.ts +2 -2
  171. package/src/models/operations/retrievedatapoint.ts +4 -4
  172. package/src/models/operations/retrievedataset.ts +1 -1
  173. package/src/models/operations/retrievedatasource.ts +1 -1
  174. package/src/models/operations/retrievetool.ts +6 -6
  175. package/src/models/operations/runagent.ts +1 -1
  176. package/src/models/operations/streamrunagent.ts +1 -1
  177. package/src/models/operations/updatedatapoint.ts +4 -4
  178. package/src/models/operations/updatedataset.ts +1 -1
  179. package/src/models/operations/updatedatasource.ts +1 -1
  180. package/src/models/operations/updatetool.ts +7 -7
  181. package/src/sdk/feedback.ts +2 -2
@@ -0,0 +1,171 @@
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 { matchStatusCode } from "../lib/http.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 * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import { OrqError } from "../models/errors/orqerror.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * List notifiers
31
+ *
32
+ * @remarks
33
+ * Returns notifier destinations visible to the caller, ordered by creation time with the newest notifier first.
34
+ */
35
+ export function notifiersList(
36
+ client: OrqCore,
37
+ request?: operations.NotifierListRequest | undefined,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.ListNotifiersResponse,
42
+ | OrqError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: OrqCore,
61
+ request?: operations.NotifierListRequest | undefined,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ components.ListNotifiersResponse,
67
+ | OrqError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) =>
82
+ operations.NotifierListRequest$outboundSchema.optional().parse(value),
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/notifiers")();
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
+ });
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: "NotifierList",
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
+ isErrorStatusCode: (statusCode: number) =>
142
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
143
+ retryConfig: context.retryConfig,
144
+ retryCodes: context.retryCodes,
145
+ });
146
+ if (!doResult.ok) {
147
+ return [doResult, { status: "request-error", request: req }];
148
+ }
149
+ const response = doResult.value;
150
+
151
+ const [result] = await M.match<
152
+ components.ListNotifiersResponse,
153
+ | OrqError
154
+ | ResponseValidationError
155
+ | ConnectionError
156
+ | RequestAbortedError
157
+ | RequestTimeoutError
158
+ | InvalidRequestError
159
+ | UnexpectedClientError
160
+ | SDKValidationError
161
+ >(
162
+ M.json(200, components.ListNotifiersResponse$inboundSchema),
163
+ M.fail("4XX"),
164
+ M.fail("5XX"),
165
+ )(response, req);
166
+ if (!result.ok) {
167
+ return [result, { status: "complete", request: req, response }];
168
+ }
169
+
170
+ return [result, { status: "complete", request: req, response }];
171
+ }
@@ -0,0 +1,171 @@
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 { matchStatusCode } from "../lib/http.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 * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import { OrqError } from "../models/errors/orqerror.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Update a notifier
31
+ *
32
+ * @remarks
33
+ * Partially updates an existing notifier. When changing `type`, provide the destination fields required by the new notifier type.
34
+ */
35
+ export function notifiersUpdate(
36
+ client: OrqCore,
37
+ request: operations.NotifierUpdateRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.UpdateNotifierResponse,
42
+ | OrqError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: OrqCore,
61
+ request: operations.NotifierUpdateRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ components.UpdateNotifierResponse,
67
+ | OrqError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) => operations.NotifierUpdateRequest$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 = encodeJSON("body", payload.UpdateNotifierRequest, {
89
+ explode: true,
90
+ });
91
+
92
+ const pathParams = {
93
+ notifier_id: encodeSimple("notifier_id", payload.notifier_id, {
94
+ explode: false,
95
+ charEncoding: "percent",
96
+ }),
97
+ };
98
+ const path = pathToFunc("/v2/notifiers/{notifier_id}")(pathParams);
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: "NotifierUpdate",
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
+ isErrorStatusCode: (statusCode: number) =>
142
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
143
+ retryConfig: context.retryConfig,
144
+ retryCodes: context.retryCodes,
145
+ });
146
+ if (!doResult.ok) {
147
+ return [doResult, { status: "request-error", request: req }];
148
+ }
149
+ const response = doResult.value;
150
+
151
+ const [result] = await M.match<
152
+ components.UpdateNotifierResponse,
153
+ | OrqError
154
+ | ResponseValidationError
155
+ | ConnectionError
156
+ | RequestAbortedError
157
+ | RequestTimeoutError
158
+ | InvalidRequestError
159
+ | UnexpectedClientError
160
+ | SDKValidationError
161
+ >(
162
+ M.json(200, components.UpdateNotifierResponse$inboundSchema),
163
+ M.fail("4XX"),
164
+ M.fail("5XX"),
165
+ )(response, req);
166
+ if (!result.ok) {
167
+ return [result, { status: "complete", request: req, response }];
168
+ }
169
+
170
+ return [result, { status: "complete", request: req, response }];
171
+ }
@@ -0,0 +1,162 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.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 * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import { OrqError } from "../models/errors/orqerror.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Aggregate traces
30
+ *
31
+ * @remarks
32
+ * Aggregate trace metrics using the structured trace filter contract.
33
+ */
34
+ export function tracesAggregate(
35
+ client: OrqCore,
36
+ request: components.AggregateTracesRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ components.AggregateTracesResponse,
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: components.AggregateTracesRequest,
61
+ options?: RequestOptions,
62
+ ): Promise<
63
+ [
64
+ Result<
65
+ components.AggregateTracesResponse,
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) => components.AggregateTracesRequest$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, { explode: true });
88
+
89
+ const path = pathToFunc("/v2/traces/aggregate")();
90
+
91
+ const headers = new Headers(compactMap({
92
+ "Content-Type": "application/json",
93
+ Accept: "application/json",
94
+ }));
95
+
96
+ const secConfig = await extractSecurity(client._options.apiKey);
97
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
98
+ const requestSecurity = resolveGlobalSecurity(securityInput);
99
+
100
+ const context = {
101
+ options: client._options,
102
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
103
+ operationID: "TracesAggregate",
104
+ oAuth2Scopes: null,
105
+
106
+ resolvedSecurity: requestSecurity,
107
+
108
+ securitySource: client._options.apiKey,
109
+ retryConfig: options?.retries
110
+ || client._options.retryConfig
111
+ || { strategy: "none" },
112
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
113
+ };
114
+
115
+ const requestRes = client._createRequest(context, {
116
+ security: requestSecurity,
117
+ method: "POST",
118
+ baseURL: options?.serverURL,
119
+ path: path,
120
+ headers: headers,
121
+ body: body,
122
+ userAgent: client._options.userAgent,
123
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
124
+ }, options);
125
+ if (!requestRes.ok) {
126
+ return [requestRes, { status: "invalid" }];
127
+ }
128
+ const req = requestRes.value;
129
+
130
+ const doResult = await client._do(req, {
131
+ context,
132
+ isErrorStatusCode: (statusCode: number) =>
133
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
134
+ retryConfig: context.retryConfig,
135
+ retryCodes: context.retryCodes,
136
+ });
137
+ if (!doResult.ok) {
138
+ return [doResult, { status: "request-error", request: req }];
139
+ }
140
+ const response = doResult.value;
141
+
142
+ const [result] = await M.match<
143
+ components.AggregateTracesResponse,
144
+ | OrqError
145
+ | ResponseValidationError
146
+ | ConnectionError
147
+ | RequestAbortedError
148
+ | RequestTimeoutError
149
+ | InvalidRequestError
150
+ | UnexpectedClientError
151
+ | SDKValidationError
152
+ >(
153
+ M.json(200, components.AggregateTracesResponse$inboundSchema),
154
+ M.fail("4XX"),
155
+ M.fail("5XX"),
156
+ )(response, req);
157
+ if (!result.ok) {
158
+ return [result, { status: "complete", request: req, response }];
159
+ }
160
+
161
+ return [result, { status: "complete", request: req, response }];
162
+ }
@@ -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 { matchStatusCode } from "../lib/http.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 * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import { OrqError } from "../models/errors/orqerror.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Get trace
31
+ *
32
+ * @remarks
33
+ * Retrieve one trace summary by trace id.
34
+ */
35
+ export function tracesGet(
36
+ client: OrqCore,
37
+ request: operations.TracesGetRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.GetTraceResponse,
42
+ | OrqError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: OrqCore,
61
+ request: operations.TracesGetRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ components.GetTraceResponse,
67
+ | OrqError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) => operations.TracesGetRequest$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
+ trace_id: encodeSimple("trace_id", payload.trace_id, {
92
+ explode: false,
93
+ charEncoding: "percent",
94
+ }),
95
+ };
96
+ const path = pathToFunc("/v2/traces/{trace_id}")(pathParams);
97
+
98
+ const headers = new Headers(compactMap({
99
+ Accept: "application/json",
100
+ }));
101
+
102
+ const secConfig = await extractSecurity(client._options.apiKey);
103
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
104
+ const requestSecurity = resolveGlobalSecurity(securityInput);
105
+
106
+ const context = {
107
+ options: client._options,
108
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
109
+ operationID: "TracesGet",
110
+ oAuth2Scopes: null,
111
+
112
+ resolvedSecurity: requestSecurity,
113
+
114
+ securitySource: client._options.apiKey,
115
+ retryConfig: options?.retries
116
+ || client._options.retryConfig
117
+ || { strategy: "none" },
118
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
119
+ };
120
+
121
+ const requestRes = client._createRequest(context, {
122
+ security: requestSecurity,
123
+ method: "GET",
124
+ baseURL: options?.serverURL,
125
+ path: path,
126
+ headers: headers,
127
+ body: body,
128
+ userAgent: client._options.userAgent,
129
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
130
+ }, options);
131
+ if (!requestRes.ok) {
132
+ return [requestRes, { status: "invalid" }];
133
+ }
134
+ const req = requestRes.value;
135
+
136
+ const doResult = await client._do(req, {
137
+ context,
138
+ isErrorStatusCode: (statusCode: number) =>
139
+ matchStatusCode({ status: statusCode } as Response, ["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
+ components.GetTraceResponse,
150
+ | OrqError
151
+ | ResponseValidationError
152
+ | ConnectionError
153
+ | RequestAbortedError
154
+ | RequestTimeoutError
155
+ | InvalidRequestError
156
+ | UnexpectedClientError
157
+ | SDKValidationError
158
+ >(
159
+ M.json(200, components.GetTraceResponse$inboundSchema),
160
+ M.fail("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
+ }