opik 0.0.1 → 0.0.2

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 (550) hide show
  1. package/dist/index.cjs +239 -127
  2. package/dist/index.d.cts +111 -89
  3. package/dist/index.d.ts +111 -89
  4. package/dist/index.js +239 -127
  5. package/package.json +12 -1
  6. package/examples/manual-trace.js +0 -16
  7. package/src/opik/client/Client.ts +0 -65
  8. package/src/opik/config/Config.ts +0 -35
  9. package/src/opik/index.ts +0 -2
  10. package/src/opik/rest_api/Client.ts +0 -247
  11. package/src/opik/rest_api/api/errors/BadRequestError.ts +0 -16
  12. package/src/opik/rest_api/api/errors/ConflictError.ts +0 -16
  13. package/src/opik/rest_api/api/errors/ForbiddenError.ts +0 -17
  14. package/src/opik/rest_api/api/errors/NotFoundError.ts +0 -16
  15. package/src/opik/rest_api/api/errors/NotImplementedError.ts +0 -16
  16. package/src/opik/rest_api/api/errors/UnauthorizedError.ts +0 -17
  17. package/src/opik/rest_api/api/errors/UnprocessableEntityError.ts +0 -16
  18. package/src/opik/rest_api/api/errors/index.ts +0 -7
  19. package/src/opik/rest_api/api/index.ts +0 -3
  20. package/src/opik/rest_api/api/resources/chatCompletions/client/Client.ts +0 -125
  21. package/src/opik/rest_api/api/resources/chatCompletions/client/index.ts +0 -1
  22. package/src/opik/rest_api/api/resources/chatCompletions/client/requests/ChatCompletionRequest.ts +0 -33
  23. package/src/opik/rest_api/api/resources/chatCompletions/client/requests/index.ts +0 -1
  24. package/src/opik/rest_api/api/resources/chatCompletions/index.ts +0 -1
  25. package/src/opik/rest_api/api/resources/check/client/Client.ts +0 -141
  26. package/src/opik/rest_api/api/resources/check/client/index.ts +0 -1
  27. package/src/opik/rest_api/api/resources/check/index.ts +0 -1
  28. package/src/opik/rest_api/api/resources/datasets/client/Client.ts +0 -1244
  29. package/src/opik/rest_api/api/resources/datasets/client/index.ts +0 -1
  30. package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetIdentifier.ts +0 -13
  31. package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetIdentifierPublic.ts +0 -13
  32. package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetItemBatchWrite.ts +0 -21
  33. package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetItemStreamRequest.ts +0 -9
  34. package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetItemsDelete.ts +0 -13
  35. package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetUpdate.ts +0 -14
  36. package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetWrite.ts +0 -15
  37. package/src/opik/rest_api/api/resources/datasets/client/requests/FindDatasetItemsWithExperimentItemsRequest.ts +0 -17
  38. package/src/opik/rest_api/api/resources/datasets/client/requests/FindDatasetsRequest.ts +0 -16
  39. package/src/opik/rest_api/api/resources/datasets/client/requests/GetDatasetItemsOutputColumnsRequest.ts +0 -11
  40. package/src/opik/rest_api/api/resources/datasets/client/requests/GetDatasetItemsRequest.ts +0 -13
  41. package/src/opik/rest_api/api/resources/datasets/client/requests/index.ts +0 -11
  42. package/src/opik/rest_api/api/resources/datasets/index.ts +0 -1
  43. package/src/opik/rest_api/api/resources/experiments/client/Client.ts +0 -858
  44. package/src/opik/rest_api/api/resources/experiments/client/index.ts +0 -1
  45. package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentItemStreamRequest.ts +0 -9
  46. package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentItemsBatch.ts +0 -19
  47. package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentItemsDelete.ts +0 -13
  48. package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentWrite.ts +0 -19
  49. package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentsDelete.ts +0 -13
  50. package/src/opik/rest_api/api/resources/experiments/client/requests/FindExperimentsRequest.ts +0 -16
  51. package/src/opik/rest_api/api/resources/experiments/client/requests/FindFeedbackScoreNamesRequest.ts +0 -11
  52. package/src/opik/rest_api/api/resources/experiments/client/requests/IdentifierPublic.ts +0 -13
  53. package/src/opik/rest_api/api/resources/experiments/client/requests/index.ts +0 -8
  54. package/src/opik/rest_api/api/resources/experiments/index.ts +0 -1
  55. package/src/opik/rest_api/api/resources/feedbackDefinitions/client/Client.ts +0 -515
  56. package/src/opik/rest_api/api/resources/feedbackDefinitions/client/index.ts +0 -1
  57. package/src/opik/rest_api/api/resources/feedbackDefinitions/client/requests/FindFeedbackDefinitionsRequest.ts +0 -16
  58. package/src/opik/rest_api/api/resources/feedbackDefinitions/client/requests/index.ts +0 -1
  59. package/src/opik/rest_api/api/resources/feedbackDefinitions/index.ts +0 -2
  60. package/src/opik/rest_api/api/resources/feedbackDefinitions/types/FindFeedbackDefinitionsRequestType.ts +0 -10
  61. package/src/opik/rest_api/api/resources/feedbackDefinitions/types/index.ts +0 -1
  62. package/src/opik/rest_api/api/resources/index.ts +0 -23
  63. package/src/opik/rest_api/api/resources/llmProviderKey/client/Client.ts +0 -412
  64. package/src/opik/rest_api/api/resources/llmProviderKey/client/index.ts +0 -1
  65. package/src/opik/rest_api/api/resources/llmProviderKey/client/requests/ProviderApiKeyUpdate.ts +0 -13
  66. package/src/opik/rest_api/api/resources/llmProviderKey/client/requests/ProviderApiKeyWrite.ts +0 -13
  67. package/src/opik/rest_api/api/resources/llmProviderKey/client/requests/index.ts +0 -2
  68. package/src/opik/rest_api/api/resources/llmProviderKey/index.ts +0 -1
  69. package/src/opik/rest_api/api/resources/projects/client/Client.ts +0 -720
  70. package/src/opik/rest_api/api/resources/projects/client/index.ts +0 -1
  71. package/src/opik/rest_api/api/resources/projects/client/requests/FindProjectsRequest.ts +0 -14
  72. package/src/opik/rest_api/api/resources/projects/client/requests/ProjectMetricRequestPublic.ts +0 -16
  73. package/src/opik/rest_api/api/resources/projects/client/requests/ProjectRetrievePublic.ts +0 -13
  74. package/src/opik/rest_api/api/resources/projects/client/requests/ProjectUpdate.ts +0 -12
  75. package/src/opik/rest_api/api/resources/projects/client/requests/ProjectWrite.ts +0 -14
  76. package/src/opik/rest_api/api/resources/projects/client/requests/index.ts +0 -5
  77. package/src/opik/rest_api/api/resources/projects/index.ts +0 -2
  78. package/src/opik/rest_api/api/resources/projects/types/ProjectMetricRequestPublicInterval.ts +0 -11
  79. package/src/opik/rest_api/api/resources/projects/types/ProjectMetricRequestPublicMetricType.ts +0 -18
  80. package/src/opik/rest_api/api/resources/projects/types/index.ts +0 -2
  81. package/src/opik/rest_api/api/resources/prompts/client/Client.ts +0 -900
  82. package/src/opik/rest_api/api/resources/prompts/client/index.ts +0 -1
  83. package/src/opik/rest_api/api/resources/prompts/client/requests/CreatePromptVersionDetail.ts +0 -19
  84. package/src/opik/rest_api/api/resources/prompts/client/requests/GetPromptVersionsRequest.ts +0 -12
  85. package/src/opik/rest_api/api/resources/prompts/client/requests/GetPromptsRequest.ts +0 -13
  86. package/src/opik/rest_api/api/resources/prompts/client/requests/PromptUpdatable.ts +0 -14
  87. package/src/opik/rest_api/api/resources/prompts/client/requests/PromptVersionRetrieveDetail.ts +0 -14
  88. package/src/opik/rest_api/api/resources/prompts/client/requests/PromptWrite.ts +0 -16
  89. package/src/opik/rest_api/api/resources/prompts/client/requests/index.ts +0 -6
  90. package/src/opik/rest_api/api/resources/prompts/index.ts +0 -1
  91. package/src/opik/rest_api/api/resources/spans/client/Client.ts +0 -957
  92. package/src/opik/rest_api/api/resources/spans/client/index.ts +0 -1
  93. package/src/opik/rest_api/api/resources/spans/client/requests/FindFeedbackScoreNames1Request.ts +0 -14
  94. package/src/opik/rest_api/api/resources/spans/client/requests/GetSpanStatsRequest.ts +0 -17
  95. package/src/opik/rest_api/api/resources/spans/client/requests/GetSpansByProjectRequest.ts +0 -20
  96. package/src/opik/rest_api/api/resources/spans/client/requests/SpanBatchWrite.ts +0 -20
  97. package/src/opik/rest_api/api/resources/spans/client/requests/SpanUpdate.ts +0 -29
  98. package/src/opik/rest_api/api/resources/spans/client/requests/index.ts +0 -5
  99. package/src/opik/rest_api/api/resources/spans/index.ts +0 -2
  100. package/src/opik/rest_api/api/resources/spans/types/FindFeedbackScoreNames1RequestType.ts +0 -11
  101. package/src/opik/rest_api/api/resources/spans/types/GetSpanStatsRequestType.ts +0 -11
  102. package/src/opik/rest_api/api/resources/spans/types/GetSpansByProjectRequestType.ts +0 -11
  103. package/src/opik/rest_api/api/resources/spans/types/index.ts +0 -3
  104. package/src/opik/rest_api/api/resources/systemUsage/client/Client.ts +0 -347
  105. package/src/opik/rest_api/api/resources/systemUsage/client/index.ts +0 -1
  106. package/src/opik/rest_api/api/resources/systemUsage/index.ts +0 -1
  107. package/src/opik/rest_api/api/resources/traces/client/Client.ts +0 -990
  108. package/src/opik/rest_api/api/resources/traces/client/index.ts +0 -1
  109. package/src/opik/rest_api/api/resources/traces/client/requests/FindFeedbackScoreNames2Request.ts +0 -11
  110. package/src/opik/rest_api/api/resources/traces/client/requests/GetTraceStatsRequest.ts +0 -13
  111. package/src/opik/rest_api/api/resources/traces/client/requests/GetTracesByProjectRequest.ts +0 -16
  112. package/src/opik/rest_api/api/resources/traces/client/requests/TraceBatchWrite.ts +0 -18
  113. package/src/opik/rest_api/api/resources/traces/client/requests/TraceUpdate.ts +0 -22
  114. package/src/opik/rest_api/api/resources/traces/client/requests/index.ts +0 -5
  115. package/src/opik/rest_api/api/resources/traces/index.ts +0 -1
  116. package/src/opik/rest_api/api/types/AssistantMessage.ts +0 -14
  117. package/src/opik/rest_api/api/types/AssistantMessageRole.ts +0 -13
  118. package/src/opik/rest_api/api/types/AuthDetailsHolder.ts +0 -5
  119. package/src/opik/rest_api/api/types/AvgValueStatPublic.ts +0 -7
  120. package/src/opik/rest_api/api/types/BatchDelete.ts +0 -7
  121. package/src/opik/rest_api/api/types/BiInformation.ts +0 -9
  122. package/src/opik/rest_api/api/types/BiInformationResponse.ts +0 -9
  123. package/src/opik/rest_api/api/types/CategoricalFeedbackDefinition.ts +0 -13
  124. package/src/opik/rest_api/api/types/CategoricalFeedbackDefinitionCreate.ts +0 -9
  125. package/src/opik/rest_api/api/types/CategoricalFeedbackDefinitionPublic.ts +0 -13
  126. package/src/opik/rest_api/api/types/CategoricalFeedbackDefinitionUpdate.ts +0 -9
  127. package/src/opik/rest_api/api/types/CategoricalFeedbackDetail.ts +0 -7
  128. package/src/opik/rest_api/api/types/CategoricalFeedbackDetailCreate.ts +0 -7
  129. package/src/opik/rest_api/api/types/CategoricalFeedbackDetailPublic.ts +0 -7
  130. package/src/opik/rest_api/api/types/CategoricalFeedbackDetailUpdate.ts +0 -7
  131. package/src/opik/rest_api/api/types/ChatCompletionChoice.ts +0 -12
  132. package/src/opik/rest_api/api/types/ChatCompletionResponse.ts +0 -14
  133. package/src/opik/rest_api/api/types/ChunkedOutputJsonNode.ts +0 -10
  134. package/src/opik/rest_api/api/types/ChunkedOutputJsonNodeType.ts +0 -7
  135. package/src/opik/rest_api/api/types/Column.ts +0 -13
  136. package/src/opik/rest_api/api/types/ColumnCompare.ts +0 -13
  137. package/src/opik/rest_api/api/types/ColumnCompareTypesItem.ts +0 -14
  138. package/src/opik/rest_api/api/types/ColumnPublic.ts +0 -13
  139. package/src/opik/rest_api/api/types/ColumnPublicTypesItem.ts +0 -14
  140. package/src/opik/rest_api/api/types/ColumnTypesItem.ts +0 -14
  141. package/src/opik/rest_api/api/types/CompletionTokensDetails.ts +0 -7
  142. package/src/opik/rest_api/api/types/CountValueStatPublic.ts +0 -7
  143. package/src/opik/rest_api/api/types/DataPointNumberPublic.ts +0 -8
  144. package/src/opik/rest_api/api/types/Dataset.ts +0 -17
  145. package/src/opik/rest_api/api/types/DatasetItem.ts +0 -21
  146. package/src/opik/rest_api/api/types/DatasetItemBatch.ts +0 -13
  147. package/src/opik/rest_api/api/types/DatasetItemCompare.ts +0 -21
  148. package/src/opik/rest_api/api/types/DatasetItemCompareSource.ts +0 -12
  149. package/src/opik/rest_api/api/types/DatasetItemPageCompare.ts +0 -13
  150. package/src/opik/rest_api/api/types/DatasetItemPagePublic.ts +0 -13
  151. package/src/opik/rest_api/api/types/DatasetItemPublic.ts +0 -21
  152. package/src/opik/rest_api/api/types/DatasetItemPublicSource.ts +0 -12
  153. package/src/opik/rest_api/api/types/DatasetItemSource.ts +0 -12
  154. package/src/opik/rest_api/api/types/DatasetItemWrite.ts +0 -16
  155. package/src/opik/rest_api/api/types/DatasetItemWriteSource.ts +0 -12
  156. package/src/opik/rest_api/api/types/DatasetPagePublic.ts +0 -12
  157. package/src/opik/rest_api/api/types/DatasetPublic.ts +0 -17
  158. package/src/opik/rest_api/api/types/DeleteFeedbackScore.ts +0 -7
  159. package/src/opik/rest_api/api/types/Delta.ts +0 -12
  160. package/src/opik/rest_api/api/types/DeltaRole.ts +0 -13
  161. package/src/opik/rest_api/api/types/ErrorInfo.ts +0 -9
  162. package/src/opik/rest_api/api/types/ErrorInfoPublic.ts +0 -9
  163. package/src/opik/rest_api/api/types/ErrorInfoWrite.ts +0 -9
  164. package/src/opik/rest_api/api/types/ErrorMessage.ts +0 -9
  165. package/src/opik/rest_api/api/types/ErrorMessageDetail.ts +0 -9
  166. package/src/opik/rest_api/api/types/ErrorMessagePublic.ts +0 -7
  167. package/src/opik/rest_api/api/types/Experiment.ts +0 -20
  168. package/src/opik/rest_api/api/types/ExperimentItem.ts +0 -19
  169. package/src/opik/rest_api/api/types/ExperimentItemCompare.ts +0 -19
  170. package/src/opik/rest_api/api/types/ExperimentItemPublic.ts +0 -14
  171. package/src/opik/rest_api/api/types/ExperimentPagePublic.ts +0 -12
  172. package/src/opik/rest_api/api/types/ExperimentPublic.ts +0 -20
  173. package/src/opik/rest_api/api/types/Feedback.ts +0 -26
  174. package/src/opik/rest_api/api/types/FeedbackCreate.ts +0 -22
  175. package/src/opik/rest_api/api/types/FeedbackDefinitionPagePublic.ts +0 -12
  176. package/src/opik/rest_api/api/types/FeedbackObjectPublic.ts +0 -26
  177. package/src/opik/rest_api/api/types/FeedbackPublic.ts +0 -26
  178. package/src/opik/rest_api/api/types/FeedbackScore.ts +0 -17
  179. package/src/opik/rest_api/api/types/FeedbackScoreAverage.ts +0 -8
  180. package/src/opik/rest_api/api/types/FeedbackScoreAveragePublic.ts +0 -8
  181. package/src/opik/rest_api/api/types/FeedbackScoreBatch.ts +0 -9
  182. package/src/opik/rest_api/api/types/FeedbackScoreBatchItem.ts +0 -16
  183. package/src/opik/rest_api/api/types/FeedbackScoreBatchItemSource.ts +0 -10
  184. package/src/opik/rest_api/api/types/FeedbackScoreCompare.ts +0 -17
  185. package/src/opik/rest_api/api/types/FeedbackScoreCompareSource.ts +0 -10
  186. package/src/opik/rest_api/api/types/FeedbackScorePublic.ts +0 -17
  187. package/src/opik/rest_api/api/types/FeedbackScorePublicSource.ts +0 -10
  188. package/src/opik/rest_api/api/types/FeedbackScoreSource.ts +0 -10
  189. package/src/opik/rest_api/api/types/FeedbackUpdate.ts +0 -22
  190. package/src/opik/rest_api/api/types/Function.ts +0 -12
  191. package/src/opik/rest_api/api/types/FunctionCall.ts +0 -8
  192. package/src/opik/rest_api/api/types/JsonNode.ts +0 -5
  193. package/src/opik/rest_api/api/types/JsonNodeCompare.ts +0 -5
  194. package/src/opik/rest_api/api/types/JsonNodePublic.ts +0 -5
  195. package/src/opik/rest_api/api/types/JsonNodeWrite.ts +0 -5
  196. package/src/opik/rest_api/api/types/JsonObjectSchema.ts +0 -14
  197. package/src/opik/rest_api/api/types/JsonSchema.ts +0 -11
  198. package/src/opik/rest_api/api/types/JsonSchemaElement.ts +0 -7
  199. package/src/opik/rest_api/api/types/Message.ts +0 -5
  200. package/src/opik/rest_api/api/types/NumericalFeedbackDefinition.ts +0 -13
  201. package/src/opik/rest_api/api/types/NumericalFeedbackDefinitionCreate.ts +0 -9
  202. package/src/opik/rest_api/api/types/NumericalFeedbackDefinitionPublic.ts +0 -13
  203. package/src/opik/rest_api/api/types/NumericalFeedbackDefinitionUpdate.ts +0 -9
  204. package/src/opik/rest_api/api/types/NumericalFeedbackDetail.ts +0 -8
  205. package/src/opik/rest_api/api/types/NumericalFeedbackDetailCreate.ts +0 -8
  206. package/src/opik/rest_api/api/types/NumericalFeedbackDetailPublic.ts +0 -8
  207. package/src/opik/rest_api/api/types/NumericalFeedbackDetailUpdate.ts +0 -8
  208. package/src/opik/rest_api/api/types/PageColumns.ts +0 -9
  209. package/src/opik/rest_api/api/types/PercentageValueStatPublic.ts +0 -9
  210. package/src/opik/rest_api/api/types/PercentageValuesPublic.ts +0 -9
  211. package/src/opik/rest_api/api/types/Project.ts +0 -14
  212. package/src/opik/rest_api/api/types/ProjectMetricResponsePublic.ts +0 -12
  213. package/src/opik/rest_api/api/types/ProjectMetricResponsePublicInterval.ts +0 -11
  214. package/src/opik/rest_api/api/types/ProjectMetricResponsePublicMetricType.ts +0 -18
  215. package/src/opik/rest_api/api/types/ProjectPagePublic.ts +0 -13
  216. package/src/opik/rest_api/api/types/ProjectPublic.ts +0 -14
  217. package/src/opik/rest_api/api/types/ProjectStatItemObjectPublic.ts +0 -28
  218. package/src/opik/rest_api/api/types/ProjectStatsPublic.ts +0 -9
  219. package/src/opik/rest_api/api/types/Prompt.ts +0 -18
  220. package/src/opik/rest_api/api/types/PromptDetail.ts +0 -17
  221. package/src/opik/rest_api/api/types/PromptPagePublic.ts +0 -12
  222. package/src/opik/rest_api/api/types/PromptPublic.ts +0 -14
  223. package/src/opik/rest_api/api/types/PromptVersion.ts +0 -15
  224. package/src/opik/rest_api/api/types/PromptVersionDetail.ts +0 -15
  225. package/src/opik/rest_api/api/types/PromptVersionLink.ts +0 -9
  226. package/src/opik/rest_api/api/types/PromptVersionLinkPublic.ts +0 -9
  227. package/src/opik/rest_api/api/types/PromptVersionLinkWrite.ts +0 -7
  228. package/src/opik/rest_api/api/types/PromptVersionPagePublic.ts +0 -12
  229. package/src/opik/rest_api/api/types/PromptVersionPublic.ts +0 -14
  230. package/src/opik/rest_api/api/types/ProviderApiKey.ts +0 -13
  231. package/src/opik/rest_api/api/types/ProviderApiKeyPublic.ts +0 -12
  232. package/src/opik/rest_api/api/types/ResponseFormat.ts +0 -10
  233. package/src/opik/rest_api/api/types/ResponseFormatType.ts +0 -11
  234. package/src/opik/rest_api/api/types/ResultsNumberPublic.ts +0 -10
  235. package/src/opik/rest_api/api/types/Span.ts +0 -32
  236. package/src/opik/rest_api/api/types/SpanBatch.ts +0 -9
  237. package/src/opik/rest_api/api/types/SpanPagePublic.ts +0 -12
  238. package/src/opik/rest_api/api/types/SpanPublic.ts +0 -30
  239. package/src/opik/rest_api/api/types/SpanPublicType.ts +0 -11
  240. package/src/opik/rest_api/api/types/SpanType.ts +0 -11
  241. package/src/opik/rest_api/api/types/SpanWrite.ts +0 -25
  242. package/src/opik/rest_api/api/types/SpanWriteType.ts +0 -11
  243. package/src/opik/rest_api/api/types/StreamOptions.ts +0 -7
  244. package/src/opik/rest_api/api/types/Tool.ts +0 -10
  245. package/src/opik/rest_api/api/types/ToolCall.ts +0 -12
  246. package/src/opik/rest_api/api/types/Trace.ts +0 -27
  247. package/src/opik/rest_api/api/types/TraceBatch.ts +0 -9
  248. package/src/opik/rest_api/api/types/TraceCountResponse.ts +0 -9
  249. package/src/opik/rest_api/api/types/TracePagePublic.ts +0 -12
  250. package/src/opik/rest_api/api/types/TracePublic.ts +0 -25
  251. package/src/opik/rest_api/api/types/TraceWrite.ts +0 -19
  252. package/src/opik/rest_api/api/types/Usage.ts +0 -12
  253. package/src/opik/rest_api/api/types/WorkspaceTraceCount.ts +0 -8
  254. package/src/opik/rest_api/api/types/index.ts +0 -138
  255. package/src/opik/rest_api/core/api-promise/APIPromise.ts +0 -54
  256. package/src/opik/rest_api/core/api-promise/index.ts +0 -1
  257. package/src/opik/rest_api/core/fetcher/APIResponse.ts +0 -12
  258. package/src/opik/rest_api/core/fetcher/Fetcher.ts +0 -143
  259. package/src/opik/rest_api/core/fetcher/Supplier.ts +0 -11
  260. package/src/opik/rest_api/core/fetcher/createRequestUrl.ts +0 -10
  261. package/src/opik/rest_api/core/fetcher/getFetchFn.ts +0 -25
  262. package/src/opik/rest_api/core/fetcher/getHeader.ts +0 -8
  263. package/src/opik/rest_api/core/fetcher/getRequestBody.ts +0 -14
  264. package/src/opik/rest_api/core/fetcher/getResponseBody.ts +0 -34
  265. package/src/opik/rest_api/core/fetcher/index.ts +0 -5
  266. package/src/opik/rest_api/core/fetcher/makeRequest.ts +0 -44
  267. package/src/opik/rest_api/core/fetcher/requestWithRetries.ts +0 -33
  268. package/src/opik/rest_api/core/fetcher/signals.ts +0 -38
  269. package/src/opik/rest_api/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +0 -256
  270. package/src/opik/rest_api/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +0 -106
  271. package/src/opik/rest_api/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +0 -243
  272. package/src/opik/rest_api/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +0 -33
  273. package/src/opik/rest_api/core/index.ts +0 -4
  274. package/src/opik/rest_api/core/runtime/index.ts +0 -1
  275. package/src/opik/rest_api/core/runtime/runtime.ts +0 -126
  276. package/src/opik/rest_api/core/schemas/Schema.ts +0 -99
  277. package/src/opik/rest_api/core/schemas/builders/bigint/bigint.ts +0 -50
  278. package/src/opik/rest_api/core/schemas/builders/bigint/index.ts +0 -1
  279. package/src/opik/rest_api/core/schemas/builders/date/date.ts +0 -65
  280. package/src/opik/rest_api/core/schemas/builders/date/index.ts +0 -1
  281. package/src/opik/rest_api/core/schemas/builders/enum/enum.ts +0 -43
  282. package/src/opik/rest_api/core/schemas/builders/enum/index.ts +0 -1
  283. package/src/opik/rest_api/core/schemas/builders/index.ts +0 -14
  284. package/src/opik/rest_api/core/schemas/builders/lazy/index.ts +0 -3
  285. package/src/opik/rest_api/core/schemas/builders/lazy/lazy.ts +0 -32
  286. package/src/opik/rest_api/core/schemas/builders/lazy/lazyObject.ts +0 -20
  287. package/src/opik/rest_api/core/schemas/builders/list/index.ts +0 -1
  288. package/src/opik/rest_api/core/schemas/builders/list/list.ts +0 -73
  289. package/src/opik/rest_api/core/schemas/builders/literals/booleanLiteral.ts +0 -29
  290. package/src/opik/rest_api/core/schemas/builders/literals/index.ts +0 -2
  291. package/src/opik/rest_api/core/schemas/builders/literals/stringLiteral.ts +0 -29
  292. package/src/opik/rest_api/core/schemas/builders/object/index.ts +0 -22
  293. package/src/opik/rest_api/core/schemas/builders/object/object.ts +0 -324
  294. package/src/opik/rest_api/core/schemas/builders/object/objectWithoutOptionalProperties.ts +0 -18
  295. package/src/opik/rest_api/core/schemas/builders/object/property.ts +0 -23
  296. package/src/opik/rest_api/core/schemas/builders/object/types.ts +0 -72
  297. package/src/opik/rest_api/core/schemas/builders/object-like/getObjectLikeUtils.ts +0 -79
  298. package/src/opik/rest_api/core/schemas/builders/object-like/index.ts +0 -2
  299. package/src/opik/rest_api/core/schemas/builders/object-like/types.ts +0 -11
  300. package/src/opik/rest_api/core/schemas/builders/primitives/any.ts +0 -4
  301. package/src/opik/rest_api/core/schemas/builders/primitives/boolean.ts +0 -25
  302. package/src/opik/rest_api/core/schemas/builders/primitives/index.ts +0 -5
  303. package/src/opik/rest_api/core/schemas/builders/primitives/number.ts +0 -25
  304. package/src/opik/rest_api/core/schemas/builders/primitives/string.ts +0 -25
  305. package/src/opik/rest_api/core/schemas/builders/primitives/unknown.ts +0 -4
  306. package/src/opik/rest_api/core/schemas/builders/record/index.ts +0 -2
  307. package/src/opik/rest_api/core/schemas/builders/record/record.ts +0 -130
  308. package/src/opik/rest_api/core/schemas/builders/record/types.ts +0 -17
  309. package/src/opik/rest_api/core/schemas/builders/schema-utils/JsonError.ts +0 -9
  310. package/src/opik/rest_api/core/schemas/builders/schema-utils/ParseError.ts +0 -9
  311. package/src/opik/rest_api/core/schemas/builders/schema-utils/getSchemaUtils.ts +0 -105
  312. package/src/opik/rest_api/core/schemas/builders/schema-utils/index.ts +0 -4
  313. package/src/opik/rest_api/core/schemas/builders/schema-utils/stringifyValidationErrors.ts +0 -8
  314. package/src/opik/rest_api/core/schemas/builders/set/index.ts +0 -1
  315. package/src/opik/rest_api/core/schemas/builders/set/set.ts +0 -43
  316. package/src/opik/rest_api/core/schemas/builders/undiscriminated-union/index.ts +0 -6
  317. package/src/opik/rest_api/core/schemas/builders/undiscriminated-union/types.ts +0 -10
  318. package/src/opik/rest_api/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts +0 -60
  319. package/src/opik/rest_api/core/schemas/builders/union/discriminant.ts +0 -14
  320. package/src/opik/rest_api/core/schemas/builders/union/index.ts +0 -10
  321. package/src/opik/rest_api/core/schemas/builders/union/types.ts +0 -26
  322. package/src/opik/rest_api/core/schemas/builders/union/union.ts +0 -170
  323. package/src/opik/rest_api/core/schemas/index.ts +0 -2
  324. package/src/opik/rest_api/core/schemas/utils/MaybePromise.ts +0 -1
  325. package/src/opik/rest_api/core/schemas/utils/addQuestionMarksToNullableProperties.ts +0 -15
  326. package/src/opik/rest_api/core/schemas/utils/createIdentitySchemaCreator.ts +0 -21
  327. package/src/opik/rest_api/core/schemas/utils/entries.ts +0 -3
  328. package/src/opik/rest_api/core/schemas/utils/filterObject.ts +0 -10
  329. package/src/opik/rest_api/core/schemas/utils/getErrorMessageForIncorrectType.ts +0 -25
  330. package/src/opik/rest_api/core/schemas/utils/isPlainObject.ts +0 -17
  331. package/src/opik/rest_api/core/schemas/utils/keys.ts +0 -3
  332. package/src/opik/rest_api/core/schemas/utils/maybeSkipValidation.ts +0 -38
  333. package/src/opik/rest_api/core/schemas/utils/partition.ts +0 -12
  334. package/src/opik/rest_api/environments.ts +0 -9
  335. package/src/opik/rest_api/errors/OpikApiError.ts +0 -45
  336. package/src/opik/rest_api/errors/OpikApiTimeoutError.ts +0 -10
  337. package/src/opik/rest_api/errors/index.ts +0 -2
  338. package/src/opik/rest_api/index.ts +0 -4
  339. package/src/opik/rest_api/serialization/index.ts +0 -2
  340. package/src/opik/rest_api/serialization/resources/chatCompletions/client/index.ts +0 -1
  341. package/src/opik/rest_api/serialization/resources/chatCompletions/client/requests/ChatCompletionRequest.ts +0 -72
  342. package/src/opik/rest_api/serialization/resources/chatCompletions/client/requests/index.ts +0 -1
  343. package/src/opik/rest_api/serialization/resources/chatCompletions/index.ts +0 -1
  344. package/src/opik/rest_api/serialization/resources/datasets/client/index.ts +0 -1
  345. package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetIdentifier.ts +0 -20
  346. package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetIdentifierPublic.ts +0 -20
  347. package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetItemBatchWrite.ts +0 -25
  348. package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetItemStreamRequest.ts +0 -24
  349. package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetItemsDelete.ts +0 -20
  350. package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetUpdate.ts +0 -20
  351. package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetWrite.ts +0 -22
  352. package/src/opik/rest_api/serialization/resources/datasets/client/requests/index.ts +0 -7
  353. package/src/opik/rest_api/serialization/resources/datasets/index.ts +0 -1
  354. package/src/opik/rest_api/serialization/resources/experiments/client/findFeedbackScoreNames.ts +0 -15
  355. package/src/opik/rest_api/serialization/resources/experiments/client/index.ts +0 -2
  356. package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentItemStreamRequest.ts +0 -24
  357. package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentItemsBatch.ts +0 -21
  358. package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentItemsDelete.ts +0 -20
  359. package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentWrite.ts +0 -28
  360. package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentsDelete.ts +0 -20
  361. package/src/opik/rest_api/serialization/resources/experiments/client/requests/IdentifierPublic.ts +0 -18
  362. package/src/opik/rest_api/serialization/resources/experiments/client/requests/index.ts +0 -6
  363. package/src/opik/rest_api/serialization/resources/experiments/index.ts +0 -1
  364. package/src/opik/rest_api/serialization/resources/feedbackDefinitions/index.ts +0 -1
  365. package/src/opik/rest_api/serialization/resources/feedbackDefinitions/types/FindFeedbackDefinitionsRequestType.ts +0 -16
  366. package/src/opik/rest_api/serialization/resources/feedbackDefinitions/types/index.ts +0 -1
  367. package/src/opik/rest_api/serialization/resources/index.ts +0 -20
  368. package/src/opik/rest_api/serialization/resources/llmProviderKey/client/index.ts +0 -1
  369. package/src/opik/rest_api/serialization/resources/llmProviderKey/client/requests/ProviderApiKeyUpdate.ts +0 -20
  370. package/src/opik/rest_api/serialization/resources/llmProviderKey/client/requests/ProviderApiKeyWrite.ts +0 -20
  371. package/src/opik/rest_api/serialization/resources/llmProviderKey/client/requests/index.ts +0 -2
  372. package/src/opik/rest_api/serialization/resources/llmProviderKey/index.ts +0 -1
  373. package/src/opik/rest_api/serialization/resources/projects/client/index.ts +0 -1
  374. package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectMetricRequestPublic.ts +0 -28
  375. package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectRetrievePublic.ts +0 -20
  376. package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectUpdate.ts +0 -20
  377. package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectWrite.ts +0 -20
  378. package/src/opik/rest_api/serialization/resources/projects/client/requests/index.ts +0 -4
  379. package/src/opik/rest_api/serialization/resources/projects/index.ts +0 -2
  380. package/src/opik/rest_api/serialization/resources/projects/types/ProjectMetricRequestPublicInterval.ts +0 -16
  381. package/src/opik/rest_api/serialization/resources/projects/types/ProjectMetricRequestPublicMetricType.ts +0 -16
  382. package/src/opik/rest_api/serialization/resources/projects/types/index.ts +0 -2
  383. package/src/opik/rest_api/serialization/resources/prompts/client/index.ts +0 -1
  384. package/src/opik/rest_api/serialization/resources/prompts/client/requests/CreatePromptVersionDetail.ts +0 -23
  385. package/src/opik/rest_api/serialization/resources/prompts/client/requests/PromptUpdatable.ts +0 -20
  386. package/src/opik/rest_api/serialization/resources/prompts/client/requests/PromptVersionRetrieveDetail.ts +0 -22
  387. package/src/opik/rest_api/serialization/resources/prompts/client/requests/PromptWrite.ts +0 -24
  388. package/src/opik/rest_api/serialization/resources/prompts/client/requests/index.ts +0 -4
  389. package/src/opik/rest_api/serialization/resources/prompts/index.ts +0 -1
  390. package/src/opik/rest_api/serialization/resources/spans/client/findFeedbackScoreNames1.ts +0 -13
  391. package/src/opik/rest_api/serialization/resources/spans/client/index.ts +0 -2
  392. package/src/opik/rest_api/serialization/resources/spans/client/requests/SpanBatchWrite.ts +0 -19
  393. package/src/opik/rest_api/serialization/resources/spans/client/requests/SpanUpdate.ts +0 -44
  394. package/src/opik/rest_api/serialization/resources/spans/client/requests/index.ts +0 -2
  395. package/src/opik/rest_api/serialization/resources/spans/index.ts +0 -2
  396. package/src/opik/rest_api/serialization/resources/spans/types/FindFeedbackScoreNames1RequestType.ts +0 -16
  397. package/src/opik/rest_api/serialization/resources/spans/types/GetSpanStatsRequestType.ts +0 -16
  398. package/src/opik/rest_api/serialization/resources/spans/types/GetSpansByProjectRequestType.ts +0 -16
  399. package/src/opik/rest_api/serialization/resources/spans/types/index.ts +0 -3
  400. package/src/opik/rest_api/serialization/resources/traces/client/findFeedbackScoreNames2.ts +0 -13
  401. package/src/opik/rest_api/serialization/resources/traces/client/index.ts +0 -2
  402. package/src/opik/rest_api/serialization/resources/traces/client/requests/TraceBatchWrite.ts +0 -19
  403. package/src/opik/rest_api/serialization/resources/traces/client/requests/TraceUpdate.ts +0 -34
  404. package/src/opik/rest_api/serialization/resources/traces/client/requests/index.ts +0 -2
  405. package/src/opik/rest_api/serialization/resources/traces/index.ts +0 -1
  406. package/src/opik/rest_api/serialization/types/AssistantMessage.ts +0 -33
  407. package/src/opik/rest_api/serialization/types/AssistantMessageRole.ts +0 -16
  408. package/src/opik/rest_api/serialization/types/AuthDetailsHolder.ts +0 -16
  409. package/src/opik/rest_api/serialization/types/AvgValueStatPublic.ts +0 -20
  410. package/src/opik/rest_api/serialization/types/BatchDelete.ts +0 -18
  411. package/src/opik/rest_api/serialization/types/BiInformation.ts +0 -22
  412. package/src/opik/rest_api/serialization/types/BiInformationResponse.ts +0 -21
  413. package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinition.ts +0 -29
  414. package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinitionCreate.ts +0 -21
  415. package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinitionPublic.ts +0 -29
  416. package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinitionUpdate.ts +0 -21
  417. package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetail.ts +0 -20
  418. package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetailCreate.ts +0 -20
  419. package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetailPublic.ts +0 -20
  420. package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetailUpdate.ts +0 -20
  421. package/src/opik/rest_api/serialization/types/ChatCompletionChoice.ts +0 -28
  422. package/src/opik/rest_api/serialization/types/ChatCompletionResponse.ts +0 -32
  423. package/src/opik/rest_api/serialization/types/ChunkedOutputJsonNode.ts +0 -23
  424. package/src/opik/rest_api/serialization/types/ChunkedOutputJsonNodeType.ts +0 -20
  425. package/src/opik/rest_api/serialization/types/Column.ts +0 -25
  426. package/src/opik/rest_api/serialization/types/ColumnCompare.ts +0 -25
  427. package/src/opik/rest_api/serialization/types/ColumnCompareTypesItem.ts +0 -16
  428. package/src/opik/rest_api/serialization/types/ColumnPublic.ts +0 -25
  429. package/src/opik/rest_api/serialization/types/ColumnPublicTypesItem.ts +0 -16
  430. package/src/opik/rest_api/serialization/types/ColumnTypesItem.ts +0 -14
  431. package/src/opik/rest_api/serialization/types/CompletionTokensDetails.ts +0 -20
  432. package/src/opik/rest_api/serialization/types/CountValueStatPublic.ts +0 -20
  433. package/src/opik/rest_api/serialization/types/DataPointNumberPublic.ts +0 -22
  434. package/src/opik/rest_api/serialization/types/Dataset.ts +0 -44
  435. package/src/opik/rest_api/serialization/types/DatasetItem.ts +0 -48
  436. package/src/opik/rest_api/serialization/types/DatasetItemBatch.ts +0 -25
  437. package/src/opik/rest_api/serialization/types/DatasetItemCompare.ts +0 -51
  438. package/src/opik/rest_api/serialization/types/DatasetItemCompareSource.ts +0 -16
  439. package/src/opik/rest_api/serialization/types/DatasetItemPageCompare.ts +0 -30
  440. package/src/opik/rest_api/serialization/types/DatasetItemPagePublic.ts +0 -30
  441. package/src/opik/rest_api/serialization/types/DatasetItemPublic.ts +0 -51
  442. package/src/opik/rest_api/serialization/types/DatasetItemPublicSource.ts +0 -16
  443. package/src/opik/rest_api/serialization/types/DatasetItemSource.ts +0 -16
  444. package/src/opik/rest_api/serialization/types/DatasetItemWrite.ts +0 -37
  445. package/src/opik/rest_api/serialization/types/DatasetItemWriteSource.ts +0 -16
  446. package/src/opik/rest_api/serialization/types/DatasetPagePublic.ts +0 -27
  447. package/src/opik/rest_api/serialization/types/DatasetPublic.ts +0 -44
  448. package/src/opik/rest_api/serialization/types/DeleteFeedbackScore.ts +0 -20
  449. package/src/opik/rest_api/serialization/types/Delta.ts +0 -26
  450. package/src/opik/rest_api/serialization/types/DeltaRole.ts +0 -14
  451. package/src/opik/rest_api/serialization/types/ErrorInfo.ts +0 -22
  452. package/src/opik/rest_api/serialization/types/ErrorInfoPublic.ts +0 -24
  453. package/src/opik/rest_api/serialization/types/ErrorInfoWrite.ts +0 -22
  454. package/src/opik/rest_api/serialization/types/ErrorMessage.ts +0 -22
  455. package/src/opik/rest_api/serialization/types/ErrorMessageDetail.ts +0 -24
  456. package/src/opik/rest_api/serialization/types/ErrorMessagePublic.ts +0 -20
  457. package/src/opik/rest_api/serialization/types/Experiment.ts +0 -46
  458. package/src/opik/rest_api/serialization/types/ExperimentItem.ts +0 -43
  459. package/src/opik/rest_api/serialization/types/ExperimentItemCompare.ts +0 -45
  460. package/src/opik/rest_api/serialization/types/ExperimentItemPublic.ts +0 -34
  461. package/src/opik/rest_api/serialization/types/ExperimentPagePublic.ts +0 -27
  462. package/src/opik/rest_api/serialization/types/ExperimentPublic.ts +0 -48
  463. package/src/opik/rest_api/serialization/types/Feedback.ts +0 -48
  464. package/src/opik/rest_api/serialization/types/FeedbackCreate.ts +0 -41
  465. package/src/opik/rest_api/serialization/types/FeedbackDefinitionPagePublic.ts +0 -27
  466. package/src/opik/rest_api/serialization/types/FeedbackObjectPublic.ts +0 -51
  467. package/src/opik/rest_api/serialization/types/FeedbackPublic.ts +0 -49
  468. package/src/opik/rest_api/serialization/types/FeedbackScore.ts +0 -35
  469. package/src/opik/rest_api/serialization/types/FeedbackScoreAverage.ts +0 -22
  470. package/src/opik/rest_api/serialization/types/FeedbackScoreAveragePublic.ts +0 -22
  471. package/src/opik/rest_api/serialization/types/FeedbackScoreBatch.ts +0 -21
  472. package/src/opik/rest_api/serialization/types/FeedbackScoreBatchItem.ts +0 -33
  473. package/src/opik/rest_api/serialization/types/FeedbackScoreBatchItemSource.ts +0 -16
  474. package/src/opik/rest_api/serialization/types/FeedbackScoreCompare.ts +0 -37
  475. package/src/opik/rest_api/serialization/types/FeedbackScoreCompareSource.ts +0 -16
  476. package/src/opik/rest_api/serialization/types/FeedbackScorePublic.ts +0 -37
  477. package/src/opik/rest_api/serialization/types/FeedbackScorePublicSource.ts +0 -16
  478. package/src/opik/rest_api/serialization/types/FeedbackScoreSource.ts +0 -16
  479. package/src/opik/rest_api/serialization/types/FeedbackUpdate.ts +0 -41
  480. package/src/opik/rest_api/serialization/types/Function.ts +0 -25
  481. package/src/opik/rest_api/serialization/types/FunctionCall.ts +0 -20
  482. package/src/opik/rest_api/serialization/types/JsonNode.ts +0 -14
  483. package/src/opik/rest_api/serialization/types/JsonNodeCompare.ts +0 -14
  484. package/src/opik/rest_api/serialization/types/JsonNodePublic.ts +0 -14
  485. package/src/opik/rest_api/serialization/types/JsonNodeWrite.ts +0 -14
  486. package/src/opik/rest_api/serialization/types/JsonObjectSchema.ts +0 -34
  487. package/src/opik/rest_api/serialization/types/JsonSchema.ts +0 -23
  488. package/src/opik/rest_api/serialization/types/JsonSchemaElement.ts +0 -20
  489. package/src/opik/rest_api/serialization/types/Message.ts +0 -16
  490. package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinition.ts +0 -29
  491. package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinitionCreate.ts +0 -21
  492. package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinitionPublic.ts +0 -29
  493. package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinitionUpdate.ts +0 -21
  494. package/src/opik/rest_api/serialization/types/NumericalFeedbackDetail.ts +0 -22
  495. package/src/opik/rest_api/serialization/types/NumericalFeedbackDetailCreate.ts +0 -22
  496. package/src/opik/rest_api/serialization/types/NumericalFeedbackDetailPublic.ts +0 -22
  497. package/src/opik/rest_api/serialization/types/NumericalFeedbackDetailUpdate.ts +0 -22
  498. package/src/opik/rest_api/serialization/types/PageColumns.ts +0 -19
  499. package/src/opik/rest_api/serialization/types/PercentageValueStatPublic.ts +0 -21
  500. package/src/opik/rest_api/serialization/types/PercentageValuesPublic.ts +0 -24
  501. package/src/opik/rest_api/serialization/types/Project.ts +0 -32
  502. package/src/opik/rest_api/serialization/types/ProjectMetricResponsePublic.ts +0 -29
  503. package/src/opik/rest_api/serialization/types/ProjectMetricResponsePublicInterval.ts +0 -16
  504. package/src/opik/rest_api/serialization/types/ProjectMetricResponsePublicMetricType.ts +0 -16
  505. package/src/opik/rest_api/serialization/types/ProjectPagePublic.ts +0 -29
  506. package/src/opik/rest_api/serialization/types/ProjectPublic.ts +0 -32
  507. package/src/opik/rest_api/serialization/types/ProjectStatItemObjectPublic.ts +0 -50
  508. package/src/opik/rest_api/serialization/types/ProjectStatsPublic.ts +0 -21
  509. package/src/opik/rest_api/serialization/types/Prompt.ts +0 -37
  510. package/src/opik/rest_api/serialization/types/PromptDetail.ts +0 -35
  511. package/src/opik/rest_api/serialization/types/PromptPagePublic.ts +0 -27
  512. package/src/opik/rest_api/serialization/types/PromptPublic.ts +0 -32
  513. package/src/opik/rest_api/serialization/types/PromptVersion.ts +0 -30
  514. package/src/opik/rest_api/serialization/types/PromptVersionDetail.ts +0 -32
  515. package/src/opik/rest_api/serialization/types/PromptVersionLink.ts +0 -24
  516. package/src/opik/rest_api/serialization/types/PromptVersionLinkPublic.ts +0 -24
  517. package/src/opik/rest_api/serialization/types/PromptVersionLinkWrite.ts +0 -20
  518. package/src/opik/rest_api/serialization/types/PromptVersionPagePublic.ts +0 -27
  519. package/src/opik/rest_api/serialization/types/PromptVersionPublic.ts +0 -30
  520. package/src/opik/rest_api/serialization/types/ProviderApiKey.ts +0 -30
  521. package/src/opik/rest_api/serialization/types/ProviderApiKeyPublic.ts +0 -30
  522. package/src/opik/rest_api/serialization/types/ResponseFormat.ts +0 -22
  523. package/src/opik/rest_api/serialization/types/ResponseFormatType.ts +0 -16
  524. package/src/opik/rest_api/serialization/types/ResultsNumberPublic.ts +0 -23
  525. package/src/opik/rest_api/serialization/types/Span.ts +0 -65
  526. package/src/opik/rest_api/serialization/types/SpanBatch.ts +0 -19
  527. package/src/opik/rest_api/serialization/types/SpanPagePublic.ts +0 -25
  528. package/src/opik/rest_api/serialization/types/SpanPublic.ts +0 -67
  529. package/src/opik/rest_api/serialization/types/SpanPublicType.ts +0 -14
  530. package/src/opik/rest_api/serialization/types/SpanType.ts +0 -15
  531. package/src/opik/rest_api/serialization/types/SpanWrite.ts +0 -51
  532. package/src/opik/rest_api/serialization/types/SpanWriteType.ts +0 -14
  533. package/src/opik/rest_api/serialization/types/StreamOptions.ts +0 -18
  534. package/src/opik/rest_api/serialization/types/Tool.ts +0 -20
  535. package/src/opik/rest_api/serialization/types/ToolCall.ts +0 -25
  536. package/src/opik/rest_api/serialization/types/Trace.ts +0 -54
  537. package/src/opik/rest_api/serialization/types/TraceBatch.ts +0 -19
  538. package/src/opik/rest_api/serialization/types/TraceCountResponse.ts +0 -24
  539. package/src/opik/rest_api/serialization/types/TracePagePublic.ts +0 -27
  540. package/src/opik/rest_api/serialization/types/TracePublic.ts +0 -56
  541. package/src/opik/rest_api/serialization/types/TraceWrite.ts +0 -38
  542. package/src/opik/rest_api/serialization/types/Usage.ts +0 -27
  543. package/src/opik/rest_api/serialization/types/WorkspaceTraceCount.ts +0 -22
  544. package/src/opik/rest_api/serialization/types/index.ts +0 -138
  545. package/src/opik/tracer/Span.ts +0 -34
  546. package/src/opik/tracer/Trace.ts +0 -61
  547. package/tests/client.test.ts +0 -25
  548. package/tsconfig.json +0 -25
  549. package/tsup.config.ts +0 -11
  550. package/vitest.config.ts +0 -13
