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.
- package/dist/index.cjs +239 -127
- package/dist/index.d.cts +111 -89
- package/dist/index.d.ts +111 -89
- package/dist/index.js +239 -127
- package/package.json +12 -1
- package/examples/manual-trace.js +0 -16
- package/src/opik/client/Client.ts +0 -65
- package/src/opik/config/Config.ts +0 -35
- package/src/opik/index.ts +0 -2
- package/src/opik/rest_api/Client.ts +0 -247
- package/src/opik/rest_api/api/errors/BadRequestError.ts +0 -16
- package/src/opik/rest_api/api/errors/ConflictError.ts +0 -16
- package/src/opik/rest_api/api/errors/ForbiddenError.ts +0 -17
- package/src/opik/rest_api/api/errors/NotFoundError.ts +0 -16
- package/src/opik/rest_api/api/errors/NotImplementedError.ts +0 -16
- package/src/opik/rest_api/api/errors/UnauthorizedError.ts +0 -17
- package/src/opik/rest_api/api/errors/UnprocessableEntityError.ts +0 -16
- package/src/opik/rest_api/api/errors/index.ts +0 -7
- package/src/opik/rest_api/api/index.ts +0 -3
- package/src/opik/rest_api/api/resources/chatCompletions/client/Client.ts +0 -125
- package/src/opik/rest_api/api/resources/chatCompletions/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/chatCompletions/client/requests/ChatCompletionRequest.ts +0 -33
- package/src/opik/rest_api/api/resources/chatCompletions/client/requests/index.ts +0 -1
- package/src/opik/rest_api/api/resources/chatCompletions/index.ts +0 -1
- package/src/opik/rest_api/api/resources/check/client/Client.ts +0 -141
- package/src/opik/rest_api/api/resources/check/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/check/index.ts +0 -1
- package/src/opik/rest_api/api/resources/datasets/client/Client.ts +0 -1244
- package/src/opik/rest_api/api/resources/datasets/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetIdentifier.ts +0 -13
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetIdentifierPublic.ts +0 -13
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetItemBatchWrite.ts +0 -21
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetItemStreamRequest.ts +0 -9
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetItemsDelete.ts +0 -13
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetUpdate.ts +0 -14
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetWrite.ts +0 -15
- package/src/opik/rest_api/api/resources/datasets/client/requests/FindDatasetItemsWithExperimentItemsRequest.ts +0 -17
- package/src/opik/rest_api/api/resources/datasets/client/requests/FindDatasetsRequest.ts +0 -16
- package/src/opik/rest_api/api/resources/datasets/client/requests/GetDatasetItemsOutputColumnsRequest.ts +0 -11
- package/src/opik/rest_api/api/resources/datasets/client/requests/GetDatasetItemsRequest.ts +0 -13
- package/src/opik/rest_api/api/resources/datasets/client/requests/index.ts +0 -11
- package/src/opik/rest_api/api/resources/datasets/index.ts +0 -1
- package/src/opik/rest_api/api/resources/experiments/client/Client.ts +0 -858
- package/src/opik/rest_api/api/resources/experiments/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentItemStreamRequest.ts +0 -9
- package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentItemsBatch.ts +0 -19
- package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentItemsDelete.ts +0 -13
- package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentWrite.ts +0 -19
- package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentsDelete.ts +0 -13
- package/src/opik/rest_api/api/resources/experiments/client/requests/FindExperimentsRequest.ts +0 -16
- package/src/opik/rest_api/api/resources/experiments/client/requests/FindFeedbackScoreNamesRequest.ts +0 -11
- package/src/opik/rest_api/api/resources/experiments/client/requests/IdentifierPublic.ts +0 -13
- package/src/opik/rest_api/api/resources/experiments/client/requests/index.ts +0 -8
- package/src/opik/rest_api/api/resources/experiments/index.ts +0 -1
- package/src/opik/rest_api/api/resources/feedbackDefinitions/client/Client.ts +0 -515
- package/src/opik/rest_api/api/resources/feedbackDefinitions/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/feedbackDefinitions/client/requests/FindFeedbackDefinitionsRequest.ts +0 -16
- package/src/opik/rest_api/api/resources/feedbackDefinitions/client/requests/index.ts +0 -1
- package/src/opik/rest_api/api/resources/feedbackDefinitions/index.ts +0 -2
- package/src/opik/rest_api/api/resources/feedbackDefinitions/types/FindFeedbackDefinitionsRequestType.ts +0 -10
- package/src/opik/rest_api/api/resources/feedbackDefinitions/types/index.ts +0 -1
- package/src/opik/rest_api/api/resources/index.ts +0 -23
- package/src/opik/rest_api/api/resources/llmProviderKey/client/Client.ts +0 -412
- package/src/opik/rest_api/api/resources/llmProviderKey/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/llmProviderKey/client/requests/ProviderApiKeyUpdate.ts +0 -13
- package/src/opik/rest_api/api/resources/llmProviderKey/client/requests/ProviderApiKeyWrite.ts +0 -13
- package/src/opik/rest_api/api/resources/llmProviderKey/client/requests/index.ts +0 -2
- package/src/opik/rest_api/api/resources/llmProviderKey/index.ts +0 -1
- package/src/opik/rest_api/api/resources/projects/client/Client.ts +0 -720
- package/src/opik/rest_api/api/resources/projects/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/projects/client/requests/FindProjectsRequest.ts +0 -14
- package/src/opik/rest_api/api/resources/projects/client/requests/ProjectMetricRequestPublic.ts +0 -16
- package/src/opik/rest_api/api/resources/projects/client/requests/ProjectRetrievePublic.ts +0 -13
- package/src/opik/rest_api/api/resources/projects/client/requests/ProjectUpdate.ts +0 -12
- package/src/opik/rest_api/api/resources/projects/client/requests/ProjectWrite.ts +0 -14
- package/src/opik/rest_api/api/resources/projects/client/requests/index.ts +0 -5
- package/src/opik/rest_api/api/resources/projects/index.ts +0 -2
- package/src/opik/rest_api/api/resources/projects/types/ProjectMetricRequestPublicInterval.ts +0 -11
- package/src/opik/rest_api/api/resources/projects/types/ProjectMetricRequestPublicMetricType.ts +0 -18
- package/src/opik/rest_api/api/resources/projects/types/index.ts +0 -2
- package/src/opik/rest_api/api/resources/prompts/client/Client.ts +0 -900
- package/src/opik/rest_api/api/resources/prompts/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/prompts/client/requests/CreatePromptVersionDetail.ts +0 -19
- package/src/opik/rest_api/api/resources/prompts/client/requests/GetPromptVersionsRequest.ts +0 -12
- package/src/opik/rest_api/api/resources/prompts/client/requests/GetPromptsRequest.ts +0 -13
- package/src/opik/rest_api/api/resources/prompts/client/requests/PromptUpdatable.ts +0 -14
- package/src/opik/rest_api/api/resources/prompts/client/requests/PromptVersionRetrieveDetail.ts +0 -14
- package/src/opik/rest_api/api/resources/prompts/client/requests/PromptWrite.ts +0 -16
- package/src/opik/rest_api/api/resources/prompts/client/requests/index.ts +0 -6
- package/src/opik/rest_api/api/resources/prompts/index.ts +0 -1
- package/src/opik/rest_api/api/resources/spans/client/Client.ts +0 -957
- package/src/opik/rest_api/api/resources/spans/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/spans/client/requests/FindFeedbackScoreNames1Request.ts +0 -14
- package/src/opik/rest_api/api/resources/spans/client/requests/GetSpanStatsRequest.ts +0 -17
- package/src/opik/rest_api/api/resources/spans/client/requests/GetSpansByProjectRequest.ts +0 -20
- package/src/opik/rest_api/api/resources/spans/client/requests/SpanBatchWrite.ts +0 -20
- package/src/opik/rest_api/api/resources/spans/client/requests/SpanUpdate.ts +0 -29
- package/src/opik/rest_api/api/resources/spans/client/requests/index.ts +0 -5
- package/src/opik/rest_api/api/resources/spans/index.ts +0 -2
- package/src/opik/rest_api/api/resources/spans/types/FindFeedbackScoreNames1RequestType.ts +0 -11
- package/src/opik/rest_api/api/resources/spans/types/GetSpanStatsRequestType.ts +0 -11
- package/src/opik/rest_api/api/resources/spans/types/GetSpansByProjectRequestType.ts +0 -11
- package/src/opik/rest_api/api/resources/spans/types/index.ts +0 -3
- package/src/opik/rest_api/api/resources/systemUsage/client/Client.ts +0 -347
- package/src/opik/rest_api/api/resources/systemUsage/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/systemUsage/index.ts +0 -1
- package/src/opik/rest_api/api/resources/traces/client/Client.ts +0 -990
- package/src/opik/rest_api/api/resources/traces/client/index.ts +0 -1
- package/src/opik/rest_api/api/resources/traces/client/requests/FindFeedbackScoreNames2Request.ts +0 -11
- package/src/opik/rest_api/api/resources/traces/client/requests/GetTraceStatsRequest.ts +0 -13
- package/src/opik/rest_api/api/resources/traces/client/requests/GetTracesByProjectRequest.ts +0 -16
- package/src/opik/rest_api/api/resources/traces/client/requests/TraceBatchWrite.ts +0 -18
- package/src/opik/rest_api/api/resources/traces/client/requests/TraceUpdate.ts +0 -22
- package/src/opik/rest_api/api/resources/traces/client/requests/index.ts +0 -5
- package/src/opik/rest_api/api/resources/traces/index.ts +0 -1
- package/src/opik/rest_api/api/types/AssistantMessage.ts +0 -14
- package/src/opik/rest_api/api/types/AssistantMessageRole.ts +0 -13
- package/src/opik/rest_api/api/types/AuthDetailsHolder.ts +0 -5
- package/src/opik/rest_api/api/types/AvgValueStatPublic.ts +0 -7
- package/src/opik/rest_api/api/types/BatchDelete.ts +0 -7
- package/src/opik/rest_api/api/types/BiInformation.ts +0 -9
- package/src/opik/rest_api/api/types/BiInformationResponse.ts +0 -9
- package/src/opik/rest_api/api/types/CategoricalFeedbackDefinition.ts +0 -13
- package/src/opik/rest_api/api/types/CategoricalFeedbackDefinitionCreate.ts +0 -9
- package/src/opik/rest_api/api/types/CategoricalFeedbackDefinitionPublic.ts +0 -13
- package/src/opik/rest_api/api/types/CategoricalFeedbackDefinitionUpdate.ts +0 -9
- package/src/opik/rest_api/api/types/CategoricalFeedbackDetail.ts +0 -7
- package/src/opik/rest_api/api/types/CategoricalFeedbackDetailCreate.ts +0 -7
- package/src/opik/rest_api/api/types/CategoricalFeedbackDetailPublic.ts +0 -7
- package/src/opik/rest_api/api/types/CategoricalFeedbackDetailUpdate.ts +0 -7
- package/src/opik/rest_api/api/types/ChatCompletionChoice.ts +0 -12
- package/src/opik/rest_api/api/types/ChatCompletionResponse.ts +0 -14
- package/src/opik/rest_api/api/types/ChunkedOutputJsonNode.ts +0 -10
- package/src/opik/rest_api/api/types/ChunkedOutputJsonNodeType.ts +0 -7
- package/src/opik/rest_api/api/types/Column.ts +0 -13
- package/src/opik/rest_api/api/types/ColumnCompare.ts +0 -13
- package/src/opik/rest_api/api/types/ColumnCompareTypesItem.ts +0 -14
- package/src/opik/rest_api/api/types/ColumnPublic.ts +0 -13
- package/src/opik/rest_api/api/types/ColumnPublicTypesItem.ts +0 -14
- package/src/opik/rest_api/api/types/ColumnTypesItem.ts +0 -14
- package/src/opik/rest_api/api/types/CompletionTokensDetails.ts +0 -7
- package/src/opik/rest_api/api/types/CountValueStatPublic.ts +0 -7
- package/src/opik/rest_api/api/types/DataPointNumberPublic.ts +0 -8
- package/src/opik/rest_api/api/types/Dataset.ts +0 -17
- package/src/opik/rest_api/api/types/DatasetItem.ts +0 -21
- package/src/opik/rest_api/api/types/DatasetItemBatch.ts +0 -13
- package/src/opik/rest_api/api/types/DatasetItemCompare.ts +0 -21
- package/src/opik/rest_api/api/types/DatasetItemCompareSource.ts +0 -12
- package/src/opik/rest_api/api/types/DatasetItemPageCompare.ts +0 -13
- package/src/opik/rest_api/api/types/DatasetItemPagePublic.ts +0 -13
- package/src/opik/rest_api/api/types/DatasetItemPublic.ts +0 -21
- package/src/opik/rest_api/api/types/DatasetItemPublicSource.ts +0 -12
- package/src/opik/rest_api/api/types/DatasetItemSource.ts +0 -12
- package/src/opik/rest_api/api/types/DatasetItemWrite.ts +0 -16
- package/src/opik/rest_api/api/types/DatasetItemWriteSource.ts +0 -12
- package/src/opik/rest_api/api/types/DatasetPagePublic.ts +0 -12
- package/src/opik/rest_api/api/types/DatasetPublic.ts +0 -17
- package/src/opik/rest_api/api/types/DeleteFeedbackScore.ts +0 -7
- package/src/opik/rest_api/api/types/Delta.ts +0 -12
- package/src/opik/rest_api/api/types/DeltaRole.ts +0 -13
- package/src/opik/rest_api/api/types/ErrorInfo.ts +0 -9
- package/src/opik/rest_api/api/types/ErrorInfoPublic.ts +0 -9
- package/src/opik/rest_api/api/types/ErrorInfoWrite.ts +0 -9
- package/src/opik/rest_api/api/types/ErrorMessage.ts +0 -9
- package/src/opik/rest_api/api/types/ErrorMessageDetail.ts +0 -9
- package/src/opik/rest_api/api/types/ErrorMessagePublic.ts +0 -7
- package/src/opik/rest_api/api/types/Experiment.ts +0 -20
- package/src/opik/rest_api/api/types/ExperimentItem.ts +0 -19
- package/src/opik/rest_api/api/types/ExperimentItemCompare.ts +0 -19
- package/src/opik/rest_api/api/types/ExperimentItemPublic.ts +0 -14
- package/src/opik/rest_api/api/types/ExperimentPagePublic.ts +0 -12
- package/src/opik/rest_api/api/types/ExperimentPublic.ts +0 -20
- package/src/opik/rest_api/api/types/Feedback.ts +0 -26
- package/src/opik/rest_api/api/types/FeedbackCreate.ts +0 -22
- package/src/opik/rest_api/api/types/FeedbackDefinitionPagePublic.ts +0 -12
- package/src/opik/rest_api/api/types/FeedbackObjectPublic.ts +0 -26
- package/src/opik/rest_api/api/types/FeedbackPublic.ts +0 -26
- package/src/opik/rest_api/api/types/FeedbackScore.ts +0 -17
- package/src/opik/rest_api/api/types/FeedbackScoreAverage.ts +0 -8
- package/src/opik/rest_api/api/types/FeedbackScoreAveragePublic.ts +0 -8
- package/src/opik/rest_api/api/types/FeedbackScoreBatch.ts +0 -9
- package/src/opik/rest_api/api/types/FeedbackScoreBatchItem.ts +0 -16
- package/src/opik/rest_api/api/types/FeedbackScoreBatchItemSource.ts +0 -10
- package/src/opik/rest_api/api/types/FeedbackScoreCompare.ts +0 -17
- package/src/opik/rest_api/api/types/FeedbackScoreCompareSource.ts +0 -10
- package/src/opik/rest_api/api/types/FeedbackScorePublic.ts +0 -17
- package/src/opik/rest_api/api/types/FeedbackScorePublicSource.ts +0 -10
- package/src/opik/rest_api/api/types/FeedbackScoreSource.ts +0 -10
- package/src/opik/rest_api/api/types/FeedbackUpdate.ts +0 -22
- package/src/opik/rest_api/api/types/Function.ts +0 -12
- package/src/opik/rest_api/api/types/FunctionCall.ts +0 -8
- package/src/opik/rest_api/api/types/JsonNode.ts +0 -5
- package/src/opik/rest_api/api/types/JsonNodeCompare.ts +0 -5
- package/src/opik/rest_api/api/types/JsonNodePublic.ts +0 -5
- package/src/opik/rest_api/api/types/JsonNodeWrite.ts +0 -5
- package/src/opik/rest_api/api/types/JsonObjectSchema.ts +0 -14
- package/src/opik/rest_api/api/types/JsonSchema.ts +0 -11
- package/src/opik/rest_api/api/types/JsonSchemaElement.ts +0 -7
- package/src/opik/rest_api/api/types/Message.ts +0 -5
- package/src/opik/rest_api/api/types/NumericalFeedbackDefinition.ts +0 -13
- package/src/opik/rest_api/api/types/NumericalFeedbackDefinitionCreate.ts +0 -9
- package/src/opik/rest_api/api/types/NumericalFeedbackDefinitionPublic.ts +0 -13
- package/src/opik/rest_api/api/types/NumericalFeedbackDefinitionUpdate.ts +0 -9
- package/src/opik/rest_api/api/types/NumericalFeedbackDetail.ts +0 -8
- package/src/opik/rest_api/api/types/NumericalFeedbackDetailCreate.ts +0 -8
- package/src/opik/rest_api/api/types/NumericalFeedbackDetailPublic.ts +0 -8
- package/src/opik/rest_api/api/types/NumericalFeedbackDetailUpdate.ts +0 -8
- package/src/opik/rest_api/api/types/PageColumns.ts +0 -9
- package/src/opik/rest_api/api/types/PercentageValueStatPublic.ts +0 -9
- package/src/opik/rest_api/api/types/PercentageValuesPublic.ts +0 -9
- package/src/opik/rest_api/api/types/Project.ts +0 -14
- package/src/opik/rest_api/api/types/ProjectMetricResponsePublic.ts +0 -12
- package/src/opik/rest_api/api/types/ProjectMetricResponsePublicInterval.ts +0 -11
- package/src/opik/rest_api/api/types/ProjectMetricResponsePublicMetricType.ts +0 -18
- package/src/opik/rest_api/api/types/ProjectPagePublic.ts +0 -13
- package/src/opik/rest_api/api/types/ProjectPublic.ts +0 -14
- package/src/opik/rest_api/api/types/ProjectStatItemObjectPublic.ts +0 -28
- package/src/opik/rest_api/api/types/ProjectStatsPublic.ts +0 -9
- package/src/opik/rest_api/api/types/Prompt.ts +0 -18
- package/src/opik/rest_api/api/types/PromptDetail.ts +0 -17
- package/src/opik/rest_api/api/types/PromptPagePublic.ts +0 -12
- package/src/opik/rest_api/api/types/PromptPublic.ts +0 -14
- package/src/opik/rest_api/api/types/PromptVersion.ts +0 -15
- package/src/opik/rest_api/api/types/PromptVersionDetail.ts +0 -15
- package/src/opik/rest_api/api/types/PromptVersionLink.ts +0 -9
- package/src/opik/rest_api/api/types/PromptVersionLinkPublic.ts +0 -9
- package/src/opik/rest_api/api/types/PromptVersionLinkWrite.ts +0 -7
- package/src/opik/rest_api/api/types/PromptVersionPagePublic.ts +0 -12
- package/src/opik/rest_api/api/types/PromptVersionPublic.ts +0 -14
- package/src/opik/rest_api/api/types/ProviderApiKey.ts +0 -13
- package/src/opik/rest_api/api/types/ProviderApiKeyPublic.ts +0 -12
- package/src/opik/rest_api/api/types/ResponseFormat.ts +0 -10
- package/src/opik/rest_api/api/types/ResponseFormatType.ts +0 -11
- package/src/opik/rest_api/api/types/ResultsNumberPublic.ts +0 -10
- package/src/opik/rest_api/api/types/Span.ts +0 -32
- package/src/opik/rest_api/api/types/SpanBatch.ts +0 -9
- package/src/opik/rest_api/api/types/SpanPagePublic.ts +0 -12
- package/src/opik/rest_api/api/types/SpanPublic.ts +0 -30
- package/src/opik/rest_api/api/types/SpanPublicType.ts +0 -11
- package/src/opik/rest_api/api/types/SpanType.ts +0 -11
- package/src/opik/rest_api/api/types/SpanWrite.ts +0 -25
- package/src/opik/rest_api/api/types/SpanWriteType.ts +0 -11
- package/src/opik/rest_api/api/types/StreamOptions.ts +0 -7
- package/src/opik/rest_api/api/types/Tool.ts +0 -10
- package/src/opik/rest_api/api/types/ToolCall.ts +0 -12
- package/src/opik/rest_api/api/types/Trace.ts +0 -27
- package/src/opik/rest_api/api/types/TraceBatch.ts +0 -9
- package/src/opik/rest_api/api/types/TraceCountResponse.ts +0 -9
- package/src/opik/rest_api/api/types/TracePagePublic.ts +0 -12
- package/src/opik/rest_api/api/types/TracePublic.ts +0 -25
- package/src/opik/rest_api/api/types/TraceWrite.ts +0 -19
- package/src/opik/rest_api/api/types/Usage.ts +0 -12
- package/src/opik/rest_api/api/types/WorkspaceTraceCount.ts +0 -8
- package/src/opik/rest_api/api/types/index.ts +0 -138
- package/src/opik/rest_api/core/api-promise/APIPromise.ts +0 -54
- package/src/opik/rest_api/core/api-promise/index.ts +0 -1
- package/src/opik/rest_api/core/fetcher/APIResponse.ts +0 -12
- package/src/opik/rest_api/core/fetcher/Fetcher.ts +0 -143
- package/src/opik/rest_api/core/fetcher/Supplier.ts +0 -11
- package/src/opik/rest_api/core/fetcher/createRequestUrl.ts +0 -10
- package/src/opik/rest_api/core/fetcher/getFetchFn.ts +0 -25
- package/src/opik/rest_api/core/fetcher/getHeader.ts +0 -8
- package/src/opik/rest_api/core/fetcher/getRequestBody.ts +0 -14
- package/src/opik/rest_api/core/fetcher/getResponseBody.ts +0 -34
- package/src/opik/rest_api/core/fetcher/index.ts +0 -5
- package/src/opik/rest_api/core/fetcher/makeRequest.ts +0 -44
- package/src/opik/rest_api/core/fetcher/requestWithRetries.ts +0 -33
- package/src/opik/rest_api/core/fetcher/signals.ts +0 -38
- package/src/opik/rest_api/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +0 -256
- package/src/opik/rest_api/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +0 -106
- package/src/opik/rest_api/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +0 -243
- package/src/opik/rest_api/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +0 -33
- package/src/opik/rest_api/core/index.ts +0 -4
- package/src/opik/rest_api/core/runtime/index.ts +0 -1
- package/src/opik/rest_api/core/runtime/runtime.ts +0 -126
- package/src/opik/rest_api/core/schemas/Schema.ts +0 -99
- package/src/opik/rest_api/core/schemas/builders/bigint/bigint.ts +0 -50
- package/src/opik/rest_api/core/schemas/builders/bigint/index.ts +0 -1
- package/src/opik/rest_api/core/schemas/builders/date/date.ts +0 -65
- package/src/opik/rest_api/core/schemas/builders/date/index.ts +0 -1
- package/src/opik/rest_api/core/schemas/builders/enum/enum.ts +0 -43
- package/src/opik/rest_api/core/schemas/builders/enum/index.ts +0 -1
- package/src/opik/rest_api/core/schemas/builders/index.ts +0 -14
- package/src/opik/rest_api/core/schemas/builders/lazy/index.ts +0 -3
- package/src/opik/rest_api/core/schemas/builders/lazy/lazy.ts +0 -32
- package/src/opik/rest_api/core/schemas/builders/lazy/lazyObject.ts +0 -20
- package/src/opik/rest_api/core/schemas/builders/list/index.ts +0 -1
- package/src/opik/rest_api/core/schemas/builders/list/list.ts +0 -73
- package/src/opik/rest_api/core/schemas/builders/literals/booleanLiteral.ts +0 -29
- package/src/opik/rest_api/core/schemas/builders/literals/index.ts +0 -2
- package/src/opik/rest_api/core/schemas/builders/literals/stringLiteral.ts +0 -29
- package/src/opik/rest_api/core/schemas/builders/object/index.ts +0 -22
- package/src/opik/rest_api/core/schemas/builders/object/object.ts +0 -324
- package/src/opik/rest_api/core/schemas/builders/object/objectWithoutOptionalProperties.ts +0 -18
- package/src/opik/rest_api/core/schemas/builders/object/property.ts +0 -23
- package/src/opik/rest_api/core/schemas/builders/object/types.ts +0 -72
- package/src/opik/rest_api/core/schemas/builders/object-like/getObjectLikeUtils.ts +0 -79
- package/src/opik/rest_api/core/schemas/builders/object-like/index.ts +0 -2
- package/src/opik/rest_api/core/schemas/builders/object-like/types.ts +0 -11
- package/src/opik/rest_api/core/schemas/builders/primitives/any.ts +0 -4
- package/src/opik/rest_api/core/schemas/builders/primitives/boolean.ts +0 -25
- package/src/opik/rest_api/core/schemas/builders/primitives/index.ts +0 -5
- package/src/opik/rest_api/core/schemas/builders/primitives/number.ts +0 -25
- package/src/opik/rest_api/core/schemas/builders/primitives/string.ts +0 -25
- package/src/opik/rest_api/core/schemas/builders/primitives/unknown.ts +0 -4
- package/src/opik/rest_api/core/schemas/builders/record/index.ts +0 -2
- package/src/opik/rest_api/core/schemas/builders/record/record.ts +0 -130
- package/src/opik/rest_api/core/schemas/builders/record/types.ts +0 -17
- package/src/opik/rest_api/core/schemas/builders/schema-utils/JsonError.ts +0 -9
- package/src/opik/rest_api/core/schemas/builders/schema-utils/ParseError.ts +0 -9
- package/src/opik/rest_api/core/schemas/builders/schema-utils/getSchemaUtils.ts +0 -105
- package/src/opik/rest_api/core/schemas/builders/schema-utils/index.ts +0 -4
- package/src/opik/rest_api/core/schemas/builders/schema-utils/stringifyValidationErrors.ts +0 -8
- package/src/opik/rest_api/core/schemas/builders/set/index.ts +0 -1
- package/src/opik/rest_api/core/schemas/builders/set/set.ts +0 -43
- package/src/opik/rest_api/core/schemas/builders/undiscriminated-union/index.ts +0 -6
- package/src/opik/rest_api/core/schemas/builders/undiscriminated-union/types.ts +0 -10
- package/src/opik/rest_api/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts +0 -60
- package/src/opik/rest_api/core/schemas/builders/union/discriminant.ts +0 -14
- package/src/opik/rest_api/core/schemas/builders/union/index.ts +0 -10
- package/src/opik/rest_api/core/schemas/builders/union/types.ts +0 -26
- package/src/opik/rest_api/core/schemas/builders/union/union.ts +0 -170
- package/src/opik/rest_api/core/schemas/index.ts +0 -2
- package/src/opik/rest_api/core/schemas/utils/MaybePromise.ts +0 -1
- package/src/opik/rest_api/core/schemas/utils/addQuestionMarksToNullableProperties.ts +0 -15
- package/src/opik/rest_api/core/schemas/utils/createIdentitySchemaCreator.ts +0 -21
- package/src/opik/rest_api/core/schemas/utils/entries.ts +0 -3
- package/src/opik/rest_api/core/schemas/utils/filterObject.ts +0 -10
- package/src/opik/rest_api/core/schemas/utils/getErrorMessageForIncorrectType.ts +0 -25
- package/src/opik/rest_api/core/schemas/utils/isPlainObject.ts +0 -17
- package/src/opik/rest_api/core/schemas/utils/keys.ts +0 -3
- package/src/opik/rest_api/core/schemas/utils/maybeSkipValidation.ts +0 -38
- package/src/opik/rest_api/core/schemas/utils/partition.ts +0 -12
- package/src/opik/rest_api/environments.ts +0 -9
- package/src/opik/rest_api/errors/OpikApiError.ts +0 -45
- package/src/opik/rest_api/errors/OpikApiTimeoutError.ts +0 -10
- package/src/opik/rest_api/errors/index.ts +0 -2
- package/src/opik/rest_api/index.ts +0 -4
- package/src/opik/rest_api/serialization/index.ts +0 -2
- package/src/opik/rest_api/serialization/resources/chatCompletions/client/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/chatCompletions/client/requests/ChatCompletionRequest.ts +0 -72
- package/src/opik/rest_api/serialization/resources/chatCompletions/client/requests/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/chatCompletions/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/datasets/client/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetIdentifier.ts +0 -20
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetIdentifierPublic.ts +0 -20
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetItemBatchWrite.ts +0 -25
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetItemStreamRequest.ts +0 -24
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetItemsDelete.ts +0 -20
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetUpdate.ts +0 -20
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetWrite.ts +0 -22
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/index.ts +0 -7
- package/src/opik/rest_api/serialization/resources/datasets/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/experiments/client/findFeedbackScoreNames.ts +0 -15
- package/src/opik/rest_api/serialization/resources/experiments/client/index.ts +0 -2
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentItemStreamRequest.ts +0 -24
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentItemsBatch.ts +0 -21
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentItemsDelete.ts +0 -20
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentWrite.ts +0 -28
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentsDelete.ts +0 -20
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/IdentifierPublic.ts +0 -18
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/index.ts +0 -6
- package/src/opik/rest_api/serialization/resources/experiments/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/feedbackDefinitions/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/feedbackDefinitions/types/FindFeedbackDefinitionsRequestType.ts +0 -16
- package/src/opik/rest_api/serialization/resources/feedbackDefinitions/types/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/index.ts +0 -20
- package/src/opik/rest_api/serialization/resources/llmProviderKey/client/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/llmProviderKey/client/requests/ProviderApiKeyUpdate.ts +0 -20
- package/src/opik/rest_api/serialization/resources/llmProviderKey/client/requests/ProviderApiKeyWrite.ts +0 -20
- package/src/opik/rest_api/serialization/resources/llmProviderKey/client/requests/index.ts +0 -2
- package/src/opik/rest_api/serialization/resources/llmProviderKey/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/projects/client/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectMetricRequestPublic.ts +0 -28
- package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectRetrievePublic.ts +0 -20
- package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectUpdate.ts +0 -20
- package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectWrite.ts +0 -20
- package/src/opik/rest_api/serialization/resources/projects/client/requests/index.ts +0 -4
- package/src/opik/rest_api/serialization/resources/projects/index.ts +0 -2
- package/src/opik/rest_api/serialization/resources/projects/types/ProjectMetricRequestPublicInterval.ts +0 -16
- package/src/opik/rest_api/serialization/resources/projects/types/ProjectMetricRequestPublicMetricType.ts +0 -16
- package/src/opik/rest_api/serialization/resources/projects/types/index.ts +0 -2
- package/src/opik/rest_api/serialization/resources/prompts/client/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/prompts/client/requests/CreatePromptVersionDetail.ts +0 -23
- package/src/opik/rest_api/serialization/resources/prompts/client/requests/PromptUpdatable.ts +0 -20
- package/src/opik/rest_api/serialization/resources/prompts/client/requests/PromptVersionRetrieveDetail.ts +0 -22
- package/src/opik/rest_api/serialization/resources/prompts/client/requests/PromptWrite.ts +0 -24
- package/src/opik/rest_api/serialization/resources/prompts/client/requests/index.ts +0 -4
- package/src/opik/rest_api/serialization/resources/prompts/index.ts +0 -1
- package/src/opik/rest_api/serialization/resources/spans/client/findFeedbackScoreNames1.ts +0 -13
- package/src/opik/rest_api/serialization/resources/spans/client/index.ts +0 -2
- package/src/opik/rest_api/serialization/resources/spans/client/requests/SpanBatchWrite.ts +0 -19
- package/src/opik/rest_api/serialization/resources/spans/client/requests/SpanUpdate.ts +0 -44
- package/src/opik/rest_api/serialization/resources/spans/client/requests/index.ts +0 -2
- package/src/opik/rest_api/serialization/resources/spans/index.ts +0 -2
- package/src/opik/rest_api/serialization/resources/spans/types/FindFeedbackScoreNames1RequestType.ts +0 -16
- package/src/opik/rest_api/serialization/resources/spans/types/GetSpanStatsRequestType.ts +0 -16
- package/src/opik/rest_api/serialization/resources/spans/types/GetSpansByProjectRequestType.ts +0 -16
- package/src/opik/rest_api/serialization/resources/spans/types/index.ts +0 -3
- package/src/opik/rest_api/serialization/resources/traces/client/findFeedbackScoreNames2.ts +0 -13
- package/src/opik/rest_api/serialization/resources/traces/client/index.ts +0 -2
- package/src/opik/rest_api/serialization/resources/traces/client/requests/TraceBatchWrite.ts +0 -19
- package/src/opik/rest_api/serialization/resources/traces/client/requests/TraceUpdate.ts +0 -34
- package/src/opik/rest_api/serialization/resources/traces/client/requests/index.ts +0 -2
- package/src/opik/rest_api/serialization/resources/traces/index.ts +0 -1
- package/src/opik/rest_api/serialization/types/AssistantMessage.ts +0 -33
- package/src/opik/rest_api/serialization/types/AssistantMessageRole.ts +0 -16
- package/src/opik/rest_api/serialization/types/AuthDetailsHolder.ts +0 -16
- package/src/opik/rest_api/serialization/types/AvgValueStatPublic.ts +0 -20
- package/src/opik/rest_api/serialization/types/BatchDelete.ts +0 -18
- package/src/opik/rest_api/serialization/types/BiInformation.ts +0 -22
- package/src/opik/rest_api/serialization/types/BiInformationResponse.ts +0 -21
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinition.ts +0 -29
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinitionCreate.ts +0 -21
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinitionPublic.ts +0 -29
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinitionUpdate.ts +0 -21
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetail.ts +0 -20
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetailCreate.ts +0 -20
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetailPublic.ts +0 -20
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetailUpdate.ts +0 -20
- package/src/opik/rest_api/serialization/types/ChatCompletionChoice.ts +0 -28
- package/src/opik/rest_api/serialization/types/ChatCompletionResponse.ts +0 -32
- package/src/opik/rest_api/serialization/types/ChunkedOutputJsonNode.ts +0 -23
- package/src/opik/rest_api/serialization/types/ChunkedOutputJsonNodeType.ts +0 -20
- package/src/opik/rest_api/serialization/types/Column.ts +0 -25
- package/src/opik/rest_api/serialization/types/ColumnCompare.ts +0 -25
- package/src/opik/rest_api/serialization/types/ColumnCompareTypesItem.ts +0 -16
- package/src/opik/rest_api/serialization/types/ColumnPublic.ts +0 -25
- package/src/opik/rest_api/serialization/types/ColumnPublicTypesItem.ts +0 -16
- package/src/opik/rest_api/serialization/types/ColumnTypesItem.ts +0 -14
- package/src/opik/rest_api/serialization/types/CompletionTokensDetails.ts +0 -20
- package/src/opik/rest_api/serialization/types/CountValueStatPublic.ts +0 -20
- package/src/opik/rest_api/serialization/types/DataPointNumberPublic.ts +0 -22
- package/src/opik/rest_api/serialization/types/Dataset.ts +0 -44
- package/src/opik/rest_api/serialization/types/DatasetItem.ts +0 -48
- package/src/opik/rest_api/serialization/types/DatasetItemBatch.ts +0 -25
- package/src/opik/rest_api/serialization/types/DatasetItemCompare.ts +0 -51
- package/src/opik/rest_api/serialization/types/DatasetItemCompareSource.ts +0 -16
- package/src/opik/rest_api/serialization/types/DatasetItemPageCompare.ts +0 -30
- package/src/opik/rest_api/serialization/types/DatasetItemPagePublic.ts +0 -30
- package/src/opik/rest_api/serialization/types/DatasetItemPublic.ts +0 -51
- package/src/opik/rest_api/serialization/types/DatasetItemPublicSource.ts +0 -16
- package/src/opik/rest_api/serialization/types/DatasetItemSource.ts +0 -16
- package/src/opik/rest_api/serialization/types/DatasetItemWrite.ts +0 -37
- package/src/opik/rest_api/serialization/types/DatasetItemWriteSource.ts +0 -16
- package/src/opik/rest_api/serialization/types/DatasetPagePublic.ts +0 -27
- package/src/opik/rest_api/serialization/types/DatasetPublic.ts +0 -44
- package/src/opik/rest_api/serialization/types/DeleteFeedbackScore.ts +0 -20
- package/src/opik/rest_api/serialization/types/Delta.ts +0 -26
- package/src/opik/rest_api/serialization/types/DeltaRole.ts +0 -14
- package/src/opik/rest_api/serialization/types/ErrorInfo.ts +0 -22
- package/src/opik/rest_api/serialization/types/ErrorInfoPublic.ts +0 -24
- package/src/opik/rest_api/serialization/types/ErrorInfoWrite.ts +0 -22
- package/src/opik/rest_api/serialization/types/ErrorMessage.ts +0 -22
- package/src/opik/rest_api/serialization/types/ErrorMessageDetail.ts +0 -24
- package/src/opik/rest_api/serialization/types/ErrorMessagePublic.ts +0 -20
- package/src/opik/rest_api/serialization/types/Experiment.ts +0 -46
- package/src/opik/rest_api/serialization/types/ExperimentItem.ts +0 -43
- package/src/opik/rest_api/serialization/types/ExperimentItemCompare.ts +0 -45
- package/src/opik/rest_api/serialization/types/ExperimentItemPublic.ts +0 -34
- package/src/opik/rest_api/serialization/types/ExperimentPagePublic.ts +0 -27
- package/src/opik/rest_api/serialization/types/ExperimentPublic.ts +0 -48
- package/src/opik/rest_api/serialization/types/Feedback.ts +0 -48
- package/src/opik/rest_api/serialization/types/FeedbackCreate.ts +0 -41
- package/src/opik/rest_api/serialization/types/FeedbackDefinitionPagePublic.ts +0 -27
- package/src/opik/rest_api/serialization/types/FeedbackObjectPublic.ts +0 -51
- package/src/opik/rest_api/serialization/types/FeedbackPublic.ts +0 -49
- package/src/opik/rest_api/serialization/types/FeedbackScore.ts +0 -35
- package/src/opik/rest_api/serialization/types/FeedbackScoreAverage.ts +0 -22
- package/src/opik/rest_api/serialization/types/FeedbackScoreAveragePublic.ts +0 -22
- package/src/opik/rest_api/serialization/types/FeedbackScoreBatch.ts +0 -21
- package/src/opik/rest_api/serialization/types/FeedbackScoreBatchItem.ts +0 -33
- package/src/opik/rest_api/serialization/types/FeedbackScoreBatchItemSource.ts +0 -16
- package/src/opik/rest_api/serialization/types/FeedbackScoreCompare.ts +0 -37
- package/src/opik/rest_api/serialization/types/FeedbackScoreCompareSource.ts +0 -16
- package/src/opik/rest_api/serialization/types/FeedbackScorePublic.ts +0 -37
- package/src/opik/rest_api/serialization/types/FeedbackScorePublicSource.ts +0 -16
- package/src/opik/rest_api/serialization/types/FeedbackScoreSource.ts +0 -16
- package/src/opik/rest_api/serialization/types/FeedbackUpdate.ts +0 -41
- package/src/opik/rest_api/serialization/types/Function.ts +0 -25
- package/src/opik/rest_api/serialization/types/FunctionCall.ts +0 -20
- package/src/opik/rest_api/serialization/types/JsonNode.ts +0 -14
- package/src/opik/rest_api/serialization/types/JsonNodeCompare.ts +0 -14
- package/src/opik/rest_api/serialization/types/JsonNodePublic.ts +0 -14
- package/src/opik/rest_api/serialization/types/JsonNodeWrite.ts +0 -14
- package/src/opik/rest_api/serialization/types/JsonObjectSchema.ts +0 -34
- package/src/opik/rest_api/serialization/types/JsonSchema.ts +0 -23
- package/src/opik/rest_api/serialization/types/JsonSchemaElement.ts +0 -20
- package/src/opik/rest_api/serialization/types/Message.ts +0 -16
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinition.ts +0 -29
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinitionCreate.ts +0 -21
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinitionPublic.ts +0 -29
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinitionUpdate.ts +0 -21
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDetail.ts +0 -22
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDetailCreate.ts +0 -22
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDetailPublic.ts +0 -22
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDetailUpdate.ts +0 -22
- package/src/opik/rest_api/serialization/types/PageColumns.ts +0 -19
- package/src/opik/rest_api/serialization/types/PercentageValueStatPublic.ts +0 -21
- package/src/opik/rest_api/serialization/types/PercentageValuesPublic.ts +0 -24
- package/src/opik/rest_api/serialization/types/Project.ts +0 -32
- package/src/opik/rest_api/serialization/types/ProjectMetricResponsePublic.ts +0 -29
- package/src/opik/rest_api/serialization/types/ProjectMetricResponsePublicInterval.ts +0 -16
- package/src/opik/rest_api/serialization/types/ProjectMetricResponsePublicMetricType.ts +0 -16
- package/src/opik/rest_api/serialization/types/ProjectPagePublic.ts +0 -29
- package/src/opik/rest_api/serialization/types/ProjectPublic.ts +0 -32
- package/src/opik/rest_api/serialization/types/ProjectStatItemObjectPublic.ts +0 -50
- package/src/opik/rest_api/serialization/types/ProjectStatsPublic.ts +0 -21
- package/src/opik/rest_api/serialization/types/Prompt.ts +0 -37
- package/src/opik/rest_api/serialization/types/PromptDetail.ts +0 -35
- package/src/opik/rest_api/serialization/types/PromptPagePublic.ts +0 -27
- package/src/opik/rest_api/serialization/types/PromptPublic.ts +0 -32
- package/src/opik/rest_api/serialization/types/PromptVersion.ts +0 -30
- package/src/opik/rest_api/serialization/types/PromptVersionDetail.ts +0 -32
- package/src/opik/rest_api/serialization/types/PromptVersionLink.ts +0 -24
- package/src/opik/rest_api/serialization/types/PromptVersionLinkPublic.ts +0 -24
- package/src/opik/rest_api/serialization/types/PromptVersionLinkWrite.ts +0 -20
- package/src/opik/rest_api/serialization/types/PromptVersionPagePublic.ts +0 -27
- package/src/opik/rest_api/serialization/types/PromptVersionPublic.ts +0 -30
- package/src/opik/rest_api/serialization/types/ProviderApiKey.ts +0 -30
- package/src/opik/rest_api/serialization/types/ProviderApiKeyPublic.ts +0 -30
- package/src/opik/rest_api/serialization/types/ResponseFormat.ts +0 -22
- package/src/opik/rest_api/serialization/types/ResponseFormatType.ts +0 -16
- package/src/opik/rest_api/serialization/types/ResultsNumberPublic.ts +0 -23
- package/src/opik/rest_api/serialization/types/Span.ts +0 -65
- package/src/opik/rest_api/serialization/types/SpanBatch.ts +0 -19
- package/src/opik/rest_api/serialization/types/SpanPagePublic.ts +0 -25
- package/src/opik/rest_api/serialization/types/SpanPublic.ts +0 -67
- package/src/opik/rest_api/serialization/types/SpanPublicType.ts +0 -14
- package/src/opik/rest_api/serialization/types/SpanType.ts +0 -15
- package/src/opik/rest_api/serialization/types/SpanWrite.ts +0 -51
- package/src/opik/rest_api/serialization/types/SpanWriteType.ts +0 -14
- package/src/opik/rest_api/serialization/types/StreamOptions.ts +0 -18
- package/src/opik/rest_api/serialization/types/Tool.ts +0 -20
- package/src/opik/rest_api/serialization/types/ToolCall.ts +0 -25
- package/src/opik/rest_api/serialization/types/Trace.ts +0 -54
- package/src/opik/rest_api/serialization/types/TraceBatch.ts +0 -19
- package/src/opik/rest_api/serialization/types/TraceCountResponse.ts +0 -24
- package/src/opik/rest_api/serialization/types/TracePagePublic.ts +0 -27
- package/src/opik/rest_api/serialization/types/TracePublic.ts +0 -56
- package/src/opik/rest_api/serialization/types/TraceWrite.ts +0 -38
- package/src/opik/rest_api/serialization/types/Usage.ts +0 -27
- package/src/opik/rest_api/serialization/types/WorkspaceTraceCount.ts +0 -22
- package/src/opik/rest_api/serialization/types/index.ts +0 -138
- package/src/opik/tracer/Span.ts +0 -34
- package/src/opik/tracer/Trace.ts +0 -61
- package/tests/client.test.ts +0 -25
- package/tsconfig.json +0 -25
- package/tsup.config.ts +0 -11
- 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 +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,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]>;
|
package/src/opik/rest_api/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts
DELETED
|
@@ -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 +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>>;
|