vellum-ai 0.0.45 → 0.1.1
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/Client.d.ts +23 -26
- package/Client.js +288 -242
- package/api/resources/deployments/client/Client.d.ts +8 -4
- package/api/resources/deployments/client/Client.js +52 -34
- package/api/resources/documentIndexes/client/Client.d.ts +9 -5
- package/api/resources/documentIndexes/client/Client.js +97 -69
- package/api/resources/documents/client/Client.d.ts +14 -10
- package/api/resources/documents/client/Client.js +222 -176
- package/api/resources/index.d.ts +0 -1
- package/api/resources/index.js +0 -1
- package/api/resources/modelVersions/client/Client.d.ts +8 -8
- package/api/resources/modelVersions/client/Client.js +51 -75
- package/api/resources/modelVersions/client/index.d.ts +1 -1
- package/api/resources/modelVersions/client/index.js +0 -15
- package/api/resources/registeredPrompts/client/Client.d.ts +11 -7
- package/api/resources/registeredPrompts/client/Client.js +72 -53
- package/api/resources/registeredPrompts/client/requests/RegisterPromptRequestRequest.d.ts +4 -1
- package/api/resources/sandboxes/client/Client.d.ts +9 -5
- package/api/resources/sandboxes/client/Client.js +92 -65
- package/api/resources/testSuites/client/Client.d.ts +9 -5
- package/api/resources/testSuites/client/Client.js +90 -63
- package/api/types/EnrichedNormalizedCompletion.d.ts +3 -1
- package/api/types/ModelVersionRead.d.ts +3 -0
- package/api/types/ProviderEnum.d.ts +7 -1
- package/api/types/ProviderEnum.js +3 -0
- package/api/types/RegisterPromptPromptInfoRequest.d.ts +0 -1
- package/api/types/RegisterPromptResponse.d.ts +2 -0
- package/api/types/index.d.ts +0 -2
- package/api/types/index.js +0 -2
- package/core/fetcher/Fetcher.d.ts +5 -3
- package/core/fetcher/Fetcher.js +104 -62
- package/core/fetcher/Supplier.js +11 -2
- package/core/fetcher/index.d.ts +3 -2
- package/core/form-data-utils/getFormDataContentLength.d.ts +1 -1
- package/core/form-data-utils/getFormDataContentLength.js +20 -9
- package/core/index.d.ts +1 -2
- package/core/index.js +4 -5
- package/core/schemas/Schema.d.ts +19 -0
- package/core/schemas/Schema.js +1 -0
- package/core/schemas/builders/date/date.js +22 -14
- package/core/schemas/builders/enum/enum.js +17 -7
- package/core/schemas/builders/lazy/index.d.ts +2 -1
- package/core/schemas/builders/lazy/lazy.js +21 -13
- package/core/schemas/builders/lazy/lazyObject.js +11 -11
- package/core/schemas/builders/list/list.js +53 -38
- package/core/schemas/builders/literals/booleanLiteral.d.ts +2 -0
- package/core/schemas/builders/literals/booleanLiteral.js +29 -0
- package/core/schemas/builders/literals/index.d.ts +1 -0
- package/core/schemas/builders/literals/index.js +3 -1
- package/core/schemas/builders/literals/stringLiteral.js +4 -3
- package/core/schemas/builders/object/index.d.ts +5 -2
- package/core/schemas/builders/object/index.js +3 -1
- package/core/schemas/builders/object/object.js +150 -129
- package/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +6 -0
- package/core/schemas/builders/object/objectWithoutOptionalProperties.js +8 -0
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +19 -18
- package/core/schemas/builders/object-like/index.d.ts +1 -1
- package/core/schemas/builders/primitives/boolean.js +4 -3
- package/core/schemas/builders/primitives/number.js +4 -3
- package/core/schemas/builders/primitives/string.js +4 -3
- package/core/schemas/builders/record/index.d.ts +1 -1
- package/core/schemas/builders/record/record.js +82 -67
- package/core/schemas/builders/schema-utils/JsonError.js +0 -1
- package/core/schemas/builders/schema-utils/ParseError.js +0 -1
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +23 -20
- package/core/schemas/builders/schema-utils/index.d.ts +2 -1
- package/core/schemas/builders/set/set.js +21 -12
- package/core/schemas/builders/undiscriminated-union/index.d.ts +1 -1
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +38 -24
- package/core/schemas/builders/union/index.d.ts +3 -2
- package/core/schemas/builders/union/union.js +95 -74
- package/core/schemas/index.d.ts +1 -1
- package/core/schemas/utils/createIdentitySchemaCreator.js +2 -4
- package/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +1 -0
- package/core/schemas/utils/getErrorMessageForIncorrectType.js +24 -0
- package/core/schemas/utils/isPlainObject.d.ts +0 -1
- package/core/schemas/utils/isPlainObject.js +1 -2
- package/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
- package/core/schemas/utils/maybeSkipValidation.js +37 -0
- package/core/streaming-fetcher/Stream.d.ts +14 -0
- package/core/streaming-fetcher/Stream.js +75 -0
- package/core/streaming-fetcher/StreamingFetcher.d.ts +10 -8
- package/core/streaming-fetcher/StreamingFetcher.js +38 -44
- package/core/streaming-fetcher/getHeader.d.ts +2 -0
- package/core/streaming-fetcher/getHeader.js +12 -0
- package/core/streaming-fetcher/index.d.ts +4 -1
- package/core/streaming-fetcher/index.js +5 -1
- package/dist/Client.d.ts +23 -26
- package/dist/Client.js +288 -242
- package/dist/api/resources/deployments/client/Client.d.ts +8 -4
- package/dist/api/resources/deployments/client/Client.js +52 -34
- package/dist/api/resources/documentIndexes/client/Client.d.ts +9 -5
- package/dist/api/resources/documentIndexes/client/Client.js +97 -69
- package/dist/api/resources/documents/client/Client.d.ts +14 -10
- package/dist/api/resources/documents/client/Client.js +222 -176
- package/dist/api/resources/index.d.ts +0 -1
- package/dist/api/resources/index.js +0 -1
- package/dist/api/resources/modelVersions/client/Client.d.ts +8 -8
- package/dist/api/resources/modelVersions/client/Client.js +51 -75
- package/dist/api/resources/modelVersions/client/index.d.ts +1 -1
- package/dist/api/resources/modelVersions/client/index.js +0 -15
- package/dist/api/resources/registeredPrompts/client/Client.d.ts +11 -7
- package/dist/api/resources/registeredPrompts/client/Client.js +72 -53
- package/dist/api/resources/registeredPrompts/client/requests/RegisterPromptRequestRequest.d.ts +4 -1
- package/dist/api/resources/sandboxes/client/Client.d.ts +9 -5
- package/dist/api/resources/sandboxes/client/Client.js +92 -65
- package/dist/api/resources/testSuites/client/Client.d.ts +9 -5
- package/dist/api/resources/testSuites/client/Client.js +90 -63
- package/dist/api/types/EnrichedNormalizedCompletion.d.ts +3 -1
- package/dist/api/types/ModelVersionRead.d.ts +3 -0
- package/dist/api/types/ProviderEnum.d.ts +7 -1
- package/dist/api/types/ProviderEnum.js +3 -0
- package/dist/api/types/RegisterPromptPromptInfoRequest.d.ts +0 -1
- package/dist/api/types/RegisterPromptResponse.d.ts +2 -0
- package/dist/api/types/index.d.ts +0 -2
- package/dist/api/types/index.js +0 -2
- package/dist/core/fetcher/Fetcher.d.ts +5 -3
- package/dist/core/fetcher/Fetcher.js +104 -62
- package/dist/core/fetcher/Supplier.js +11 -2
- package/dist/core/fetcher/index.d.ts +3 -2
- package/dist/core/form-data-utils/getFormDataContentLength.d.ts +1 -1
- package/dist/core/form-data-utils/getFormDataContentLength.js +20 -9
- package/dist/core/index.d.ts +1 -2
- package/dist/core/index.js +4 -5
- package/dist/core/schemas/Schema.d.ts +19 -0
- package/dist/core/schemas/Schema.js +1 -0
- package/dist/core/schemas/builders/date/date.js +22 -14
- package/dist/core/schemas/builders/enum/enum.js +17 -7
- package/dist/core/schemas/builders/lazy/index.d.ts +2 -1
- package/dist/core/schemas/builders/lazy/lazy.js +21 -13
- package/dist/core/schemas/builders/lazy/lazyObject.js +11 -11
- package/dist/core/schemas/builders/list/list.js +53 -38
- package/dist/core/schemas/builders/literals/booleanLiteral.d.ts +2 -0
- package/dist/core/schemas/builders/literals/booleanLiteral.js +29 -0
- package/dist/core/schemas/builders/literals/index.d.ts +1 -0
- package/dist/core/schemas/builders/literals/index.js +3 -1
- package/dist/core/schemas/builders/literals/stringLiteral.js +4 -3
- package/dist/core/schemas/builders/object/index.d.ts +5 -2
- package/dist/core/schemas/builders/object/index.js +3 -1
- package/dist/core/schemas/builders/object/object.js +150 -129
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +6 -0
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +8 -0
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +19 -18
- package/dist/core/schemas/builders/object-like/index.d.ts +1 -1
- package/dist/core/schemas/builders/primitives/boolean.js +4 -3
- package/dist/core/schemas/builders/primitives/number.js +4 -3
- package/dist/core/schemas/builders/primitives/string.js +4 -3
- package/dist/core/schemas/builders/record/index.d.ts +1 -1
- package/dist/core/schemas/builders/record/record.js +82 -67
- package/dist/core/schemas/builders/schema-utils/JsonError.js +0 -1
- package/dist/core/schemas/builders/schema-utils/ParseError.js +0 -1
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +23 -20
- package/dist/core/schemas/builders/schema-utils/index.d.ts +2 -1
- package/dist/core/schemas/builders/set/set.js +21 -12
- package/dist/core/schemas/builders/undiscriminated-union/index.d.ts +1 -1
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +38 -24
- package/dist/core/schemas/builders/union/index.d.ts +3 -2
- package/dist/core/schemas/builders/union/union.js +95 -74
- package/dist/core/schemas/index.d.ts +1 -1
- package/dist/core/schemas/utils/createIdentitySchemaCreator.js +2 -4
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +1 -0
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +24 -0
- package/dist/core/schemas/utils/isPlainObject.d.ts +0 -1
- package/dist/core/schemas/utils/isPlainObject.js +1 -2
- package/dist/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
- package/dist/core/schemas/utils/maybeSkipValidation.js +37 -0
- package/dist/core/streaming-fetcher/Stream.d.ts +14 -0
- package/dist/core/streaming-fetcher/Stream.js +75 -0
- package/dist/core/streaming-fetcher/StreamingFetcher.d.ts +10 -8
- package/dist/core/streaming-fetcher/StreamingFetcher.js +38 -44
- package/dist/core/streaming-fetcher/getHeader.d.ts +2 -0
- package/dist/core/streaming-fetcher/getHeader.js +12 -0
- package/dist/core/streaming-fetcher/index.d.ts +4 -1
- package/dist/core/streaming-fetcher/index.js +5 -1
- package/dist/errors/VellumError.js +14 -3
- package/dist/serialization/client/requests/ExecuteWorkflowStreamRequest.js +11 -2
- package/dist/serialization/client/requests/GenerateBodyRequest.js +11 -2
- package/dist/serialization/client/requests/GenerateStreamBodyRequest.js +11 -2
- package/dist/serialization/client/requests/SearchRequestBodyRequest.js +10 -1
- package/dist/serialization/client/requests/SubmitCompletionActualsRequest.js +10 -1
- package/dist/serialization/client/requests/SubmitWorkflowExecutionActualsRequest.js +10 -1
- package/dist/serialization/resources/documentIndexes/client/requests/DocumentIndexCreateRequest.js +11 -2
- package/dist/serialization/resources/documents/client/requests/PatchedDocumentUpdateRequest.js +10 -1
- package/dist/serialization/resources/index.d.ts +0 -2
- package/dist/serialization/resources/index.js +1 -3
- package/dist/serialization/resources/registeredPrompts/client/requests/RegisterPromptRequestRequest.d.ts +1 -1
- package/dist/serialization/resources/registeredPrompts/client/requests/RegisterPromptRequestRequest.js +12 -3
- package/dist/serialization/resources/sandboxes/client/requests/UpsertSandboxScenarioRequestRequest.js +11 -2
- package/dist/serialization/resources/testSuites/client/requests/TestSuiteTestCaseRequest.js +10 -1
- package/dist/serialization/types/ApiNodeResult.js +10 -1
- package/dist/serialization/types/ChatMessage.js +10 -1
- package/dist/serialization/types/ChatMessageRequest.js +10 -1
- package/dist/serialization/types/ConditionalNodeResult.js +10 -1
- package/dist/serialization/types/DeploymentRead.js +12 -3
- package/dist/serialization/types/DocumentDocumentToDocumentIndex.js +10 -1
- package/dist/serialization/types/DocumentIndexRead.js +11 -2
- package/dist/serialization/types/DocumentRead.js +12 -3
- package/dist/serialization/types/EnrichedNormalizedCompletion.d.ts +3 -1
- package/dist/serialization/types/EnrichedNormalizedCompletion.js +15 -4
- package/dist/serialization/types/GenerateOptionsRequest.js +10 -1
- package/dist/serialization/types/GenerateRequest.js +10 -1
- package/dist/serialization/types/GenerateResponse.js +10 -1
- package/dist/serialization/types/GenerateResult.js +11 -2
- package/dist/serialization/types/GenerateResultData.js +10 -1
- package/dist/serialization/types/GenerateStreamResponse.js +10 -1
- package/dist/serialization/types/GenerateStreamResult.js +11 -2
- package/dist/serialization/types/GenerateStreamResultData.js +10 -1
- package/dist/serialization/types/MetadataFilterConfigRequest.js +12 -3
- package/dist/serialization/types/MetadataFilterRuleRequest.js +12 -3
- package/dist/serialization/types/ModelVersionBuildConfig.js +10 -1
- package/dist/serialization/types/ModelVersionExecConfig.js +12 -3
- package/dist/serialization/types/ModelVersionRead.js +13 -4
- package/dist/serialization/types/NodeInputCompiledChatHistoryValue.js +10 -1
- package/dist/serialization/types/NodeInputCompiledErrorValue.js +10 -1
- package/dist/serialization/types/NodeInputCompiledSearchResultsValue.js +10 -1
- package/dist/serialization/types/NodeInputVariableCompiledValue.js +15 -6
- package/dist/serialization/types/NormalizedLogProbs.js +10 -1
- package/dist/serialization/types/PaginatedSlimDocumentList.js +10 -1
- package/dist/serialization/types/PromptNodeResult.js +10 -1
- package/dist/serialization/types/PromptTemplateBlock.js +11 -2
- package/dist/serialization/types/PromptTemplateBlockData.js +10 -1
- package/dist/serialization/types/PromptTemplateBlockDataRequest.js +10 -1
- package/dist/serialization/types/PromptTemplateBlockProperties.js +12 -3
- package/dist/serialization/types/PromptTemplateBlockPropertiesRequest.js +12 -3
- package/dist/serialization/types/PromptTemplateBlockRequest.js +11 -2
- package/dist/serialization/types/ProviderEnum.d.ts +1 -1
- package/dist/serialization/types/ProviderEnum.js +3 -0
- package/dist/serialization/types/RegisterPromptPromptInfoRequest.d.ts +0 -1
- package/dist/serialization/types/RegisterPromptPromptInfoRequest.js +11 -3
- package/dist/serialization/types/RegisterPromptResponse.d.ts +1 -0
- package/dist/serialization/types/RegisterPromptResponse.js +15 -5
- package/dist/serialization/types/RegisteredPromptInputVariableRequest.js +10 -1
- package/dist/serialization/types/SandboxMetricInputParams.js +10 -1
- package/dist/serialization/types/SandboxMetricInputParamsRequest.js +10 -1
- package/dist/serialization/types/SandboxScenario.js +11 -2
- package/dist/serialization/types/ScenarioInput.js +11 -2
- package/dist/serialization/types/ScenarioInputRequest.js +11 -2
- package/dist/serialization/types/SearchFiltersRequest.js +10 -1
- package/dist/serialization/types/SearchNodeResult.js +10 -1
- package/dist/serialization/types/SearchNodeResultData.js +10 -1
- package/dist/serialization/types/SearchRequestOptionsRequest.js +12 -3
- package/dist/serialization/types/SearchResponse.js +10 -1
- package/dist/serialization/types/SearchResult.js +10 -1
- package/dist/serialization/types/SlimDocument.js +13 -4
- package/dist/serialization/types/SubmitWorkflowExecutionActualRequest.js +12 -3
- package/dist/serialization/types/TemplatingNodeChatHistoryResult.js +10 -1
- package/dist/serialization/types/TemplatingNodeErrorResult.js +10 -1
- package/dist/serialization/types/TemplatingNodeResult.js +10 -1
- package/dist/serialization/types/TemplatingNodeResultData.js +10 -1
- package/dist/serialization/types/TemplatingNodeResultOutput.js +15 -6
- package/dist/serialization/types/TemplatingNodeSearchResultsResult.js +10 -1
- package/dist/serialization/types/TerminalNodeChatHistoryResult.js +10 -1
- package/dist/serialization/types/TerminalNodeErrorResult.js +10 -1
- package/dist/serialization/types/TerminalNodeResult.js +10 -1
- package/dist/serialization/types/TerminalNodeResultData.js +10 -1
- package/dist/serialization/types/TerminalNodeResultOutput.js +15 -6
- package/dist/serialization/types/TerminalNodeSearchResultsResult.js +10 -1
- package/dist/serialization/types/TestSuiteTestCase.js +10 -1
- package/dist/serialization/types/VellumError.js +10 -1
- package/dist/serialization/types/VellumVariable.js +10 -1
- package/dist/serialization/types/WorkflowEventError.js +10 -1
- package/dist/serialization/types/WorkflowExecutionActualChatHistoryRequest.js +10 -1
- package/dist/serialization/types/WorkflowExecutionNodeResultEvent.js +10 -1
- package/dist/serialization/types/WorkflowExecutionWorkflowResultEvent.js +10 -1
- package/dist/serialization/types/WorkflowNodeResultData.js +15 -6
- package/dist/serialization/types/WorkflowNodeResultEvent.js +13 -4
- package/dist/serialization/types/WorkflowRequestChatHistoryInputRequest.js +10 -1
- package/dist/serialization/types/WorkflowRequestInputRequest.js +12 -3
- package/dist/serialization/types/WorkflowResultEvent.js +12 -3
- package/dist/serialization/types/WorkflowResultEventOutputData.js +15 -6
- package/dist/serialization/types/WorkflowResultEventOutputDataChatHistory.js +11 -2
- package/dist/serialization/types/WorkflowResultEventOutputDataError.js +11 -2
- package/dist/serialization/types/WorkflowResultEventOutputDataJson.js +10 -1
- package/dist/serialization/types/WorkflowResultEventOutputDataNumber.js +10 -1
- package/dist/serialization/types/WorkflowResultEventOutputDataSearchResults.js +11 -2
- package/dist/serialization/types/WorkflowResultEventOutputDataString.js +10 -1
- package/dist/serialization/types/WorkflowStreamEvent.js +11 -2
- package/dist/serialization/types/index.d.ts +0 -2
- package/dist/serialization/types/index.js +0 -2
- package/errors/VellumError.js +14 -3
- package/package.json +4 -3
- package/serialization/client/requests/ExecuteWorkflowStreamRequest.js +11 -2
- package/serialization/client/requests/GenerateBodyRequest.js +11 -2
- package/serialization/client/requests/GenerateStreamBodyRequest.js +11 -2
- package/serialization/client/requests/SearchRequestBodyRequest.js +10 -1
- package/serialization/client/requests/SubmitCompletionActualsRequest.js +10 -1
- package/serialization/client/requests/SubmitWorkflowExecutionActualsRequest.js +10 -1
- package/serialization/resources/documentIndexes/client/requests/DocumentIndexCreateRequest.js +11 -2
- package/serialization/resources/documents/client/requests/PatchedDocumentUpdateRequest.js +10 -1
- package/serialization/resources/index.d.ts +0 -2
- package/serialization/resources/index.js +1 -3
- package/serialization/resources/registeredPrompts/client/requests/RegisterPromptRequestRequest.d.ts +1 -1
- package/serialization/resources/registeredPrompts/client/requests/RegisterPromptRequestRequest.js +12 -3
- package/serialization/resources/sandboxes/client/requests/UpsertSandboxScenarioRequestRequest.js +11 -2
- package/serialization/resources/testSuites/client/requests/TestSuiteTestCaseRequest.js +10 -1
- package/serialization/types/ApiNodeResult.js +10 -1
- package/serialization/types/ChatMessage.js +10 -1
- package/serialization/types/ChatMessageRequest.js +10 -1
- package/serialization/types/ConditionalNodeResult.js +10 -1
- package/serialization/types/DeploymentRead.js +12 -3
- package/serialization/types/DocumentDocumentToDocumentIndex.js +10 -1
- package/serialization/types/DocumentIndexRead.js +11 -2
- package/serialization/types/DocumentRead.js +12 -3
- package/serialization/types/EnrichedNormalizedCompletion.d.ts +3 -1
- package/serialization/types/EnrichedNormalizedCompletion.js +15 -4
- package/serialization/types/GenerateOptionsRequest.js +10 -1
- package/serialization/types/GenerateRequest.js +10 -1
- package/serialization/types/GenerateResponse.js +10 -1
- package/serialization/types/GenerateResult.js +11 -2
- package/serialization/types/GenerateResultData.js +10 -1
- package/serialization/types/GenerateStreamResponse.js +10 -1
- package/serialization/types/GenerateStreamResult.js +11 -2
- package/serialization/types/GenerateStreamResultData.js +10 -1
- package/serialization/types/MetadataFilterConfigRequest.js +12 -3
- package/serialization/types/MetadataFilterRuleRequest.js +12 -3
- package/serialization/types/ModelVersionBuildConfig.js +10 -1
- package/serialization/types/ModelVersionExecConfig.js +12 -3
- package/serialization/types/ModelVersionRead.js +13 -4
- package/serialization/types/NodeInputCompiledChatHistoryValue.js +10 -1
- package/serialization/types/NodeInputCompiledErrorValue.js +10 -1
- package/serialization/types/NodeInputCompiledSearchResultsValue.js +10 -1
- package/serialization/types/NodeInputVariableCompiledValue.js +15 -6
- package/serialization/types/NormalizedLogProbs.js +10 -1
- package/serialization/types/PaginatedSlimDocumentList.js +10 -1
- package/serialization/types/PromptNodeResult.js +10 -1
- package/serialization/types/PromptTemplateBlock.js +11 -2
- package/serialization/types/PromptTemplateBlockData.js +10 -1
- package/serialization/types/PromptTemplateBlockDataRequest.js +10 -1
- package/serialization/types/PromptTemplateBlockProperties.js +12 -3
- package/serialization/types/PromptTemplateBlockPropertiesRequest.js +12 -3
- package/serialization/types/PromptTemplateBlockRequest.js +11 -2
- package/serialization/types/ProviderEnum.d.ts +1 -1
- package/serialization/types/ProviderEnum.js +3 -0
- package/serialization/types/RegisterPromptPromptInfoRequest.d.ts +0 -1
- package/serialization/types/RegisterPromptPromptInfoRequest.js +11 -3
- package/serialization/types/RegisterPromptResponse.d.ts +1 -0
- package/serialization/types/RegisterPromptResponse.js +15 -5
- package/serialization/types/RegisteredPromptInputVariableRequest.js +10 -1
- package/serialization/types/SandboxMetricInputParams.js +10 -1
- package/serialization/types/SandboxMetricInputParamsRequest.js +10 -1
- package/serialization/types/SandboxScenario.js +11 -2
- package/serialization/types/ScenarioInput.js +11 -2
- package/serialization/types/ScenarioInputRequest.js +11 -2
- package/serialization/types/SearchFiltersRequest.js +10 -1
- package/serialization/types/SearchNodeResult.js +10 -1
- package/serialization/types/SearchNodeResultData.js +10 -1
- package/serialization/types/SearchRequestOptionsRequest.js +12 -3
- package/serialization/types/SearchResponse.js +10 -1
- package/serialization/types/SearchResult.js +10 -1
- package/serialization/types/SlimDocument.js +13 -4
- package/serialization/types/SubmitWorkflowExecutionActualRequest.js +12 -3
- package/serialization/types/TemplatingNodeChatHistoryResult.js +10 -1
- package/serialization/types/TemplatingNodeErrorResult.js +10 -1
- package/serialization/types/TemplatingNodeResult.js +10 -1
- package/serialization/types/TemplatingNodeResultData.js +10 -1
- package/serialization/types/TemplatingNodeResultOutput.js +15 -6
- package/serialization/types/TemplatingNodeSearchResultsResult.js +10 -1
- package/serialization/types/TerminalNodeChatHistoryResult.js +10 -1
- package/serialization/types/TerminalNodeErrorResult.js +10 -1
- package/serialization/types/TerminalNodeResult.js +10 -1
- package/serialization/types/TerminalNodeResultData.js +10 -1
- package/serialization/types/TerminalNodeResultOutput.js +15 -6
- package/serialization/types/TerminalNodeSearchResultsResult.js +10 -1
- package/serialization/types/TestSuiteTestCase.js +10 -1
- package/serialization/types/VellumError.js +10 -1
- package/serialization/types/VellumVariable.js +10 -1
- package/serialization/types/WorkflowEventError.js +10 -1
- package/serialization/types/WorkflowExecutionActualChatHistoryRequest.js +10 -1
- package/serialization/types/WorkflowExecutionNodeResultEvent.js +10 -1
- package/serialization/types/WorkflowExecutionWorkflowResultEvent.js +10 -1
- package/serialization/types/WorkflowNodeResultData.js +15 -6
- package/serialization/types/WorkflowNodeResultEvent.js +13 -4
- package/serialization/types/WorkflowRequestChatHistoryInputRequest.js +10 -1
- package/serialization/types/WorkflowRequestInputRequest.js +12 -3
- package/serialization/types/WorkflowResultEvent.js +12 -3
- package/serialization/types/WorkflowResultEventOutputData.js +15 -6
- package/serialization/types/WorkflowResultEventOutputDataChatHistory.js +11 -2
- package/serialization/types/WorkflowResultEventOutputDataError.js +11 -2
- package/serialization/types/WorkflowResultEventOutputDataJson.js +10 -1
- package/serialization/types/WorkflowResultEventOutputDataNumber.js +10 -1
- package/serialization/types/WorkflowResultEventOutputDataSearchResults.js +11 -2
- package/serialization/types/WorkflowResultEventOutputDataString.js +10 -1
- package/serialization/types/WorkflowStreamEvent.js +11 -2
- package/serialization/types/index.d.ts +0 -2
- package/serialization/types/index.js +0 -2
- package/api/resources/modelVersions/client/requests/ModelVersionCompilePromptRequestRequest.d.ts +0 -7
- package/api/resources/modelVersions/client/requests/ModelVersionCompilePromptRequestRequest.js +0 -5
- package/api/resources/modelVersions/client/requests/index.d.ts +0 -1
- package/api/resources/modelVersions/client/requests/index.js +0 -2
- package/api/types/ModelVersionCompilePromptResponse.d.ts +0 -8
- package/api/types/ModelVersionCompilePromptResponse.js +0 -5
- package/api/types/ModelVersionCompiledPrompt.d.ts +0 -9
- package/api/types/ModelVersionCompiledPrompt.js +0 -5
- package/core/callback-queue/CallbackQueue.d.ts +0 -6
- package/core/callback-queue/CallbackQueue.js +0 -20
- package/core/callback-queue/index.d.ts +0 -1
- package/core/callback-queue/index.js +0 -5
- package/dist/api/resources/modelVersions/client/requests/ModelVersionCompilePromptRequestRequest.d.ts +0 -7
- package/dist/api/resources/modelVersions/client/requests/ModelVersionCompilePromptRequestRequest.js +0 -5
- package/dist/api/resources/modelVersions/client/requests/index.d.ts +0 -1
- package/dist/api/resources/modelVersions/client/requests/index.js +0 -2
- package/dist/api/types/ModelVersionCompilePromptResponse.d.ts +0 -8
- package/dist/api/types/ModelVersionCompilePromptResponse.js +0 -5
- package/dist/api/types/ModelVersionCompiledPrompt.d.ts +0 -9
- package/dist/api/types/ModelVersionCompiledPrompt.js +0 -5
- package/dist/core/callback-queue/CallbackQueue.d.ts +0 -6
- package/dist/core/callback-queue/CallbackQueue.js +0 -20
- package/dist/core/callback-queue/index.d.ts +0 -1
- package/dist/core/callback-queue/index.js +0 -5
- package/dist/serialization/resources/modelVersions/client/index.d.ts +0 -1
- package/dist/serialization/resources/modelVersions/client/index.js +0 -17
- package/dist/serialization/resources/modelVersions/client/requests/ModelVersionCompilePromptRequestRequest.d.ts +0 -12
- package/dist/serialization/resources/modelVersions/client/requests/ModelVersionCompilePromptRequestRequest.js +0 -33
- package/dist/serialization/resources/modelVersions/client/requests/index.d.ts +0 -1
- package/dist/serialization/resources/modelVersions/client/requests/index.js +0 -5
- package/dist/serialization/resources/modelVersions/index.d.ts +0 -1
- package/dist/serialization/resources/modelVersions/index.js +0 -17
- package/dist/serialization/types/ModelVersionCompilePromptResponse.d.ts +0 -12
- package/dist/serialization/types/ModelVersionCompilePromptResponse.js +0 -33
- package/dist/serialization/types/ModelVersionCompiledPrompt.d.ts +0 -13
- package/dist/serialization/types/ModelVersionCompiledPrompt.js +0 -34
- package/serialization/resources/modelVersions/client/index.d.ts +0 -1
- package/serialization/resources/modelVersions/client/index.js +0 -17
- package/serialization/resources/modelVersions/client/requests/ModelVersionCompilePromptRequestRequest.d.ts +0 -12
- package/serialization/resources/modelVersions/client/requests/ModelVersionCompilePromptRequestRequest.js +0 -33
- package/serialization/resources/modelVersions/client/requests/index.d.ts +0 -1
- package/serialization/resources/modelVersions/client/requests/index.js +0 -5
- package/serialization/resources/modelVersions/index.d.ts +0 -1
- package/serialization/resources/modelVersions/index.js +0 -17
- package/serialization/types/ModelVersionCompilePromptResponse.d.ts +0 -12
- package/serialization/types/ModelVersionCompilePromptResponse.js +0 -33
- package/serialization/types/ModelVersionCompiledPrompt.d.ts +0 -13
- package/serialization/types/ModelVersionCompiledPrompt.js +0 -34
|
@@ -13,6 +13,7 @@ export declare const SchemaType: {
|
|
|
13
13
|
readonly ENUM: "enum";
|
|
14
14
|
readonly LIST: "list";
|
|
15
15
|
readonly STRING_LITERAL: "stringLiteral";
|
|
16
|
+
readonly BOOLEAN_LITERAL: "booleanLiteral";
|
|
16
17
|
readonly OBJECT: "object";
|
|
17
18
|
readonly ANY: "any";
|
|
18
19
|
readonly BOOLEAN: "boolean";
|
|
@@ -59,4 +60,22 @@ export interface SchemaOptions {
|
|
|
59
60
|
* @default false
|
|
60
61
|
*/
|
|
61
62
|
allowUnrecognizedEnumValues?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* whether to allow data that doesn't conform to the schema.
|
|
65
|
+
* invalid data is passed through without transformation.
|
|
66
|
+
*
|
|
67
|
+
* when this is enabled, .parse() and .json() will always
|
|
68
|
+
* return `ok: true`. `.parseOrThrow()` and `.jsonOrThrow()`
|
|
69
|
+
* will never fail.
|
|
70
|
+
*
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
skipValidation?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* each validation failure contains a "path" property, which is
|
|
76
|
+
* the breadcrumbs to the offending node in the JSON. you can supply
|
|
77
|
+
* a prefix that is prepended to all the errors' paths. this can be
|
|
78
|
+
* helpful for zurg's internal debug logging.
|
|
79
|
+
*/
|
|
80
|
+
breadcrumbsPrefix?: string[];
|
|
62
81
|
}
|
|
@@ -2,31 +2,42 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.date = void 0;
|
|
4
4
|
const Schema_1 = require("../../Schema");
|
|
5
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
6
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
5
7
|
const schema_utils_1 = require("../schema-utils");
|
|
6
8
|
// https://stackoverflow.com/questions/12756159/regex-and-iso8601-formatted-datetime
|
|
7
9
|
const ISO_8601_REGEX = /^([+-]?\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)?)?)?)?$/;
|
|
8
10
|
function date() {
|
|
9
11
|
const baseSchema = {
|
|
10
|
-
parse: (raw) => {
|
|
11
|
-
if (typeof raw
|
|
12
|
+
parse: (raw, { breadcrumbsPrefix = [] } = {}) => {
|
|
13
|
+
if (typeof raw !== "string") {
|
|
12
14
|
return {
|
|
13
|
-
ok:
|
|
14
|
-
|
|
15
|
+
ok: false,
|
|
16
|
+
errors: [
|
|
17
|
+
{
|
|
18
|
+
path: breadcrumbsPrefix,
|
|
19
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(raw, "string"),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
15
22
|
};
|
|
16
23
|
}
|
|
17
|
-
|
|
24
|
+
if (!ISO_8601_REGEX.test(raw)) {
|
|
18
25
|
return {
|
|
19
26
|
ok: false,
|
|
20
27
|
errors: [
|
|
21
28
|
{
|
|
22
|
-
path:
|
|
23
|
-
message:
|
|
29
|
+
path: breadcrumbsPrefix,
|
|
30
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(raw, "ISO 8601 date string"),
|
|
24
31
|
},
|
|
25
32
|
],
|
|
26
33
|
};
|
|
27
34
|
}
|
|
35
|
+
return {
|
|
36
|
+
ok: true,
|
|
37
|
+
value: new Date(raw),
|
|
38
|
+
};
|
|
28
39
|
},
|
|
29
|
-
json: (date) => {
|
|
40
|
+
json: (date, { breadcrumbsPrefix = [] } = {}) => {
|
|
30
41
|
if (date instanceof Date) {
|
|
31
42
|
return {
|
|
32
43
|
ok: true,
|
|
@@ -38,8 +49,8 @@ function date() {
|
|
|
38
49
|
ok: false,
|
|
39
50
|
errors: [
|
|
40
51
|
{
|
|
41
|
-
path:
|
|
42
|
-
message:
|
|
52
|
+
path: breadcrumbsPrefix,
|
|
53
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(date, "Date object"),
|
|
43
54
|
},
|
|
44
55
|
],
|
|
45
56
|
};
|
|
@@ -47,9 +58,6 @@ function date() {
|
|
|
47
58
|
},
|
|
48
59
|
getType: () => Schema_1.SchemaType.DATE,
|
|
49
60
|
};
|
|
50
|
-
return {
|
|
51
|
-
...baseSchema,
|
|
52
|
-
...(0, schema_utils_1.getSchemaUtils)(baseSchema),
|
|
53
|
-
};
|
|
61
|
+
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
54
62
|
}
|
|
55
63
|
exports.date = date;
|
|
@@ -3,26 +3,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.enum_ = void 0;
|
|
4
4
|
const Schema_1 = require("../../Schema");
|
|
5
5
|
const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
|
|
6
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
6
7
|
function enum_(values) {
|
|
7
8
|
const validValues = new Set(values);
|
|
8
|
-
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.ENUM, (value, { allowUnrecognizedEnumValues } = {}) => {
|
|
9
|
-
if (typeof value
|
|
9
|
+
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.ENUM, (value, { allowUnrecognizedEnumValues, breadcrumbsPrefix = [] } = {}) => {
|
|
10
|
+
if (typeof value !== "string") {
|
|
10
11
|
return {
|
|
11
|
-
ok:
|
|
12
|
-
|
|
12
|
+
ok: false,
|
|
13
|
+
errors: [
|
|
14
|
+
{
|
|
15
|
+
path: breadcrumbsPrefix,
|
|
16
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "string"),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
13
19
|
};
|
|
14
20
|
}
|
|
15
|
-
|
|
21
|
+
if (!validValues.has(value) && !allowUnrecognizedEnumValues) {
|
|
16
22
|
return {
|
|
17
23
|
ok: false,
|
|
18
24
|
errors: [
|
|
19
25
|
{
|
|
20
|
-
path:
|
|
21
|
-
message:
|
|
26
|
+
path: breadcrumbsPrefix,
|
|
27
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "enum"),
|
|
22
28
|
},
|
|
23
29
|
],
|
|
24
30
|
};
|
|
25
31
|
}
|
|
32
|
+
return {
|
|
33
|
+
ok: true,
|
|
34
|
+
value: value,
|
|
35
|
+
};
|
|
26
36
|
});
|
|
27
37
|
return schemaCreator();
|
|
28
38
|
}
|
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.getMemoizedSchema = exports.constructLazyBaseSchema = exports.lazy = void 0;
|
|
4
13
|
const schema_utils_1 = require("../schema-utils");
|
|
5
14
|
function lazy(getter) {
|
|
6
15
|
const baseSchema = constructLazyBaseSchema(getter);
|
|
7
|
-
return {
|
|
8
|
-
...baseSchema,
|
|
9
|
-
...(0, schema_utils_1.getSchemaUtils)(baseSchema),
|
|
10
|
-
};
|
|
16
|
+
return Object.assign(Object.assign({}, baseSchema), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
11
17
|
}
|
|
12
18
|
exports.lazy = lazy;
|
|
13
19
|
function constructLazyBaseSchema(getter) {
|
|
14
20
|
return {
|
|
15
|
-
parse:
|
|
16
|
-
json:
|
|
17
|
-
getType:
|
|
21
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () { return (yield getMemoizedSchema(getter)).parse(raw, opts); }),
|
|
22
|
+
json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () { return (yield getMemoizedSchema(getter)).json(parsed, opts); }),
|
|
23
|
+
getType: () => __awaiter(this, void 0, void 0, function* () { return (yield getMemoizedSchema(getter)).getType(); }),
|
|
18
24
|
};
|
|
19
25
|
}
|
|
20
26
|
exports.constructLazyBaseSchema = constructLazyBaseSchema;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
castedGetter.__zurg_memoized
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
function getMemoizedSchema(getter) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const castedGetter = getter;
|
|
30
|
+
if (castedGetter.__zurg_memoized == null) {
|
|
31
|
+
castedGetter.__zurg_memoized = yield getter();
|
|
32
|
+
}
|
|
33
|
+
return castedGetter.__zurg_memoized;
|
|
34
|
+
});
|
|
27
35
|
}
|
|
28
36
|
exports.getMemoizedSchema = getMemoizedSchema;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.lazyObject = void 0;
|
|
4
13
|
const object_1 = require("../object");
|
|
@@ -6,16 +15,7 @@ const object_like_1 = require("../object-like");
|
|
|
6
15
|
const schema_utils_1 = require("../schema-utils");
|
|
7
16
|
const lazy_1 = require("./lazy");
|
|
8
17
|
function lazyObject(getter) {
|
|
9
|
-
const baseSchema = {
|
|
10
|
-
|
|
11
|
-
_getRawProperties: async () => (await (0, lazy_1.getMemoizedSchema)(getter))._getRawProperties(),
|
|
12
|
-
_getParsedProperties: async () => (await (0, lazy_1.getMemoizedSchema)(getter))._getParsedProperties(),
|
|
13
|
-
};
|
|
14
|
-
return {
|
|
15
|
-
...baseSchema,
|
|
16
|
-
...(0, schema_utils_1.getSchemaUtils)(baseSchema),
|
|
17
|
-
...(0, object_like_1.getObjectLikeUtils)(baseSchema),
|
|
18
|
-
...(0, object_1.getObjectUtils)(baseSchema),
|
|
19
|
-
};
|
|
18
|
+
const baseSchema = Object.assign(Object.assign({}, (0, lazy_1.constructLazyBaseSchema)(getter)), { _getRawProperties: () => __awaiter(this, void 0, void 0, function* () { return (yield (0, lazy_1.getMemoizedSchema)(getter))._getRawProperties(); }), _getParsedProperties: () => __awaiter(this, void 0, void 0, function* () { return (yield (0, lazy_1.getMemoizedSchema)(getter))._getParsedProperties(); }) });
|
|
19
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, baseSchema), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema)), (0, object_1.getObjectUtils)(baseSchema));
|
|
20
20
|
}
|
|
21
21
|
exports.lazyObject = lazyObject;
|
|
@@ -1,53 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.list = void 0;
|
|
4
13
|
const Schema_1 = require("../../Schema");
|
|
14
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
15
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
5
16
|
const schema_utils_1 = require("../schema-utils");
|
|
6
17
|
function list(schema) {
|
|
7
18
|
const baseSchema = {
|
|
8
|
-
parse:
|
|
9
|
-
|
|
19
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return validateAndTransformArray(raw, (item, index) => {
|
|
21
|
+
var _a;
|
|
22
|
+
return schema.parse(item, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `[${index}]`] }));
|
|
23
|
+
});
|
|
24
|
+
}),
|
|
25
|
+
json: (parsed, opts) => validateAndTransformArray(parsed, (item, index) => {
|
|
26
|
+
var _a;
|
|
27
|
+
return schema.json(item, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `[${index}]`] }));
|
|
28
|
+
}),
|
|
10
29
|
getType: () => Schema_1.SchemaType.LIST,
|
|
11
30
|
};
|
|
12
|
-
return {
|
|
13
|
-
...baseSchema,
|
|
14
|
-
...(0, schema_utils_1.getSchemaUtils)(baseSchema),
|
|
15
|
-
};
|
|
31
|
+
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
16
32
|
}
|
|
17
33
|
exports.list = list;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ok: false,
|
|
22
|
-
errors: [
|
|
23
|
-
{
|
|
24
|
-
message: "Not a list",
|
|
25
|
-
path: [],
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const maybeValidItems = await Promise.all(value.map((item) => transformItem(item)));
|
|
31
|
-
return maybeValidItems.reduce((acc, item, index) => {
|
|
32
|
-
if (acc.ok && item.ok) {
|
|
34
|
+
function validateAndTransformArray(value, transformItem) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
if (!Array.isArray(value)) {
|
|
33
37
|
return {
|
|
34
|
-
ok:
|
|
35
|
-
|
|
38
|
+
ok: false,
|
|
39
|
+
errors: [
|
|
40
|
+
{
|
|
41
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "list"),
|
|
42
|
+
path: [],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
36
45
|
};
|
|
37
46
|
}
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
const maybeValidItems = yield Promise.all(value.map((item, index) => transformItem(item, index)));
|
|
48
|
+
return maybeValidItems.reduce((acc, item) => {
|
|
49
|
+
if (acc.ok && item.ok) {
|
|
50
|
+
return {
|
|
51
|
+
ok: true,
|
|
52
|
+
value: [...acc.value, item.value],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const errors = [];
|
|
56
|
+
if (!acc.ok) {
|
|
57
|
+
errors.push(...acc.errors);
|
|
58
|
+
}
|
|
59
|
+
if (!item.ok) {
|
|
60
|
+
errors.push(...item.errors);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
ok: false,
|
|
64
|
+
errors,
|
|
65
|
+
};
|
|
66
|
+
}, { ok: true, value: [] });
|
|
67
|
+
});
|
|
53
68
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.booleanLiteral = void 0;
|
|
4
|
+
const Schema_1 = require("../../Schema");
|
|
5
|
+
const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
|
|
6
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
7
|
+
function booleanLiteral(literal) {
|
|
8
|
+
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.BOOLEAN_LITERAL, (value, { breadcrumbsPrefix = [] } = {}) => {
|
|
9
|
+
if (value === literal) {
|
|
10
|
+
return {
|
|
11
|
+
ok: true,
|
|
12
|
+
value: literal,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return {
|
|
17
|
+
ok: false,
|
|
18
|
+
errors: [
|
|
19
|
+
{
|
|
20
|
+
path: breadcrumbsPrefix,
|
|
21
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, `${literal.toString()}`),
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return schemaCreator();
|
|
28
|
+
}
|
|
29
|
+
exports.booleanLiteral = booleanLiteral;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringLiteral = void 0;
|
|
3
|
+
exports.booleanLiteral = exports.stringLiteral = void 0;
|
|
4
4
|
var stringLiteral_1 = require("./stringLiteral");
|
|
5
5
|
Object.defineProperty(exports, "stringLiteral", { enumerable: true, get: function () { return stringLiteral_1.stringLiteral; } });
|
|
6
|
+
var booleanLiteral_1 = require("./booleanLiteral");
|
|
7
|
+
Object.defineProperty(exports, "booleanLiteral", { enumerable: true, get: function () { return booleanLiteral_1.booleanLiteral; } });
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.stringLiteral = void 0;
|
|
4
4
|
const Schema_1 = require("../../Schema");
|
|
5
5
|
const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
|
|
6
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
6
7
|
function stringLiteral(literal) {
|
|
7
|
-
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.STRING_LITERAL, (value) => {
|
|
8
|
+
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.STRING_LITERAL, (value, { breadcrumbsPrefix = [] } = {}) => {
|
|
8
9
|
if (value === literal) {
|
|
9
10
|
return {
|
|
10
11
|
ok: true,
|
|
@@ -16,8 +17,8 @@ function stringLiteral(literal) {
|
|
|
16
17
|
ok: false,
|
|
17
18
|
errors: [
|
|
18
19
|
{
|
|
19
|
-
path:
|
|
20
|
-
message:
|
|
20
|
+
path: breadcrumbsPrefix,
|
|
21
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, `"${literal}"`),
|
|
21
22
|
},
|
|
22
23
|
],
|
|
23
24
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { getObjectUtils, object } from "./object";
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
2
|
+
export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties";
|
|
3
|
+
export type { inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas, inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas, } from "./objectWithoutOptionalProperties";
|
|
4
|
+
export { isProperty, property } from "./property";
|
|
5
|
+
export type { Property } from "./property";
|
|
6
|
+
export type { BaseObjectSchema, inferObjectSchemaFromPropertySchemas, inferParsedObject, inferParsedObjectFromPropertySchemas, inferParsedPropertySchema, inferRawKey, inferRawObject, inferRawObjectFromPropertySchemas, inferRawPropertySchema, ObjectSchema, ObjectUtils, PropertySchemas, } from "./types";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.property = exports.isProperty = exports.object = exports.getObjectUtils = void 0;
|
|
3
|
+
exports.property = exports.isProperty = exports.objectWithoutOptionalProperties = exports.object = exports.getObjectUtils = void 0;
|
|
4
4
|
var object_1 = require("./object");
|
|
5
5
|
Object.defineProperty(exports, "getObjectUtils", { enumerable: true, get: function () { return object_1.getObjectUtils; } });
|
|
6
6
|
Object.defineProperty(exports, "object", { enumerable: true, get: function () { return object_1.object; } });
|
|
7
|
+
var objectWithoutOptionalProperties_1 = require("./objectWithoutOptionalProperties");
|
|
8
|
+
Object.defineProperty(exports, "objectWithoutOptionalProperties", { enumerable: true, get: function () { return objectWithoutOptionalProperties_1.objectWithoutOptionalProperties; } });
|
|
7
9
|
var property_1 = require("./property");
|
|
8
10
|
Object.defineProperty(exports, "isProperty", { enumerable: true, get: function () { return property_1.isProperty; } });
|
|
9
11
|
Object.defineProperty(exports, "property", { enumerable: true, get: function () { return property_1.property; } });
|