@@ -1,130 +0,0 @@
1
- import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema";
2
- import { entries } from "../../utils/entries";
3
- import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
4
- import { isPlainObject } from "../../utils/isPlainObject";
5
- import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
6
- import { getSchemaUtils } from "../schema-utils";
7
- import { BaseRecordSchema, RecordSchema } from "./types";
8
-
9
- export function record<RawKey extends string | number, RawValue, ParsedValue, ParsedKey extends string | number>(
10
- keySchema: Schema<RawKey, ParsedKey>,
11
- valueSchema: Schema<RawValue, ParsedValue>
12
- ): RecordSchema<RawKey, RawValue, ParsedKey, ParsedValue> {
13
- const baseSchema: BaseRecordSchema<RawKey, RawValue, ParsedKey, ParsedValue> = {
14
- parse: (raw, opts) => {
15
- return validateAndTransformRecord({
16
- value: raw,
17
- isKeyNumeric: keySchema.getType() === SchemaType.NUMBER,
18
- transformKey: (key) =>
19
- keySchema.parse(key, {
20
- ...opts,
21
- breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`],
22
- }),
23
- transformValue: (value, key) =>
24
- valueSchema.parse(value, {
25
- ...opts,
26
- breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`],
27
- }),
28
- breadcrumbsPrefix: opts?.breadcrumbsPrefix,
29
- });
30
- },
31
- json: (parsed, opts) => {
32
- return validateAndTransformRecord({
33
- value: parsed,
34
- isKeyNumeric: keySchema.getType() === SchemaType.NUMBER,
35
- transformKey: (key) =>
36
- keySchema.json(key, {
37
- ...opts,
38
- breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`],
39
- }),
40
- transformValue: (value, key) =>
41
- valueSchema.json(value, {
42
- ...opts,
43
- breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`],
44
- }),
45
- breadcrumbsPrefix: opts?.breadcrumbsPrefix,
46
- });
47
- },
48
- getType: () => SchemaType.RECORD,
49
- };
50
-
51
- return {
52
- ...maybeSkipValidation(baseSchema),
53
- ...getSchemaUtils(baseSchema),
54
- };
55
- }
56
-
57
- function validateAndTransformRecord<TransformedKey extends string | number, TransformedValue>({
58
- value,
59
- isKeyNumeric,
60
- transformKey,
61
- transformValue,
62
- breadcrumbsPrefix = [],
63
- }: {
64
- value: unknown;
65
- isKeyNumeric: boolean;
66
- transformKey: (key: string | number) => MaybeValid<TransformedKey>;
67
- transformValue: (value: unknown, key: string | number) => MaybeValid<TransformedValue>;
68
- breadcrumbsPrefix: string[] | undefined;
69
- }): MaybeValid<Record<TransformedKey, TransformedValue>> {
70
- if (!isPlainObject(value)) {
71
- return {
72
- ok: false,
73
- errors: [
74
- {
75
- path: breadcrumbsPrefix,
76
- message: getErrorMessageForIncorrectType(value, "object"),
77
- },
78
- ],
79
- };
80
- }
81
-
82
- return entries(value).reduce<MaybeValid<Record<TransformedKey, TransformedValue>>>(
83
- (accPromise, [stringKey, value]) => {
84
- // skip nullish keys
85
- if (value == null) {
86
- return accPromise;
87
- }
88
-
89
- const acc = accPromise;
90
-
91
- let key: string | number = stringKey;
92
- if (isKeyNumeric) {
93
- const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
94
- if (!isNaN(numberKey)) {
95
- key = numberKey;
96
- }
97
- }
98
- const transformedKey = transformKey(key);
99
-
100
- const transformedValue = transformValue(value, key);
101
-
102
- if (acc.ok && transformedKey.ok && transformedValue.ok) {
103
- return {
104
- ok: true,
105
- value: {
106
- ...acc.value,
107
- [transformedKey.value]: transformedValue.value,
108
- },
109
- };
110
- }
111
-
112
- const errors: ValidationError[] = [];
113
- if (!acc.ok) {
114
- errors.push(...acc.errors);
115
- }
116
- if (!transformedKey.ok) {
117
- errors.push(...transformedKey.errors);
118
- }
119
- if (!transformedValue.ok) {
120
- errors.push(...transformedValue.errors);
121
- }
122
-
123
- return {
124
- ok: false,
125
- errors,
126
- };
127
- },
128
- { ok: true, value: {} as Record<TransformedKey, TransformedValue> }
129
- );
130
- }
@@ -1,17 +0,0 @@
1
- import { BaseSchema } from "../../Schema";
2
- import { SchemaUtils } from "../schema-utils";
3
-
4
- export type RecordSchema<
5
- RawKey extends string | number,
6
- RawValue,
7
- ParsedKey extends string | number,
8
- ParsedValue
9
- > = BaseRecordSchema<RawKey, RawValue, ParsedKey, ParsedValue> &
10
- SchemaUtils<Record<RawKey, RawValue>, Record<ParsedKey, ParsedValue>>;
11
-
12
- export type BaseRecordSchema<
13
- RawKey extends string | number,
14
- RawValue,
15
- ParsedKey extends string | number,
16
- ParsedValue
17
- > = BaseSchema<Record<RawKey, RawValue>, Record<ParsedKey, ParsedValue>>;
@@ -1,9 +0,0 @@
1
- import { ValidationError } from "../../Schema";
2
- import { stringifyValidationError } from "./stringifyValidationErrors";
3
-
4
- export class JsonError extends Error {
5
- constructor(public readonly errors: ValidationError[]) {
6
- super(errors.map(stringifyValidationError).join("; "));
7
- Object.setPrototypeOf(this, JsonError.prototype);
8
- }
9
- }
@@ -1,9 +0,0 @@
1
- import { ValidationError } from "../../Schema";
2
- import { stringifyValidationError } from "./stringifyValidationErrors";
3
-
4
- export class ParseError extends Error {
5
- constructor(public readonly errors: ValidationError[]) {
6
- super(errors.map(stringifyValidationError).join("; "));
7
- Object.setPrototypeOf(this, ParseError.prototype);
8
- }
9
- }
@@ -1,105 +0,0 @@
1
- import { BaseSchema, Schema, SchemaOptions, SchemaType } from "../../Schema";
2
- import { JsonError } from "./JsonError";
3
- import { ParseError } from "./ParseError";
4
-
5
- export interface SchemaUtils<Raw, Parsed> {
6
- optional: () => Schema<Raw | null | undefined, Parsed | undefined>;
7
- transform: <Transformed>(transformer: SchemaTransformer<Parsed, Transformed>) => Schema<Raw, Transformed>;
8
- parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed;
9
- jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw;
10
- }
11
-
12
- export interface SchemaTransformer<Parsed, Transformed> {
13
- transform: (parsed: Parsed) => Transformed;
14
- untransform: (transformed: any) => Parsed;
15
- }
16
-
17
- export function getSchemaUtils<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): SchemaUtils<Raw, Parsed> {
18
- return {
19
- optional: () => optional(schema),
20
- transform: (transformer) => transform(schema, transformer),
21
- parseOrThrow: (raw, opts) => {
22
- const parsed = schema.parse(raw, opts);
23
- if (parsed.ok) {
24
- return parsed.value;
25
- }
26
- throw new ParseError(parsed.errors);
27
- },
28
- jsonOrThrow: (parsed, opts) => {
29
- const raw = schema.json(parsed, opts);
30
- if (raw.ok) {
31
- return raw.value;
32
- }
33
- throw new JsonError(raw.errors);
34
- },
35
- };
36
- }
37
-
38
- /**
39
- * schema utils are defined in one file to resolve issues with circular imports
40
- */
41
-
42
- export function optional<Raw, Parsed>(
43
- schema: BaseSchema<Raw, Parsed>
44
- ): Schema<Raw | null | undefined, Parsed | undefined> {
45
- const baseSchema: BaseSchema<Raw | null | undefined, Parsed | undefined> = {
46
- parse: (raw, opts) => {
47
- if (raw == null) {
48
- return {
49
- ok: true,
50
- value: undefined,
51
- };
52
- }
53
- return schema.parse(raw, opts);
54
- },
55
- json: (parsed, opts) => {
56
- if (opts?.omitUndefined && parsed === undefined) {
57
- return {
58
- ok: true,
59
- value: undefined,
60
- };
61
- }
62
- if (parsed == null) {
63
- return {
64
- ok: true,
65
- value: null,
66
- };
67
- }
68
- return schema.json(parsed, opts);
69
- },
70
- getType: () => SchemaType.OPTIONAL,
71
- };
72
-
73
- return {
74
- ...baseSchema,
75
- ...getSchemaUtils(baseSchema),
76
- };
77
- }
78
-
79
- export function transform<Raw, Parsed, Transformed>(
80
- schema: BaseSchema<Raw, Parsed>,
81
- transformer: SchemaTransformer<Parsed, Transformed>
82
- ): Schema<Raw, Transformed> {
83
- const baseSchema: BaseSchema<Raw, Transformed> = {
84
- parse: (raw, opts) => {
85
- const parsed = schema.parse(raw, opts);
86
- if (!parsed.ok) {
87
- return parsed;
88
- }
89
- return {
90
- ok: true,
91
- value: transformer.transform(parsed.value),
92
- };
93
- },
94
- json: (transformed, opts) => {
95
- const parsed = transformer.untransform(transformed);
96
- return schema.json(parsed, opts);
97
- },
98
- getType: () => schema.getType(),
99
- };
100
-
101
- return {
102
- ...baseSchema,
103
- ...getSchemaUtils(baseSchema),
104
- };
105
- }
@@ -1,4 +0,0 @@
1
- export { getSchemaUtils, optional, transform } from "./getSchemaUtils";
2
- export type { SchemaUtils } from "./getSchemaUtils";
3
- export { JsonError } from "./JsonError";
4
- export { ParseError } from "./ParseError";
@@ -1,8 +0,0 @@
1
- import { ValidationError } from "../../Schema";
2
-
3
- export function stringifyValidationError(error: ValidationError): string {
4
- if (error.path.length === 0) {
5
- return error.message;
6
- }
7
- return `${error.path.join(" -> ")}: ${error.message}`;
8
- }
@@ -1 +0,0 @@
1
- export { set } from "./set";
@@ -1,43 +0,0 @@
1
- import { BaseSchema, Schema, SchemaType } from "../../Schema";
2
- import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
3
- import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
4
- import { list } from "../list";
5
- import { getSchemaUtils } from "../schema-utils";
6
-
7
- export function set<Raw, Parsed>(schema: Schema<Raw, Parsed>): Schema<Raw[], Set<Parsed>> {
8
- const listSchema = list(schema);
9
- const baseSchema: BaseSchema<Raw[], Set<Parsed>> = {
10
- parse: (raw, opts) => {
11
- const parsedList = listSchema.parse(raw, opts);
12
- if (parsedList.ok) {
13
- return {
14
- ok: true,
15
- value: new Set(parsedList.value),
16
- };
17
- } else {
18
- return parsedList;
19
- }
20
- },
21
- json: (parsed, opts) => {
22
- if (!(parsed instanceof Set)) {
23
- return {
24
- ok: false,
25
- errors: [
26
- {
27
- path: opts?.breadcrumbsPrefix ?? [],
28
- message: getErrorMessageForIncorrectType(parsed, "Set"),
29
- },
30
- ],
31
- };
32
- }
33
- const jsonList = listSchema.json([...parsed], opts);
34
- return jsonList;
35
- },
36
- getType: () => SchemaType.SET,
37
- };
38
-
39
- return {
40
- ...maybeSkipValidation(baseSchema),
41
- ...getSchemaUtils(baseSchema),
42
- };
43
- }
@@ -1,6 +0,0 @@
1
- export type {
2
- inferParsedUnidiscriminatedUnionSchema,
3
- inferRawUnidiscriminatedUnionSchema,
4
- UndiscriminatedUnionSchema,
5
- } from "./types";
6
- export { undiscriminatedUnion } from "./undiscriminatedUnion";
@@ -1,10 +0,0 @@
1
- import { inferParsed, inferRaw, Schema } from "../../Schema";
2
-
3
- export type UndiscriminatedUnionSchema<Schemas extends [...Schema[]]> = Schema<
4
- inferRawUnidiscriminatedUnionSchema<Schemas>,
5
- inferParsedUnidiscriminatedUnionSchema<Schemas>
6
- >;
7
-
8
- export type inferRawUnidiscriminatedUnionSchema<Schemas extends [...Schema[]]> = inferRaw<Schemas[number]>;
9
-
10
- export type inferParsedUnidiscriminatedUnionSchema<Schemas extends [...Schema[]]> = inferParsed<Schemas[number]>;
@@ -1,60 +0,0 @@
1
- import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType, ValidationError } from "../../Schema";
2
- import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
3
- import { getSchemaUtils } from "../schema-utils";
4
- import { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema } from "./types";
5
-
6
- export function undiscriminatedUnion<Schemas extends [Schema<any, any>, ...Schema<any, any>[]]>(
7
- schemas: Schemas
8
- ): Schema<inferRawUnidiscriminatedUnionSchema<Schemas>, inferParsedUnidiscriminatedUnionSchema<Schemas>> {
9
- const baseSchema: BaseSchema<
10
- inferRawUnidiscriminatedUnionSchema<Schemas>,
11
- inferParsedUnidiscriminatedUnionSchema<Schemas>
12
- > = {
13
- parse: (raw, opts) => {
14
- return validateAndTransformUndiscriminatedUnion<inferParsedUnidiscriminatedUnionSchema<Schemas>>(
15
- (schema, opts) => schema.parse(raw, opts),
16
- schemas,
17
- opts
18
- );
19
- },
20
- json: (parsed, opts) => {
21
- return validateAndTransformUndiscriminatedUnion<inferRawUnidiscriminatedUnionSchema<Schemas>>(
22
- (schema, opts) => schema.json(parsed, opts),
23
- schemas,
24
- opts
25
- );
26
- },
27
- getType: () => SchemaType.UNDISCRIMINATED_UNION,
28
- };
29
-
30
- return {
31
- ...maybeSkipValidation(baseSchema),
32
- ...getSchemaUtils(baseSchema),
33
- };
34
- }
35
-
36
- function validateAndTransformUndiscriminatedUnion<Transformed>(
37
- transform: (schema: Schema<any, any>, opts: SchemaOptions) => MaybeValid<Transformed>,
38
- schemas: Schema<any, any>[],
39
- opts: SchemaOptions | undefined
40
- ): MaybeValid<Transformed> {
41
- const errors: ValidationError[] = [];
42
- for (const [index, schema] of schemas.entries()) {
43
- const transformed = transform(schema, { ...opts, skipValidation: false });
44
- if (transformed.ok) {
45
- return transformed;
46
- } else {
47
- for (const error of transformed.errors) {
48
- errors.push({
49
- path: error.path,
50
- message: `[Variant ${index}] ${error.message}`,
51
- });
52
- }
53
- }
54
- }
55
-
56
- return {
57
- ok: false,
58
- errors,
59
- };
60
- }
@@ -1,14 +0,0 @@
1
- export function discriminant<RawDiscriminant extends string, ParsedDiscriminant extends string>(
2
- parsedDiscriminant: ParsedDiscriminant,
3
- rawDiscriminant: RawDiscriminant
4
- ): Discriminant<RawDiscriminant, ParsedDiscriminant> {
5
- return {
6
- parsedDiscriminant,
7
- rawDiscriminant,
8
- };
9
- }
10
-
11
- export interface Discriminant<RawDiscriminant extends string, ParsedDiscriminant extends string> {
12
- parsedDiscriminant: ParsedDiscriminant;
13
- rawDiscriminant: RawDiscriminant;
14
- }
@@ -1,10 +0,0 @@
1
- export { discriminant } from "./discriminant";
2
- export type { Discriminant } from "./discriminant";
3
- export type {
4
- inferParsedDiscriminant,
5
- inferParsedUnion,
6
- inferRawDiscriminant,
7
- inferRawUnion,
8
- UnionSubtypes,
9
- } from "./types";
10
- export { union } from "./union";
@@ -1,26 +0,0 @@
1
- import { inferParsedObject, inferRawObject, ObjectSchema } from "../object";
2
- import { Discriminant } from "./discriminant";
3
-
4
- export type UnionSubtypes<DiscriminantValues extends string | number | symbol> = {
5
- [K in DiscriminantValues]: ObjectSchema<any, any>;
6
- };
7
-
8
- export type inferRawUnion<D extends string | Discriminant<any, any>, U extends UnionSubtypes<keyof U>> = {
9
- [K in keyof U]: Record<inferRawDiscriminant<D>, K> & inferRawObject<U[K]>;
10
- }[keyof U];
11
-
12
- export type inferParsedUnion<D extends string | Discriminant<any, any>, U extends UnionSubtypes<keyof U>> = {
13
- [K in keyof U]: Record<inferParsedDiscriminant<D>, K> & inferParsedObject<U[K]>;
14
- }[keyof U];
15
-
16
- export type inferRawDiscriminant<D extends string | Discriminant<any, any>> = D extends string
17
- ? D
18
- : D extends Discriminant<infer Raw, any>
19
- ? Raw
20
- : never;
21
-
22
- export type inferParsedDiscriminant<D extends string | Discriminant<any, any>> = D extends string
23
- ? D
24
- : D extends Discriminant<any, infer Parsed>
25
- ? Parsed
26
- : never;
@@ -1,170 +0,0 @@
1
- import { BaseSchema, MaybeValid, SchemaType } from "../../Schema";
2
- import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
3
- import { isPlainObject } from "../../utils/isPlainObject";
4
- import { keys } from "../../utils/keys";
5
- import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
6
- import { enum_ } from "../enum";
7
- import { ObjectSchema } from "../object";
8
- import { getObjectLikeUtils, ObjectLikeSchema } from "../object-like";
9
- import { getSchemaUtils } from "../schema-utils";
10
- import { Discriminant } from "./discriminant";
11
- import { inferParsedDiscriminant, inferParsedUnion, inferRawDiscriminant, inferRawUnion, UnionSubtypes } from "./types";
12
-
13
- export function union<D extends string | Discriminant<any, any>, U extends UnionSubtypes<any>>(
14
- discriminant: D,
15
- union: U
16
- ): ObjectLikeSchema<inferRawUnion<D, U>, inferParsedUnion<D, U>> {
17
- const rawDiscriminant =
18
- typeof discriminant === "string" ? discriminant : (discriminant.rawDiscriminant as inferRawDiscriminant<D>);
19
- const parsedDiscriminant =
20
- typeof discriminant === "string"
21
- ? discriminant
22
- : (discriminant.parsedDiscriminant as inferParsedDiscriminant<D>);
23
-
24
- const discriminantValueSchema = enum_(keys(union) as string[]);
25
-
26
- const baseSchema: BaseSchema<inferRawUnion<D, U>, inferParsedUnion<D, U>> = {
27
- parse: (raw, opts) => {
28
- return transformAndValidateUnion({
29
- value: raw,
30
- discriminant: rawDiscriminant,
31
- transformedDiscriminant: parsedDiscriminant,
32
- transformDiscriminantValue: (discriminantValue) =>
33
- discriminantValueSchema.parse(discriminantValue, {
34
- allowUnrecognizedEnumValues: opts?.allowUnrecognizedUnionMembers,
35
- breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), rawDiscriminant],
36
- }),
37
- getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue],
38
- allowUnrecognizedUnionMembers: opts?.allowUnrecognizedUnionMembers,
39
- transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) =>
40
- additionalPropertiesSchema.parse(additionalProperties, opts),
41
- breadcrumbsPrefix: opts?.breadcrumbsPrefix,
42
- });
43
- },
44
- json: (parsed, opts) => {
45
- return transformAndValidateUnion({
46
- value: parsed,
47
- discriminant: parsedDiscriminant,
48
- transformedDiscriminant: rawDiscriminant,
49
- transformDiscriminantValue: (discriminantValue) =>
50
- discriminantValueSchema.json(discriminantValue, {
51
- allowUnrecognizedEnumValues: opts?.allowUnrecognizedUnionMembers,
52
- breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedDiscriminant],
53
- }),
54
- getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue],
55
- allowUnrecognizedUnionMembers: opts?.allowUnrecognizedUnionMembers,
56
- transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) =>
57
- additionalPropertiesSchema.json(additionalProperties, opts),
58
- breadcrumbsPrefix: opts?.breadcrumbsPrefix,
59
- });
60
- },
61
- getType: () => SchemaType.UNION,
62
- };
63
-
64
- return {
65
- ...maybeSkipValidation(baseSchema),
66
- ...getSchemaUtils(baseSchema),
67
- ...getObjectLikeUtils(baseSchema),
68
- };
69
- }
70
-
71
- function transformAndValidateUnion<
72
- TransformedDiscriminant extends string,
73
- TransformedDiscriminantValue extends string,
74
- TransformedAdditionalProperties
75
- >({
76
- value,
77
- discriminant,
78
- transformedDiscriminant,
79
- transformDiscriminantValue,
80
- getAdditionalPropertiesSchema,
81
- allowUnrecognizedUnionMembers = false,
82
- transformAdditionalProperties,
83
- breadcrumbsPrefix = [],
84
- }: {
85
- value: unknown;
86
- discriminant: string;
87
- transformedDiscriminant: TransformedDiscriminant;
88
- transformDiscriminantValue: (discriminantValue: unknown) => MaybeValid<TransformedDiscriminantValue>;
89
- getAdditionalPropertiesSchema: (discriminantValue: string) => ObjectSchema<any, any> | undefined;
90
- allowUnrecognizedUnionMembers: boolean | undefined;
91
- transformAdditionalProperties: (
92
- additionalProperties: unknown,
93
- additionalPropertiesSchema: ObjectSchema<any, any>
94
- ) => MaybeValid<TransformedAdditionalProperties>;
95
- breadcrumbsPrefix: string[] | undefined;
96
- }): MaybeValid<Record<TransformedDiscriminant, TransformedDiscriminantValue> & TransformedAdditionalProperties> {
97
- if (!isPlainObject(value)) {
98
- return {
99
- ok: false,
100
- errors: [
101
- {
102
- path: breadcrumbsPrefix,
103
- message: getErrorMessageForIncorrectType(value, "object"),
104
- },
105
- ],
106
- };
107
- }
108
-
109
- const { [discriminant]: discriminantValue, ...additionalProperties } = value;
110
-
111
- if (discriminantValue == null) {
112
- return {
113
- ok: false,
114
- errors: [
115
- {
116
- path: breadcrumbsPrefix,
117
- message: `Missing discriminant ("${discriminant}")`,
118
- },
119
- ],
120
- };
121
- }
122
-
123
- const transformedDiscriminantValue = transformDiscriminantValue(discriminantValue);
124
- if (!transformedDiscriminantValue.ok) {
125
- return {
126
- ok: false,
127
- errors: transformedDiscriminantValue.errors,
128
- };
129
- }
130
-
131
- const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
132
-
133
- if (additionalPropertiesSchema == null) {
134
- if (allowUnrecognizedUnionMembers) {
135
- return {
136
- ok: true,
137
- value: {
138
- [transformedDiscriminant]: transformedDiscriminantValue.value,
139
- ...additionalProperties,
140
- } as Record<TransformedDiscriminant, TransformedDiscriminantValue> & TransformedAdditionalProperties,
141
- };
142
- } else {
143
- return {
144
- ok: false,
145
- errors: [
146
- {
147
- path: [...breadcrumbsPrefix, discriminant],
148
- message: "Unexpected discriminant value",
149
- },
150
- ],
151
- };
152
- }
153
- }
154
-
155
- const transformedAdditionalProperties = transformAdditionalProperties(
156
- additionalProperties,
157
- additionalPropertiesSchema
158
- );
159
- if (!transformedAdditionalProperties.ok) {
160
- return transformedAdditionalProperties;
161
- }
162
-
163
- return {
164
- ok: true,
165
- value: {
166
- [transformedDiscriminant]: discriminantValue,
167
- ...transformedAdditionalProperties.value,
168
- } as Record<TransformedDiscriminant, TransformedDiscriminantValue> & TransformedAdditionalProperties,
169
- };
170
- }
@@ -1,2 +0,0 @@
1
- export * from "./builders";
2
- export type { inferParsed, inferRaw, Schema, SchemaOptions } from "./Schema";
@@ -1 +0,0 @@
1
- export type MaybePromise<T> = T | Promise<T>;
@@ -1,15 +0,0 @@
1
- export type addQuestionMarksToNullableProperties<T> = {
2
- [K in OptionalKeys<T>]?: T[K];
3
- } & Pick<T, RequiredKeys<T>>;
4
-
5
- export type OptionalKeys<T> = {
6
- [K in keyof T]-?: undefined extends T[K]
7
- ? K
8
- : null extends T[K]
9
- ? K
10
- : 1 extends (any extends T[K] ? 0 : 1)
11
- ? never
12
- : K;
13
- }[keyof T];
14
-
15
- export type RequiredKeys<T> = Exclude<keyof T, OptionalKeys<T>>;