vellum-ai 0.6.8 → 0.6.12

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 (238) hide show
  1. package/Client.d.ts +9 -6
  2. package/Client.js +40 -37
  3. package/api/client/requests/ExecutePromptRequest.d.ts +7 -5
  4. package/api/client/requests/ExecutePromptStreamRequest.d.ts +7 -5
  5. package/api/resources/deployments/client/Client.d.ts +8 -5
  6. package/api/resources/deployments/client/Client.js +22 -17
  7. package/api/resources/documentIndexes/client/Client.d.ts +21 -7
  8. package/api/resources/documentIndexes/client/Client.js +77 -26
  9. package/api/resources/documents/client/Client.d.ts +11 -7
  10. package/api/resources/documents/client/Client.js +25 -22
  11. package/api/resources/folderEntities/client/Client.d.ts +4 -1
  12. package/api/resources/folderEntities/client/Client.js +4 -3
  13. package/api/resources/sandboxes/client/Client.d.ts +7 -4
  14. package/api/resources/sandboxes/client/Client.js +14 -13
  15. package/api/resources/testSuiteRuns/client/Client.d.ts +6 -3
  16. package/api/resources/testSuiteRuns/client/Client.js +13 -10
  17. package/api/resources/testSuites/client/Client.d.ts +6 -3
  18. package/api/resources/testSuites/client/Client.js +16 -14
  19. package/api/resources/testSuites/client/requests/index.d.ts +0 -1
  20. package/api/resources/workflowDeployments/client/Client.d.ts +7 -4
  21. package/api/resources/workflowDeployments/client/Client.js +17 -13
  22. package/api/resources/workflowSandboxes/client/Client.d.ts +4 -1
  23. package/api/resources/workflowSandboxes/client/Client.js +5 -6
  24. package/api/types/IterationStateEnum.d.ts +12 -0
  25. package/api/types/IterationStateEnum.js +10 -0
  26. package/api/types/MapNodeResultData.d.ts +2 -0
  27. package/api/types/MergeNodeResult.d.ts +2 -0
  28. package/api/types/MergeNodeResultData.d.ts +6 -0
  29. package/api/types/PromptNodeResultData.d.ts +1 -0
  30. package/api/types/TestSuiteRunExecutionArrayOutput.d.ts +12 -0
  31. package/api/types/TestSuiteRunExecutionOutput.d.ts +4 -1
  32. package/api/types/TestSuiteRunMetricNumberOutput.d.ts +1 -1
  33. package/api/types/TestSuiteRunMetricStringOutput.d.ts +1 -1
  34. package/api/types/TestSuiteTestCaseBulkOperationRequest.d.ts +4 -1
  35. package/api/types/TestSuiteTestCaseRejectedBulkResult.d.ts +1 -1
  36. package/api/types/TestSuiteTestCaseUpsertBulkOperationRequest.d.ts +12 -0
  37. package/api/types/TestSuiteTestCaseUpsertBulkOperationRequest.js +5 -0
  38. package/api/types/UpsertEnum.d.ts +4 -0
  39. package/api/types/UpsertEnum.js +5 -0
  40. package/api/{resources/testSuites/client/requests → types}/UpsertTestSuiteTestCaseRequest.d.ts +2 -9
  41. package/api/types/UpsertTestSuiteTestCaseRequest.js +5 -0
  42. package/api/types/index.d.ts +6 -0
  43. package/api/types/index.js +6 -0
  44. package/core/fetcher/Fetcher.d.ts +2 -0
  45. package/core/fetcher/Fetcher.js +19 -185
  46. package/core/fetcher/createRequestUrl.d.ts +1 -0
  47. package/core/fetcher/createRequestUrl.js +13 -0
  48. package/core/fetcher/getFetchFn.d.ts +4 -0
  49. package/core/fetcher/getFetchFn.js +55 -0
  50. package/core/fetcher/getRequestBody.d.ts +7 -0
  51. package/core/fetcher/getRequestBody.js +23 -0
  52. package/core/fetcher/getResponseBody.d.ts +1 -0
  53. package/core/fetcher/getResponseBody.js +48 -0
  54. package/core/fetcher/makeRequest.d.ts +1 -0
  55. package/core/fetcher/makeRequest.js +40 -0
  56. package/core/fetcher/requestWithRetries.d.ts +1 -0
  57. package/core/fetcher/requestWithRetries.js +32 -0
  58. package/core/fetcher/signals.d.ts +12 -0
  59. package/core/fetcher/signals.js +37 -0
  60. package/core/form-data-utils/FormDataWrapper.d.ts +10 -21
  61. package/core/form-data-utils/FormDataWrapper.js +82 -49
  62. package/core/runtime/runtime.d.ts +1 -0
  63. package/core/runtime/runtime.js +1 -0
  64. package/core/schemas/Schema.d.ts +7 -4
  65. package/core/schemas/builders/lazy/lazy.d.ts +2 -2
  66. package/core/schemas/builders/lazy/lazy.js +8 -19
  67. package/core/schemas/builders/lazy/lazyObject.js +1 -10
  68. package/core/schemas/builders/list/list.js +31 -44
  69. package/core/schemas/builders/object/object.js +90 -111
  70. package/core/schemas/builders/object/types.d.ts +2 -2
  71. package/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
  72. package/core/schemas/builders/record/record.js +49 -60
  73. package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
  74. package/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
  75. package/core/schemas/builders/set/set.js +6 -15
  76. package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
  77. package/core/schemas/builders/union/union.js +51 -62
  78. package/core/schemas/utils/maybeSkipValidation.js +3 -12
  79. package/dist/Client.d.ts +9 -6
  80. package/dist/Client.js +40 -37
  81. package/dist/api/client/requests/ExecutePromptRequest.d.ts +7 -5
  82. package/dist/api/client/requests/ExecutePromptStreamRequest.d.ts +7 -5
  83. package/dist/api/resources/deployments/client/Client.d.ts +8 -5
  84. package/dist/api/resources/deployments/client/Client.js +22 -17
  85. package/dist/api/resources/documentIndexes/client/Client.d.ts +21 -7
  86. package/dist/api/resources/documentIndexes/client/Client.js +77 -26
  87. package/dist/api/resources/documents/client/Client.d.ts +11 -7
  88. package/dist/api/resources/documents/client/Client.js +25 -22
  89. package/dist/api/resources/folderEntities/client/Client.d.ts +4 -1
  90. package/dist/api/resources/folderEntities/client/Client.js +4 -3
  91. package/dist/api/resources/sandboxes/client/Client.d.ts +7 -4
  92. package/dist/api/resources/sandboxes/client/Client.js +14 -13
  93. package/dist/api/resources/testSuiteRuns/client/Client.d.ts +6 -3
  94. package/dist/api/resources/testSuiteRuns/client/Client.js +13 -10
  95. package/dist/api/resources/testSuites/client/Client.d.ts +6 -3
  96. package/dist/api/resources/testSuites/client/Client.js +16 -14
  97. package/dist/api/resources/testSuites/client/requests/index.d.ts +0 -1
  98. package/dist/api/resources/workflowDeployments/client/Client.d.ts +7 -4
  99. package/dist/api/resources/workflowDeployments/client/Client.js +17 -13
  100. package/dist/api/resources/workflowSandboxes/client/Client.d.ts +4 -1
  101. package/dist/api/resources/workflowSandboxes/client/Client.js +5 -6
  102. package/dist/api/types/IterationStateEnum.d.ts +12 -0
  103. package/dist/api/types/IterationStateEnum.js +10 -0
  104. package/dist/api/types/MapNodeResultData.d.ts +2 -0
  105. package/dist/api/types/MergeNodeResult.d.ts +2 -0
  106. package/dist/api/types/MergeNodeResultData.d.ts +6 -0
  107. package/dist/api/types/MergeNodeResultData.js +5 -0
  108. package/dist/api/types/PromptNodeResultData.d.ts +1 -0
  109. package/dist/api/types/TestSuiteRunExecutionArrayOutput.d.ts +12 -0
  110. package/dist/api/types/TestSuiteRunExecutionArrayOutput.js +5 -0
  111. package/dist/api/types/TestSuiteRunExecutionOutput.d.ts +4 -1
  112. package/dist/api/types/TestSuiteRunMetricNumberOutput.d.ts +1 -1
  113. package/dist/api/types/TestSuiteRunMetricStringOutput.d.ts +1 -1
  114. package/dist/api/types/TestSuiteTestCaseBulkOperationRequest.d.ts +4 -1
  115. package/dist/api/types/TestSuiteTestCaseRejectedBulkResult.d.ts +1 -1
  116. package/dist/api/types/TestSuiteTestCaseUpsertBulkOperationRequest.d.ts +12 -0
  117. package/dist/api/types/TestSuiteTestCaseUpsertBulkOperationRequest.js +5 -0
  118. package/dist/api/types/UpsertEnum.d.ts +4 -0
  119. package/dist/api/types/UpsertEnum.js +5 -0
  120. package/dist/api/{resources/testSuites/client/requests → types}/UpsertTestSuiteTestCaseRequest.d.ts +2 -9
  121. package/dist/api/types/UpsertTestSuiteTestCaseRequest.js +5 -0
  122. package/dist/api/types/index.d.ts +6 -0
  123. package/dist/api/types/index.js +6 -0
  124. package/dist/core/fetcher/Fetcher.d.ts +2 -0
  125. package/dist/core/fetcher/Fetcher.js +19 -185
  126. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  127. package/dist/core/fetcher/createRequestUrl.js +13 -0
  128. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  129. package/dist/core/fetcher/getFetchFn.js +55 -0
  130. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  131. package/dist/core/fetcher/getRequestBody.js +23 -0
  132. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  133. package/dist/core/fetcher/getResponseBody.js +48 -0
  134. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  135. package/dist/core/fetcher/makeRequest.js +40 -0
  136. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  137. package/dist/core/fetcher/requestWithRetries.js +32 -0
  138. package/dist/core/fetcher/signals.d.ts +12 -0
  139. package/dist/core/fetcher/signals.js +37 -0
  140. package/dist/core/form-data-utils/FormDataWrapper.d.ts +10 -21
  141. package/dist/core/form-data-utils/FormDataWrapper.js +82 -49
  142. package/dist/core/runtime/runtime.d.ts +1 -0
  143. package/dist/core/runtime/runtime.js +1 -0
  144. package/dist/core/schemas/Schema.d.ts +7 -4
  145. package/dist/core/schemas/builders/lazy/lazy.d.ts +2 -2
  146. package/dist/core/schemas/builders/lazy/lazy.js +8 -19
  147. package/dist/core/schemas/builders/lazy/lazyObject.js +1 -10
  148. package/dist/core/schemas/builders/list/list.js +31 -44
  149. package/dist/core/schemas/builders/object/object.js +90 -111
  150. package/dist/core/schemas/builders/object/types.d.ts +2 -2
  151. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
  152. package/dist/core/schemas/builders/record/record.js +49 -60
  153. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
  154. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
  155. package/dist/core/schemas/builders/set/set.js +6 -15
  156. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
  157. package/dist/core/schemas/builders/union/union.js +51 -62
  158. package/dist/core/schemas/utils/maybeSkipValidation.js +3 -12
  159. package/dist/serialization/resources/index.d.ts +0 -1
  160. package/dist/serialization/resources/index.js +0 -1
  161. package/dist/serialization/resources/testSuites/client/index.d.ts +0 -1
  162. package/dist/serialization/resources/testSuites/client/index.js +0 -4
  163. package/dist/serialization/types/IterationStateEnum.d.ts +10 -0
  164. package/dist/serialization/types/IterationStateEnum.js +31 -0
  165. package/dist/serialization/types/MapNodeResultData.d.ts +2 -0
  166. package/dist/serialization/types/MapNodeResultData.js +2 -0
  167. package/dist/serialization/types/MergeNodeResult.d.ts +2 -0
  168. package/dist/serialization/types/MergeNodeResult.js +4 -1
  169. package/dist/serialization/types/MergeNodeResultData.d.ts +12 -0
  170. package/dist/serialization/types/MergeNodeResultData.js +33 -0
  171. package/dist/serialization/types/MetadataFilterConfigRequest.js +2 -10
  172. package/dist/serialization/types/MetadataFilterRuleRequest.js +2 -10
  173. package/dist/serialization/types/PromptNodeResultData.d.ts +1 -0
  174. package/dist/serialization/types/PromptNodeResultData.js +1 -0
  175. package/dist/serialization/types/TestSuiteRunExecutionArrayOutput.d.ts +15 -0
  176. package/dist/serialization/types/TestSuiteRunExecutionArrayOutput.js +36 -0
  177. package/dist/serialization/types/TestSuiteRunExecutionOutput.d.ts +5 -1
  178. package/dist/serialization/types/TestSuiteRunExecutionOutput.js +2 -0
  179. package/dist/serialization/types/TestSuiteRunMetricNumberOutput.d.ts +1 -1
  180. package/dist/serialization/types/TestSuiteRunMetricNumberOutput.js +1 -1
  181. package/dist/serialization/types/TestSuiteRunMetricStringOutput.d.ts +1 -1
  182. package/dist/serialization/types/TestSuiteRunMetricStringOutput.js +1 -1
  183. package/dist/serialization/types/TestSuiteTestCaseBulkOperationRequest.d.ts +5 -1
  184. package/dist/serialization/types/TestSuiteTestCaseBulkOperationRequest.js +2 -0
  185. package/dist/serialization/types/TestSuiteTestCaseRejectedBulkResult.d.ts +1 -1
  186. package/dist/serialization/types/TestSuiteTestCaseRejectedBulkResult.js +1 -1
  187. package/dist/serialization/types/TestSuiteTestCaseUpsertBulkOperationRequest.d.ts +14 -0
  188. package/dist/serialization/types/TestSuiteTestCaseUpsertBulkOperationRequest.js +35 -0
  189. package/dist/serialization/types/UpsertEnum.d.ts +10 -0
  190. package/dist/serialization/types/UpsertEnum.js +31 -0
  191. package/dist/serialization/{resources/testSuites/client/requests → types}/UpsertTestSuiteTestCaseRequest.d.ts +5 -5
  192. package/dist/serialization/{resources/testSuites/client/requests → types}/UpsertTestSuiteTestCaseRequest.js +3 -3
  193. package/dist/serialization/types/index.d.ts +6 -0
  194. package/dist/serialization/types/index.js +6 -0
  195. package/package.json +6 -1
  196. package/reference.md +2418 -0
  197. package/serialization/resources/index.d.ts +0 -1
  198. package/serialization/resources/index.js +0 -1
  199. package/serialization/resources/testSuites/client/index.d.ts +0 -1
  200. package/serialization/resources/testSuites/client/index.js +0 -4
  201. package/serialization/types/IterationStateEnum.d.ts +10 -0
  202. package/serialization/types/IterationStateEnum.js +31 -0
  203. package/serialization/types/MapNodeResultData.d.ts +2 -0
  204. package/serialization/types/MapNodeResultData.js +2 -0
  205. package/serialization/types/MergeNodeResult.d.ts +2 -0
  206. package/serialization/types/MergeNodeResult.js +4 -1
  207. package/serialization/types/MergeNodeResultData.d.ts +12 -0
  208. package/serialization/types/MergeNodeResultData.js +33 -0
  209. package/serialization/types/MetadataFilterConfigRequest.js +2 -10
  210. package/serialization/types/MetadataFilterRuleRequest.js +2 -10
  211. package/serialization/types/PromptNodeResultData.d.ts +1 -0
  212. package/serialization/types/PromptNodeResultData.js +1 -0
  213. package/serialization/types/TestSuiteRunExecutionArrayOutput.d.ts +15 -0
  214. package/serialization/types/TestSuiteRunExecutionArrayOutput.js +36 -0
  215. package/serialization/types/TestSuiteRunExecutionOutput.d.ts +5 -1
  216. package/serialization/types/TestSuiteRunExecutionOutput.js +2 -0
  217. package/serialization/types/TestSuiteRunMetricNumberOutput.d.ts +1 -1
  218. package/serialization/types/TestSuiteRunMetricNumberOutput.js +1 -1
  219. package/serialization/types/TestSuiteRunMetricStringOutput.d.ts +1 -1
  220. package/serialization/types/TestSuiteRunMetricStringOutput.js +1 -1
  221. package/serialization/types/TestSuiteTestCaseBulkOperationRequest.d.ts +5 -1
  222. package/serialization/types/TestSuiteTestCaseBulkOperationRequest.js +2 -0
  223. package/serialization/types/TestSuiteTestCaseRejectedBulkResult.d.ts +1 -1
  224. package/serialization/types/TestSuiteTestCaseRejectedBulkResult.js +1 -1
  225. package/serialization/types/TestSuiteTestCaseUpsertBulkOperationRequest.d.ts +14 -0
  226. package/serialization/types/TestSuiteTestCaseUpsertBulkOperationRequest.js +35 -0
  227. package/serialization/types/UpsertEnum.d.ts +10 -0
  228. package/serialization/types/UpsertEnum.js +31 -0
  229. package/serialization/{resources/testSuites/client/requests → types}/UpsertTestSuiteTestCaseRequest.d.ts +5 -5
  230. package/serialization/{resources/testSuites/client/requests → types}/UpsertTestSuiteTestCaseRequest.js +3 -3
  231. package/serialization/types/index.d.ts +6 -0
  232. package/serialization/types/index.js +6 -0
  233. package/dist/serialization/resources/testSuites/client/requests/index.d.ts +0 -1
  234. package/dist/serialization/resources/testSuites/client/requests/index.js +0 -5
  235. package/serialization/resources/testSuites/client/requests/index.d.ts +0 -1
  236. package/serialization/resources/testSuites/client/requests/index.js +0 -5
  237. /package/api/{resources/testSuites/client/requests/UpsertTestSuiteTestCaseRequest.js → types/MergeNodeResultData.js} +0 -0
  238. /package/{dist/api/resources/testSuites/client/requests/UpsertTestSuiteTestCaseRequest.js → api/types/TestSuiteRunExecutionArrayOutput.js} +0 -0
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * - `INITIATED` - INITIATED
6
+ * - `FULFILLED` - FULFILLED
7
+ */
8
+ export declare type IterationStateEnum = "INITIATED" | "FULFILLED";
9
+ export declare const IterationStateEnum: {
10
+ readonly Initiated: "INITIATED";
11
+ readonly Fulfilled: "FULFILLED";
12
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.IterationStateEnum = void 0;
7
+ exports.IterationStateEnum = {
8
+ Initiated: "INITIATED",
9
+ Fulfilled: "FULFILLED",
10
+ };
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Vellum from "../index";
4
5
  export interface MapNodeResultData {
5
6
  executionIds: string[];
7
+ iterationState?: Vellum.IterationStateEnum;
6
8
  }
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Vellum from "../index";
4
5
  /**
5
6
  * A Node Result Event emitted from a Merge Node.
6
7
  */
7
8
  export interface MergeNodeResult {
9
+ data: Vellum.MergeNodeResultData;
8
10
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface MergeNodeResultData {
5
+ pausedNodeData?: Record<string, unknown>;
6
+ }
@@ -4,6 +4,7 @@
4
4
  export interface PromptNodeResultData {
5
5
  outputId: string;
6
6
  arrayOutputId?: string;
7
+ executionId?: string;
7
8
  text?: string;
8
9
  delta?: string;
9
10
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Vellum from "../index";
5
+ /**
6
+ * Execution output of an entity evaluated during a Test Suite Run that is of type ARRAY
7
+ */
8
+ export interface TestSuiteRunExecutionArrayOutput {
9
+ name: string;
10
+ value?: Vellum.ArrayVellumValueItem[];
11
+ outputVariableId: string;
12
+ }
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Vellum from "../index";
5
- export declare type TestSuiteRunExecutionOutput = Vellum.TestSuiteRunExecutionOutput.String | Vellum.TestSuiteRunExecutionOutput.Number | Vellum.TestSuiteRunExecutionOutput.Json | Vellum.TestSuiteRunExecutionOutput.ChatHistory | Vellum.TestSuiteRunExecutionOutput.SearchResults | Vellum.TestSuiteRunExecutionOutput.Error_ | Vellum.TestSuiteRunExecutionOutput.FunctionCall;
5
+ export declare type TestSuiteRunExecutionOutput = Vellum.TestSuiteRunExecutionOutput.String | Vellum.TestSuiteRunExecutionOutput.Number | Vellum.TestSuiteRunExecutionOutput.Json | Vellum.TestSuiteRunExecutionOutput.ChatHistory | Vellum.TestSuiteRunExecutionOutput.SearchResults | Vellum.TestSuiteRunExecutionOutput.Error_ | Vellum.TestSuiteRunExecutionOutput.FunctionCall | Vellum.TestSuiteRunExecutionOutput.Array;
6
6
  export declare namespace TestSuiteRunExecutionOutput {
7
7
  interface String extends Vellum.TestSuiteRunExecutionStringOutput {
8
8
  type: "STRING";
@@ -25,4 +25,7 @@ export declare namespace TestSuiteRunExecutionOutput {
25
25
  interface FunctionCall extends Vellum.TestSuiteRunExecutionFunctionCallOutput {
26
26
  type: "FUNCTION_CALL";
27
27
  }
28
+ interface Array extends Vellum.TestSuiteRunExecutionArrayOutput {
29
+ type: "ARRAY";
30
+ }
28
31
  }
@@ -5,6 +5,6 @@
5
5
  * Output for a test suite run metric that is of type NUMBER
6
6
  */
7
7
  export interface TestSuiteRunMetricNumberOutput {
8
- value: number;
8
+ value?: number;
9
9
  name: string;
10
10
  }
@@ -5,6 +5,6 @@
5
5
  * Output for a test suite run metric that is of type STRING
6
6
  */
7
7
  export interface TestSuiteRunMetricStringOutput {
8
- value: string;
8
+ value?: string;
9
9
  name: string;
10
10
  }
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Vellum from "../index";
5
- export declare type TestSuiteTestCaseBulkOperationRequest = Vellum.TestSuiteTestCaseBulkOperationRequest.Create | Vellum.TestSuiteTestCaseBulkOperationRequest.Replace | Vellum.TestSuiteTestCaseBulkOperationRequest.Delete;
5
+ export declare type TestSuiteTestCaseBulkOperationRequest = Vellum.TestSuiteTestCaseBulkOperationRequest.Create | Vellum.TestSuiteTestCaseBulkOperationRequest.Replace | Vellum.TestSuiteTestCaseBulkOperationRequest.Upsert | Vellum.TestSuiteTestCaseBulkOperationRequest.Delete;
6
6
  export declare namespace TestSuiteTestCaseBulkOperationRequest {
7
7
  interface Create extends Vellum.TestSuiteTestCaseCreateBulkOperationRequest {
8
8
  type: "CREATE";
@@ -10,6 +10,9 @@ export declare namespace TestSuiteTestCaseBulkOperationRequest {
10
10
  interface Replace extends Vellum.TestSuiteTestCaseReplaceBulkOperationRequest {
11
11
  type: "REPLACE";
12
12
  }
13
+ interface Upsert extends Vellum.TestSuiteTestCaseUpsertBulkOperationRequest {
14
+ type: "UPSERT";
15
+ }
13
16
  interface Delete extends Vellum.TestSuiteTestCaseDeleteBulkOperationRequest {
14
17
  type: "DELETE";
15
18
  }
@@ -6,7 +6,7 @@
6
6
  */
7
7
  export interface TestSuiteTestCaseRejectedBulkResult {
8
8
  /** An ID that maps back to one of the initially supplied operations. Can be used to determine the result of a given operation. */
9
- id: string;
9
+ id?: string;
10
10
  /** Details about the error that occurred */
11
11
  data: Record<string, unknown>;
12
12
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Vellum from "../index";
5
+ /**
6
+ * A bulk operation that represents the upserting of a Test Case.
7
+ */
8
+ export interface TestSuiteTestCaseUpsertBulkOperationRequest {
9
+ /** An ID representing this specific operation. Can later be used to look up information about the operation's success in the response. */
10
+ id: string;
11
+ data: Vellum.UpsertTestSuiteTestCaseRequest;
12
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export declare type UpsertEnum = "UPSERT";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +1,10 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Vellum from "../../../../index";
5
- /**
6
- * @example
7
- * {
8
- * inputValues: [],
9
- * evaluationValues: []
10
- * }
11
- */
4
+ import * as Vellum from "../index";
12
5
  export interface UpsertTestSuiteTestCaseRequest {
13
6
  /** The Vellum-generated ID of an existing Test Case whose data you'd like to replace. If specified and no Test Case exists with this ID, a 404 will be returned. */
14
- upsertTestSuiteTestCaseRequestId?: string;
7
+ id?: string;
15
8
  /** An ID external to Vellum that uniquely identifies the Test Case that you'd like to create/update. If there's a match on a Test Case that was previously created with the same external_id, it will be updated. Otherwise, a new Test Case will be created with this value as its external_id. If no external_id is specified, then a new Test Case will always be created. */
16
9
  externalId?: string;
17
10
  /** A human-readable label used to convey the intention of this Test Case */
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -118,6 +118,7 @@ export * from "./InitiatedPromptExecutionMeta";
118
118
  export * from "./InitiatedWorkflowNodeResultEvent";
119
119
  export * from "./InstructorVectorizerConfig";
120
120
  export * from "./InstructorVectorizerConfigRequest";
121
+ export * from "./IterationStateEnum";
121
122
  export * from "./JsonInputRequest";
122
123
  export * from "./JsonEnum";
123
124
  export * from "./JsonVariableValue";
@@ -130,6 +131,7 @@ export * from "./MapNodeResult";
130
131
  export * from "./MapNodeResultData";
131
132
  export * from "./MergeEnum";
132
133
  export * from "./MergeNodeResult";
134
+ export * from "./MergeNodeResultData";
133
135
  export * from "./MetadataFilterConfigRequest";
134
136
  export * from "./MetadataFilterRuleCombinator";
135
137
  export * from "./MetadataFilterRuleRequest";
@@ -299,6 +301,7 @@ export * from "./TestSuiteRunDeploymentReleaseTagExecConfigTypeEnum";
299
301
  export * from "./TestSuiteRunExecConfig";
300
302
  export * from "./TestSuiteRunExecConfigRequest";
301
303
  export * from "./TestSuiteRunExecution";
304
+ export * from "./TestSuiteRunExecutionArrayOutput";
302
305
  export * from "./TestSuiteRunExecutionChatHistoryOutput";
303
306
  export * from "./TestSuiteRunExecutionErrorOutput";
304
307
  export * from "./TestSuiteRunExecutionFunctionCallOutput";
@@ -343,12 +346,15 @@ export * from "./TestSuiteTestCaseRejectedBulkResult";
343
346
  export * from "./TestSuiteTestCaseReplaceBulkOperationRequest";
344
347
  export * from "./TestSuiteTestCaseReplacedBulkResult";
345
348
  export * from "./TestSuiteTestCaseReplacedBulkResultData";
349
+ export * from "./TestSuiteTestCaseUpsertBulkOperationRequest";
346
350
  export * from "./TokenOverlappingWindowChunkerConfig";
347
351
  export * from "./TokenOverlappingWindowChunkerConfigRequest";
348
352
  export * from "./TokenOverlappingWindowChunking";
349
353
  export * from "./TokenOverlappingWindowChunkingRequest";
350
354
  export * from "./UploadDocumentErrorResponse";
351
355
  export * from "./UploadDocumentResponse";
356
+ export * from "./UpsertEnum";
357
+ export * from "./UpsertTestSuiteTestCaseRequest";
352
358
  export * from "./VellumError";
353
359
  export * from "./VellumErrorCodeEnum";
354
360
  export * from "./VellumErrorRequest";
@@ -134,6 +134,7 @@ __exportStar(require("./InitiatedPromptExecutionMeta"), exports);
134
134
  __exportStar(require("./InitiatedWorkflowNodeResultEvent"), exports);
135
135
  __exportStar(require("./InstructorVectorizerConfig"), exports);
136
136
  __exportStar(require("./InstructorVectorizerConfigRequest"), exports);
137
+ __exportStar(require("./IterationStateEnum"), exports);
137
138
  __exportStar(require("./JsonInputRequest"), exports);
138
139
  __exportStar(require("./JsonEnum"), exports);
139
140
  __exportStar(require("./JsonVariableValue"), exports);
@@ -146,6 +147,7 @@ __exportStar(require("./MapNodeResult"), exports);
146
147
  __exportStar(require("./MapNodeResultData"), exports);
147
148
  __exportStar(require("./MergeEnum"), exports);
148
149
  __exportStar(require("./MergeNodeResult"), exports);
150
+ __exportStar(require("./MergeNodeResultData"), exports);
149
151
  __exportStar(require("./MetadataFilterConfigRequest"), exports);
150
152
  __exportStar(require("./MetadataFilterRuleCombinator"), exports);
151
153
  __exportStar(require("./MetadataFilterRuleRequest"), exports);
@@ -315,6 +317,7 @@ __exportStar(require("./TestSuiteRunDeploymentReleaseTagExecConfigTypeEnum"), ex
315
317
  __exportStar(require("./TestSuiteRunExecConfig"), exports);
316
318
  __exportStar(require("./TestSuiteRunExecConfigRequest"), exports);
317
319
  __exportStar(require("./TestSuiteRunExecution"), exports);
320
+ __exportStar(require("./TestSuiteRunExecutionArrayOutput"), exports);
318
321
  __exportStar(require("./TestSuiteRunExecutionChatHistoryOutput"), exports);
319
322
  __exportStar(require("./TestSuiteRunExecutionErrorOutput"), exports);
320
323
  __exportStar(require("./TestSuiteRunExecutionFunctionCallOutput"), exports);
@@ -359,12 +362,15 @@ __exportStar(require("./TestSuiteTestCaseRejectedBulkResult"), exports);
359
362
  __exportStar(require("./TestSuiteTestCaseReplaceBulkOperationRequest"), exports);
360
363
  __exportStar(require("./TestSuiteTestCaseReplacedBulkResult"), exports);
361
364
  __exportStar(require("./TestSuiteTestCaseReplacedBulkResultData"), exports);
365
+ __exportStar(require("./TestSuiteTestCaseUpsertBulkOperationRequest"), exports);
362
366
  __exportStar(require("./TokenOverlappingWindowChunkerConfig"), exports);
363
367
  __exportStar(require("./TokenOverlappingWindowChunkerConfigRequest"), exports);
364
368
  __exportStar(require("./TokenOverlappingWindowChunking"), exports);
365
369
  __exportStar(require("./TokenOverlappingWindowChunkingRequest"), exports);
366
370
  __exportStar(require("./UploadDocumentErrorResponse"), exports);
367
371
  __exportStar(require("./UploadDocumentResponse"), exports);
372
+ __exportStar(require("./UpsertEnum"), exports);
373
+ __exportStar(require("./UpsertTestSuiteTestCaseRequest"), exports);
368
374
  __exportStar(require("./VellumError"), exports);
369
375
  __exportStar(require("./VellumErrorCodeEnum"), exports);
370
376
  __exportStar(require("./VellumErrorRequest"), exports);
@@ -12,6 +12,7 @@ export declare namespace Fetcher {
12
12
  maxRetries?: number;
13
13
  withCredentials?: boolean;
14
14
  abortSignal?: AbortSignal;
15
+ requestType?: "json" | "file" | "bytes";
15
16
  responseType?: "json" | "blob" | "streaming" | "text";
16
17
  }
17
18
  type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
@@ -33,4 +34,5 @@ export declare namespace Fetcher {
33
34
  errorMessage: string;
34
35
  }
35
36
  }
37
+ export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
36
38
  export declare const fetcher: FetchFunction;
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -31,18 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
31
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
32
9
  });
33
10
  };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
11
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.fetcher = void 0;
39
- const qs_1 = __importDefault(require("qs"));
40
- const runtime_1 = require("../runtime");
41
- const INITIAL_RETRY_DELAY = 1;
42
- const MAX_RETRY_DELAY = 60;
43
- const DEFAULT_MAX_RETRIES = 2;
12
+ exports.fetcher = exports.fetcherImpl = void 0;
13
+ const createRequestUrl_1 = require("./createRequestUrl");
14
+ const getFetchFn_1 = require("./getFetchFn");
15
+ const getRequestBody_1 = require("./getRequestBody");
16
+ const getResponseBody_1 = require("./getResponseBody");
17
+ const makeRequest_1 = require("./makeRequest");
18
+ const requestWithRetries_1 = require("./requestWithRetries");
44
19
  function fetcherImpl(args) {
45
- var _a, _b;
46
20
  return __awaiter(this, void 0, void 0, function* () {
47
21
  const headers = {};
48
22
  if (args.body !== undefined && args.contentType != null) {
@@ -55,112 +29,21 @@ function fetcherImpl(args) {
55
29
  }
56
30
  }
57
31
  }
58
- const url = Object.keys((_a = args.queryParameters) !== null && _a !== void 0 ? _a : {}).length > 0
59
- ? `${args.url}?${qs_1.default.stringify(args.queryParameters, { arrayFormat: "repeat" })}`
60
- : args.url;
61
- let body = undefined;
62
- const maybeStringifyBody = (body) => {
63
- if (body instanceof Uint8Array) {
64
- return body;
65
- }
66
- else if (args.contentType === "application/x-www-form-urlencoded" && typeof args.body === "string") {
67
- return args.body;
68
- }
69
- else {
70
- return JSON.stringify(body);
71
- }
72
- };
73
- if (runtime_1.RUNTIME.type === "node") {
74
- if (args.body instanceof (yield Promise.resolve().then(() => __importStar(require("formdata-node")))).FormData) {
75
- // @ts-expect-error
76
- body = args.body;
77
- }
78
- else {
79
- body = maybeStringifyBody(args.body);
80
- }
81
- }
82
- else {
83
- if (args.body instanceof (yield Promise.resolve().then(() => __importStar(require("form-data")))).default) {
84
- // @ts-expect-error
85
- body = args.body;
86
- }
87
- else {
88
- body = maybeStringifyBody(args.body);
89
- }
90
- }
91
- const fetchFn = yield getFetchFn();
92
- const makeRequest = () => __awaiter(this, void 0, void 0, function* () {
93
- const signals = [];
94
- // Add timeout signal
95
- let timeoutAbortId = undefined;
96
- if (args.timeoutMs != null) {
97
- const { signal, abortId } = getTimeoutSignal(args.timeoutMs);
98
- timeoutAbortId = abortId;
99
- signals.push(signal);
100
- }
101
- // Add arbitrary signal
102
- if (args.abortSignal != null) {
103
- signals.push(args.abortSignal);
104
- }
105
- const response = yield fetchFn(url, {
106
- method: args.method,
107
- headers,
108
- body,
109
- signal: anySignal(signals),
110
- credentials: args.withCredentials ? "include" : undefined,
111
- });
112
- if (timeoutAbortId != null) {
113
- clearTimeout(timeoutAbortId);
114
- }
115
- return response;
32
+ const url = (0, createRequestUrl_1.createRequestUrl)(args.url, args.queryParameters);
33
+ let requestBody = yield (0, getRequestBody_1.getRequestBody)({
34
+ body: args.body,
35
+ type: args.requestType === "json" ? "json" : "other",
116
36
  });
37
+ const fetchFn = yield (0, getFetchFn_1.getFetchFn)();
117
38
  try {
118
- let response = yield makeRequest();
119
- for (let i = 0; i < ((_b = args.maxRetries) !== null && _b !== void 0 ? _b : DEFAULT_MAX_RETRIES); ++i) {
120
- if (response.status === 408 ||
121
- response.status === 409 ||
122
- response.status === 429 ||
123
- response.status >= 500) {
124
- const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(i, 2), MAX_RETRY_DELAY);
125
- yield new Promise((resolve) => setTimeout(resolve, delay));
126
- response = yield makeRequest();
127
- }
128
- else {
129
- break;
130
- }
131
- }
132
- let body;
133
- if (response.body != null && args.responseType === "blob") {
134
- body = yield response.blob();
135
- }
136
- else if (response.body != null && args.responseType === "streaming") {
137
- body = response.body;
138
- }
139
- else if (response.body != null && args.responseType === "text") {
140
- body = yield response.text();
141
- }
142
- else {
143
- const text = yield response.text();
144
- if (text.length > 0) {
145
- try {
146
- body = JSON.parse(text);
147
- }
148
- catch (err) {
149
- return {
150
- ok: false,
151
- error: {
152
- reason: "non-json",
153
- statusCode: response.status,
154
- rawBody: text,
155
- },
156
- };
157
- }
158
- }
159
- }
39
+ const response = yield (0, requestWithRetries_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
40
+ return (0, makeRequest_1.makeRequest)(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials);
41
+ }), args.maxRetries);
42
+ let responseBody = yield (0, getResponseBody_1.getResponseBody)(response, args.responseType);
160
43
  if (response.status >= 200 && response.status < 400) {
161
44
  return {
162
45
  ok: true,
163
- body: body,
46
+ body: responseBody,
164
47
  headers: response.headers,
165
48
  };
166
49
  }
@@ -170,7 +53,7 @@ function fetcherImpl(args) {
170
53
  error: {
171
54
  reason: "status-code",
172
55
  statusCode: response.status,
173
- body,
56
+ body: responseBody,
174
57
  },
175
58
  };
176
59
  }
@@ -212,54 +95,5 @@ function fetcherImpl(args) {
212
95
  }
213
96
  });
214
97
  }
215
- const TIMEOUT = "timeout";
216
- function getTimeoutSignal(timeoutMs) {
217
- const controller = new AbortController();
218
- const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
219
- return { signal: controller.signal, abortId };
220
- }
221
- /**
222
- * Returns an abort signal that is getting aborted when
223
- * at least one of the specified abort signals is aborted.
224
- *
225
- * Requires at least node.js 18.
226
- */
227
- function anySignal(...args) {
228
- // Allowing signals to be passed either as array
229
- // of signals or as multiple arguments.
230
- const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args);
231
- const controller = new AbortController();
232
- for (const signal of signals) {
233
- if (signal.aborted) {
234
- // Exiting early if one of the signals
235
- // is already aborted.
236
- controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
237
- break;
238
- }
239
- // Listening for signals and removing the listeners
240
- // when at least one symbol is aborted.
241
- signal.addEventListener("abort", () => controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason), {
242
- signal: controller.signal,
243
- });
244
- }
245
- return controller.signal;
246
- }
247
- /**
248
- * Returns a fetch function based on the runtime
249
- */
250
- function getFetchFn() {
251
- return __awaiter(this, void 0, void 0, function* () {
252
- // In Node.js environments, the SDK always uses`node-fetch`.
253
- if (runtime_1.RUNTIME.type === "node") {
254
- return (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
255
- }
256
- // Otherwise the SDK uses global fetch if available,
257
- // and falls back to node-fetch.
258
- if (typeof fetch == "function") {
259
- return fetch;
260
- }
261
- // Defaults to node `node-fetch` if global fetch isn't available
262
- return (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
263
- });
264
- }
98
+ exports.fetcherImpl = fetcherImpl;
265
99
  exports.fetcher = fetcherImpl;
@@ -0,0 +1 @@
1
+ export declare function createRequestUrl(baseUrl: string, queryParameters?: Record<string, string | string[] | object | object[]>): string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createRequestUrl = void 0;
7
+ const qs_1 = __importDefault(require("qs"));
8
+ function createRequestUrl(baseUrl, queryParameters) {
9
+ return Object.keys(queryParameters !== null && queryParameters !== void 0 ? queryParameters : {}).length > 0
10
+ ? `${baseUrl}?${qs_1.default.stringify(queryParameters, { arrayFormat: "repeat" })}`
11
+ : baseUrl;
12
+ }
13
+ exports.createRequestUrl = createRequestUrl;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Returns a fetch function based on the runtime
3
+ */
4
+ export declare function getFetchFn(): Promise<any>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.getFetchFn = void 0;
36
+ const runtime_1 = require("../runtime");
37
+ /**
38
+ * Returns a fetch function based on the runtime
39
+ */
40
+ function getFetchFn() {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ // In Node.js environments, the SDK always uses`node-fetch`.
43
+ if (runtime_1.RUNTIME.type === "node") {
44
+ return (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
45
+ }
46
+ // Otherwise the SDK uses global fetch if available,
47
+ // and falls back to node-fetch.
48
+ if (typeof fetch == "function") {
49
+ return fetch;
50
+ }
51
+ // Defaults to node `node-fetch` if global fetch isn't available
52
+ return (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
53
+ });
54
+ }
55
+ exports.getFetchFn = getFetchFn;
@@ -0,0 +1,7 @@
1
+ export declare namespace GetRequestBody {
2
+ interface Args {
3
+ body: unknown;
4
+ type: "json" | "file" | "bytes" | "other";
5
+ }
6
+ }
7
+ export declare function getRequestBody({ body, type }: GetRequestBody.Args): Promise<BodyInit | undefined>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getRequestBody = void 0;
13
+ function getRequestBody({ body, type }) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ if (type.includes("json")) {
16
+ return JSON.stringify(body);
17
+ }
18
+ else {
19
+ return body;
20
+ }
21
+ });
22
+ }
23
+ exports.getRequestBody = getRequestBody;