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,126 +0,0 @@
|
|
|
1
|
-
interface DenoGlobal {
|
|
2
|
-
version: {
|
|
3
|
-
deno: string;
|
|
4
|
-
};
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
interface BunGlobal {
|
|
8
|
-
version: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare const Deno: DenoGlobal;
|
|
12
|
-
declare const Bun: BunGlobal;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
16
|
-
*/
|
|
17
|
-
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* A constant that indicates whether the environment the code is running is a Web Worker.
|
|
21
|
-
*/
|
|
22
|
-
const isWebWorker =
|
|
23
|
-
typeof self === "object" &&
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
typeof self?.importScripts === "function" &&
|
|
26
|
-
(self.constructor?.name === "DedicatedWorkerGlobalScope" ||
|
|
27
|
-
self.constructor?.name === "ServiceWorkerGlobalScope" ||
|
|
28
|
-
self.constructor?.name === "SharedWorkerGlobalScope");
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* A constant that indicates whether the environment the code is running is Deno.
|
|
32
|
-
*/
|
|
33
|
-
const isDeno =
|
|
34
|
-
typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* A constant that indicates whether the environment the code is running is Bun.sh.
|
|
38
|
-
*/
|
|
39
|
-
const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* A constant that indicates whether the environment the code is running is Node.JS.
|
|
43
|
-
*/
|
|
44
|
-
const isNode =
|
|
45
|
-
typeof process !== "undefined" &&
|
|
46
|
-
Boolean(process.version) &&
|
|
47
|
-
Boolean(process.versions?.node) &&
|
|
48
|
-
// Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions
|
|
49
|
-
!isDeno &&
|
|
50
|
-
!isBun;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* A constant that indicates whether the environment the code is running is in React-Native.
|
|
54
|
-
* https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
|
|
55
|
-
*/
|
|
56
|
-
const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative";
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* A constant that indicates whether the environment the code is running is Cloudflare.
|
|
60
|
-
* https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent
|
|
61
|
-
*/
|
|
62
|
-
const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator?.userAgent === "Cloudflare-Workers";
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* A constant that indicates which environment and version the SDK is running in.
|
|
66
|
-
*/
|
|
67
|
-
export const RUNTIME: Runtime = evaluateRuntime();
|
|
68
|
-
|
|
69
|
-
export interface Runtime {
|
|
70
|
-
type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd";
|
|
71
|
-
version?: string;
|
|
72
|
-
parsedVersion?: number;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function evaluateRuntime(): Runtime {
|
|
76
|
-
if (isBrowser) {
|
|
77
|
-
return {
|
|
78
|
-
type: "browser",
|
|
79
|
-
version: window.navigator.userAgent,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (isCloudflare) {
|
|
84
|
-
return {
|
|
85
|
-
type: "workerd",
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (isWebWorker) {
|
|
90
|
-
return {
|
|
91
|
-
type: "web-worker",
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (isDeno) {
|
|
96
|
-
return {
|
|
97
|
-
type: "deno",
|
|
98
|
-
version: Deno.version.deno,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (isBun) {
|
|
103
|
-
return {
|
|
104
|
-
type: "bun",
|
|
105
|
-
version: Bun.version,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (isNode) {
|
|
110
|
-
return {
|
|
111
|
-
type: "node",
|
|
112
|
-
version: process.versions.node,
|
|
113
|
-
parsedVersion: Number(process.versions.node.split(".")[0]),
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (isReactNative) {
|
|
118
|
-
return {
|
|
119
|
-
type: "react-native",
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return {
|
|
124
|
-
type: "unknown",
|
|
125
|
-
};
|
|
126
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { SchemaUtils } from "./builders";
|
|
2
|
-
|
|
3
|
-
export type Schema<Raw = unknown, Parsed = unknown> = BaseSchema<Raw, Parsed> & SchemaUtils<Raw, Parsed>;
|
|
4
|
-
|
|
5
|
-
export type inferRaw<S extends Schema> = S extends Schema<infer Raw, any> ? Raw : never;
|
|
6
|
-
export type inferParsed<S extends Schema> = S extends Schema<any, infer Parsed> ? Parsed : never;
|
|
7
|
-
|
|
8
|
-
export interface BaseSchema<Raw, Parsed> {
|
|
9
|
-
parse: (raw: unknown, opts?: SchemaOptions) => MaybeValid<Parsed>;
|
|
10
|
-
json: (parsed: unknown, opts?: SchemaOptions) => MaybeValid<Raw>;
|
|
11
|
-
getType: () => SchemaType | SchemaType;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const SchemaType = {
|
|
15
|
-
BIGINT: "bigint",
|
|
16
|
-
DATE: "date",
|
|
17
|
-
ENUM: "enum",
|
|
18
|
-
LIST: "list",
|
|
19
|
-
STRING_LITERAL: "stringLiteral",
|
|
20
|
-
BOOLEAN_LITERAL: "booleanLiteral",
|
|
21
|
-
OBJECT: "object",
|
|
22
|
-
ANY: "any",
|
|
23
|
-
BOOLEAN: "boolean",
|
|
24
|
-
NUMBER: "number",
|
|
25
|
-
STRING: "string",
|
|
26
|
-
UNKNOWN: "unknown",
|
|
27
|
-
RECORD: "record",
|
|
28
|
-
SET: "set",
|
|
29
|
-
UNION: "union",
|
|
30
|
-
UNDISCRIMINATED_UNION: "undiscriminatedUnion",
|
|
31
|
-
OPTIONAL: "optional",
|
|
32
|
-
} as const;
|
|
33
|
-
export type SchemaType = typeof SchemaType[keyof typeof SchemaType];
|
|
34
|
-
|
|
35
|
-
export type MaybeValid<T> = Valid<T> | Invalid;
|
|
36
|
-
|
|
37
|
-
export interface Valid<T> {
|
|
38
|
-
ok: true;
|
|
39
|
-
value: T;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface Invalid {
|
|
43
|
-
ok: false;
|
|
44
|
-
errors: ValidationError[];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ValidationError {
|
|
48
|
-
path: string[];
|
|
49
|
-
message: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface SchemaOptions {
|
|
53
|
-
/**
|
|
54
|
-
* how to handle unrecognized keys in objects
|
|
55
|
-
*
|
|
56
|
-
* @default "fail"
|
|
57
|
-
*/
|
|
58
|
-
unrecognizedObjectKeys?: "fail" | "passthrough" | "strip";
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* whether to fail when an unrecognized discriminant value is
|
|
62
|
-
* encountered in a union
|
|
63
|
-
*
|
|
64
|
-
* @default false
|
|
65
|
-
*/
|
|
66
|
-
allowUnrecognizedUnionMembers?: boolean;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* whether to fail when an unrecognized enum value is encountered
|
|
70
|
-
*
|
|
71
|
-
* @default false
|
|
72
|
-
*/
|
|
73
|
-
allowUnrecognizedEnumValues?: boolean;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* whether to allow data that doesn't conform to the schema.
|
|
77
|
-
* invalid data is passed through without transformation.
|
|
78
|
-
*
|
|
79
|
-
* when this is enabled, .parse() and .json() will always
|
|
80
|
-
* return `ok: true`. `.parseOrThrow()` and `.jsonOrThrow()`
|
|
81
|
-
* will never fail.
|
|
82
|
-
*
|
|
83
|
-
* @default false
|
|
84
|
-
*/
|
|
85
|
-
skipValidation?: boolean;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* each validation failure contains a "path" property, which is
|
|
89
|
-
* the breadcrumbs to the offending node in the JSON. you can supply
|
|
90
|
-
* a prefix that is prepended to all the errors' paths. this can be
|
|
91
|
-
* helpful for zurg's internal debug logging.
|
|
92
|
-
*/
|
|
93
|
-
breadcrumbsPrefix?: string[];
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* whether to send 'null' for optional properties explicitly set to 'undefined'.
|
|
97
|
-
*/
|
|
98
|
-
omitUndefined?: boolean;
|
|
99
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { BaseSchema, Schema, SchemaType } from "../../Schema";
|
|
2
|
-
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
3
|
-
import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
4
|
-
import { getSchemaUtils } from "../schema-utils";
|
|
5
|
-
|
|
6
|
-
export function bigint(): Schema<string, bigint> {
|
|
7
|
-
const baseSchema: BaseSchema<string, bigint> = {
|
|
8
|
-
parse: (raw, { breadcrumbsPrefix = [] } = {}) => {
|
|
9
|
-
if (typeof raw !== "string") {
|
|
10
|
-
return {
|
|
11
|
-
ok: false,
|
|
12
|
-
errors: [
|
|
13
|
-
{
|
|
14
|
-
path: breadcrumbsPrefix,
|
|
15
|
-
message: getErrorMessageForIncorrectType(raw, "string"),
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
ok: true,
|
|
22
|
-
value: BigInt(raw),
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
json: (bigint, { breadcrumbsPrefix = [] } = {}) => {
|
|
26
|
-
if (typeof bigint === "bigint") {
|
|
27
|
-
return {
|
|
28
|
-
ok: true,
|
|
29
|
-
value: bigint.toString(),
|
|
30
|
-
};
|
|
31
|
-
} else {
|
|
32
|
-
return {
|
|
33
|
-
ok: false,
|
|
34
|
-
errors: [
|
|
35
|
-
{
|
|
36
|
-
path: breadcrumbsPrefix,
|
|
37
|
-
message: getErrorMessageForIncorrectType(bigint, "bigint"),
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
getType: () => SchemaType.BIGINT,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
...maybeSkipValidation(baseSchema),
|
|
48
|
-
...getSchemaUtils(baseSchema),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { bigint } from "./bigint";
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { BaseSchema, Schema, SchemaType } from "../../Schema";
|
|
2
|
-
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
3
|
-
import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
4
|
-
import { getSchemaUtils } from "../schema-utils";
|
|
5
|
-
|
|
6
|
-
// https://stackoverflow.com/questions/12756159/regex-and-iso8601-formatted-datetime
|
|
7
|
-
const ISO_8601_REGEX =
|
|
8
|
-
/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
|
|
9
|
-
|
|
10
|
-
export function date(): Schema<string, Date> {
|
|
11
|
-
const baseSchema: BaseSchema<string, Date> = {
|
|
12
|
-
parse: (raw, { breadcrumbsPrefix = [] } = {}) => {
|
|
13
|
-
if (typeof raw !== "string") {
|
|
14
|
-
return {
|
|
15
|
-
ok: false,
|
|
16
|
-
errors: [
|
|
17
|
-
{
|
|
18
|
-
path: breadcrumbsPrefix,
|
|
19
|
-
message: getErrorMessageForIncorrectType(raw, "string"),
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
if (!ISO_8601_REGEX.test(raw)) {
|
|
25
|
-
return {
|
|
26
|
-
ok: false,
|
|
27
|
-
errors: [
|
|
28
|
-
{
|
|
29
|
-
path: breadcrumbsPrefix,
|
|
30
|
-
message: getErrorMessageForIncorrectType(raw, "ISO 8601 date string"),
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
ok: true,
|
|
37
|
-
value: new Date(raw),
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
json: (date, { breadcrumbsPrefix = [] } = {}) => {
|
|
41
|
-
if (date instanceof Date) {
|
|
42
|
-
return {
|
|
43
|
-
ok: true,
|
|
44
|
-
value: date.toISOString(),
|
|
45
|
-
};
|
|
46
|
-
} else {
|
|
47
|
-
return {
|
|
48
|
-
ok: false,
|
|
49
|
-
errors: [
|
|
50
|
-
{
|
|
51
|
-
path: breadcrumbsPrefix,
|
|
52
|
-
message: getErrorMessageForIncorrectType(date, "Date object"),
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
getType: () => SchemaType.DATE,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
...maybeSkipValidation(baseSchema),
|
|
63
|
-
...getSchemaUtils(baseSchema),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { date } from "./date";
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Schema, SchemaType } from "../../Schema";
|
|
2
|
-
import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator";
|
|
3
|
-
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
4
|
-
|
|
5
|
-
export function enum_<U extends string, E extends U[]>(values: E): Schema<E[number], E[number]> {
|
|
6
|
-
const validValues = new Set<string>(values);
|
|
7
|
-
|
|
8
|
-
const schemaCreator = createIdentitySchemaCreator(
|
|
9
|
-
SchemaType.ENUM,
|
|
10
|
-
(value, { allowUnrecognizedEnumValues, breadcrumbsPrefix = [] } = {}) => {
|
|
11
|
-
if (typeof value !== "string") {
|
|
12
|
-
return {
|
|
13
|
-
ok: false,
|
|
14
|
-
errors: [
|
|
15
|
-
{
|
|
16
|
-
path: breadcrumbsPrefix,
|
|
17
|
-
message: getErrorMessageForIncorrectType(value, "string"),
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!validValues.has(value) && !allowUnrecognizedEnumValues) {
|
|
24
|
-
return {
|
|
25
|
-
ok: false,
|
|
26
|
-
errors: [
|
|
27
|
-
{
|
|
28
|
-
path: breadcrumbsPrefix,
|
|
29
|
-
message: getErrorMessageForIncorrectType(value, "enum"),
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
ok: true,
|
|
37
|
-
value: value as U,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
return schemaCreator();
|
|
43
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { enum_ } from "./enum";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from "./bigint";
|
|
2
|
-
export * from "./date";
|
|
3
|
-
export * from "./enum";
|
|
4
|
-
export * from "./lazy";
|
|
5
|
-
export * from "./list";
|
|
6
|
-
export * from "./literals";
|
|
7
|
-
export * from "./object";
|
|
8
|
-
export * from "./object-like";
|
|
9
|
-
export * from "./primitives";
|
|
10
|
-
export * from "./record";
|
|
11
|
-
export * from "./schema-utils";
|
|
12
|
-
export * from "./set";
|
|
13
|
-
export * from "./undiscriminated-union";
|
|
14
|
-
export * from "./union";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { BaseSchema, Schema } from "../../Schema";
|
|
2
|
-
import { getSchemaUtils } from "../schema-utils";
|
|
3
|
-
|
|
4
|
-
export type SchemaGetter<SchemaType extends Schema<any, any>> = () => SchemaType;
|
|
5
|
-
|
|
6
|
-
export function lazy<Raw, Parsed>(getter: SchemaGetter<Schema<Raw, Parsed>>): Schema<Raw, Parsed> {
|
|
7
|
-
const baseSchema = constructLazyBaseSchema(getter);
|
|
8
|
-
return {
|
|
9
|
-
...baseSchema,
|
|
10
|
-
...getSchemaUtils(baseSchema),
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function constructLazyBaseSchema<Raw, Parsed>(
|
|
15
|
-
getter: SchemaGetter<Schema<Raw, Parsed>>
|
|
16
|
-
): BaseSchema<Raw, Parsed> {
|
|
17
|
-
return {
|
|
18
|
-
parse: (raw, opts) => getMemoizedSchema(getter).parse(raw, opts),
|
|
19
|
-
json: (parsed, opts) => getMemoizedSchema(getter).json(parsed, opts),
|
|
20
|
-
getType: () => getMemoizedSchema(getter).getType(),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
type MemoizedGetter<SchemaType extends Schema<any, any>> = SchemaGetter<SchemaType> & { __zurg_memoized?: SchemaType };
|
|
25
|
-
|
|
26
|
-
export function getMemoizedSchema<SchemaType extends Schema<any, any>>(getter: SchemaGetter<SchemaType>): SchemaType {
|
|
27
|
-
const castedGetter = getter as MemoizedGetter<SchemaType>;
|
|
28
|
-
if (castedGetter.__zurg_memoized == null) {
|
|
29
|
-
castedGetter.__zurg_memoized = getter();
|
|
30
|
-
}
|
|
31
|
-
return castedGetter.__zurg_memoized;
|
|
32
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { getObjectUtils } from "../object";
|
|
2
|
-
import { getObjectLikeUtils } from "../object-like";
|
|
3
|
-
import { BaseObjectSchema, ObjectSchema } from "../object/types";
|
|
4
|
-
import { getSchemaUtils } from "../schema-utils";
|
|
5
|
-
import { constructLazyBaseSchema, getMemoizedSchema, SchemaGetter } from "./lazy";
|
|
6
|
-
|
|
7
|
-
export function lazyObject<Raw, Parsed>(getter: SchemaGetter<ObjectSchema<Raw, Parsed>>): ObjectSchema<Raw, Parsed> {
|
|
8
|
-
const baseSchema: BaseObjectSchema<Raw, Parsed> = {
|
|
9
|
-
...constructLazyBaseSchema(getter),
|
|
10
|
-
_getRawProperties: () => getMemoizedSchema(getter)._getRawProperties(),
|
|
11
|
-
_getParsedProperties: () => getMemoizedSchema(getter)._getParsedProperties(),
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
...baseSchema,
|
|
16
|
-
...getSchemaUtils(baseSchema),
|
|
17
|
-
...getObjectLikeUtils(baseSchema),
|
|
18
|
-
...getObjectUtils(baseSchema),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { list } from "./list";
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { BaseSchema, MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema";
|
|
2
|
-
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
3
|
-
import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
4
|
-
import { getSchemaUtils } from "../schema-utils";
|
|
5
|
-
|
|
6
|
-
export function list<Raw, Parsed>(schema: Schema<Raw, Parsed>): Schema<Raw[], Parsed[]> {
|
|
7
|
-
const baseSchema: BaseSchema<Raw[], Parsed[]> = {
|
|
8
|
-
parse: (raw, opts) =>
|
|
9
|
-
validateAndTransformArray(raw, (item, index) =>
|
|
10
|
-
schema.parse(item, {
|
|
11
|
-
...opts,
|
|
12
|
-
breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`],
|
|
13
|
-
})
|
|
14
|
-
),
|
|
15
|
-
json: (parsed, opts) =>
|
|
16
|
-
validateAndTransformArray(parsed, (item, index) =>
|
|
17
|
-
schema.json(item, {
|
|
18
|
-
...opts,
|
|
19
|
-
breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`],
|
|
20
|
-
})
|
|
21
|
-
),
|
|
22
|
-
getType: () => SchemaType.LIST,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
...maybeSkipValidation(baseSchema),
|
|
27
|
-
...getSchemaUtils(baseSchema),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function validateAndTransformArray<Raw, Parsed>(
|
|
32
|
-
value: unknown,
|
|
33
|
-
transformItem: (item: Raw, index: number) => MaybeValid<Parsed>
|
|
34
|
-
): MaybeValid<Parsed[]> {
|
|
35
|
-
if (!Array.isArray(value)) {
|
|
36
|
-
return {
|
|
37
|
-
ok: false,
|
|
38
|
-
errors: [
|
|
39
|
-
{
|
|
40
|
-
message: getErrorMessageForIncorrectType(value, "list"),
|
|
41
|
-
path: [],
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const maybeValidItems = value.map((item, index) => transformItem(item, index));
|
|
48
|
-
|
|
49
|
-
return maybeValidItems.reduce<MaybeValid<Parsed[]>>(
|
|
50
|
-
(acc, item) => {
|
|
51
|
-
if (acc.ok && item.ok) {
|
|
52
|
-
return {
|
|
53
|
-
ok: true,
|
|
54
|
-
value: [...acc.value, item.value],
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const errors: ValidationError[] = [];
|
|
59
|
-
if (!acc.ok) {
|
|
60
|
-
errors.push(...acc.errors);
|
|
61
|
-
}
|
|
62
|
-
if (!item.ok) {
|
|
63
|
-
errors.push(...item.errors);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
ok: false,
|
|
68
|
-
errors,
|
|
69
|
-
};
|
|
70
|
-
},
|
|
71
|
-
{ ok: true, value: [] }
|
|
72
|
-
);
|
|
73
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Schema, SchemaType } from "../../Schema";
|
|
2
|
-
import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator";
|
|
3
|
-
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
4
|
-
|
|
5
|
-
export function booleanLiteral<V extends boolean>(literal: V): Schema<V, V> {
|
|
6
|
-
const schemaCreator = createIdentitySchemaCreator(
|
|
7
|
-
SchemaType.BOOLEAN_LITERAL,
|
|
8
|
-
(value, { breadcrumbsPrefix = [] } = {}) => {
|
|
9
|
-
if (value === literal) {
|
|
10
|
-
return {
|
|
11
|
-
ok: true,
|
|
12
|
-
value: literal,
|
|
13
|
-
};
|
|
14
|
-
} else {
|
|
15
|
-
return {
|
|
16
|
-
ok: false,
|
|
17
|
-
errors: [
|
|
18
|
-
{
|
|
19
|
-
path: breadcrumbsPrefix,
|
|
20
|
-
message: getErrorMessageForIncorrectType(value, `${literal.toString()}`),
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
return schemaCreator();
|
|
29
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Schema, SchemaType } from "../../Schema";
|
|
2
|
-
import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator";
|
|
3
|
-
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
4
|
-
|
|
5
|
-
export function stringLiteral<V extends string>(literal: V): Schema<V, V> {
|
|
6
|
-
const schemaCreator = createIdentitySchemaCreator(
|
|
7
|
-
SchemaType.STRING_LITERAL,
|
|
8
|
-
(value, { breadcrumbsPrefix = [] } = {}) => {
|
|
9
|
-
if (value === literal) {
|
|
10
|
-
return {
|
|
11
|
-
ok: true,
|
|
12
|
-
value: literal,
|
|
13
|
-
};
|
|
14
|
-
} else {
|
|
15
|
-
return {
|
|
16
|
-
ok: false,
|
|
17
|
-
errors: [
|
|
18
|
-
{
|
|
19
|
-
path: breadcrumbsPrefix,
|
|
20
|
-
message: getErrorMessageForIncorrectType(value, `"${literal}"`),
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
return schemaCreator();
|
|
29
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export { getObjectUtils, object } from "./object";
|
|
2
|
-
export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties";
|
|
3
|
-
export type {
|
|
4
|
-
inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas,
|
|
5
|
-
inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas,
|
|
6
|
-
} from "./objectWithoutOptionalProperties";
|
|
7
|
-
export { isProperty, property } from "./property";
|
|
8
|
-
export type { Property } from "./property";
|
|
9
|
-
export type {
|
|
10
|
-
BaseObjectSchema,
|
|
11
|
-
inferObjectSchemaFromPropertySchemas,
|
|
12
|
-
inferParsedObject,
|
|
13
|
-
inferParsedObjectFromPropertySchemas,
|
|
14
|
-
inferParsedPropertySchema,
|
|
15
|
-
inferRawKey,
|
|
16
|
-
inferRawObject,
|
|
17
|
-
inferRawObjectFromPropertySchemas,
|
|
18
|
-
inferRawPropertySchema,
|
|
19
|
-
ObjectSchema,
|
|
20
|
-
ObjectUtils,
|
|
21
|
-
PropertySchemas,
|
|
22
|
-
} from "./types";
|