mavenagi 0.0.0-alpha.2 → 0.0.0-alpha.20
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 +21 -0
- package/Client.js +20 -0
- package/README.md +70 -16
- package/api/resources/actions/client/Client.d.ts +96 -0
- package/api/resources/actions/client/Client.js +316 -0
- package/api/resources/actions/client/index.d.ts +1 -0
- package/api/resources/actions/client/index.js +1 -0
- package/api/resources/actions/index.d.ts +2 -0
- package/api/resources/actions/index.js +2 -0
- package/api/resources/actions/types/ActionBase.d.ts +18 -0
- package/api/resources/actions/types/ActionParameter.d.ts +9 -0
- package/api/resources/actions/types/ActionRequest.d.ts +31 -0
- package/api/resources/actions/types/ActionResponse.d.ts +35 -0
- package/api/resources/actions/types/ConversationExecutedActionPrecondition.d.ts +12 -0
- package/api/resources/actions/types/ConversationPrecondition.d.ts +20 -0
- package/api/resources/actions/types/MetadataPrecondition.d.ts +12 -0
- package/api/resources/actions/types/Precondition.d.ts +31 -0
- package/api/resources/actions/types/PreconditionGroup.d.ts +8 -0
- package/api/resources/actions/types/PreconditionGroupOperator.d.ts +8 -0
- package/api/resources/actions/types/PreconditionGroupOperator.js +7 -0
- package/api/resources/actions/types/PreconditionOperator.d.ts +7 -0
- package/api/resources/{knowledge/types/IdBody.d.ts → actions/types/PreconditionOperator.js} +3 -3
- package/api/resources/actions/types/index.d.ts +11 -0
- package/api/resources/actions/types/index.js +11 -0
- package/api/resources/appSettings/client/Client.d.ts +47 -0
- package/api/resources/appSettings/client/Client.js +124 -0
- package/api/resources/appSettings/client/index.d.ts +1 -0
- package/api/resources/appSettings/client/index.js +1 -0
- package/api/resources/appSettings/index.d.ts +1 -0
- package/api/resources/appSettings/index.js +1 -0
- package/api/resources/commons/errors/{AgentNotFoundError.d.ts → BadRequestError.d.ts} +1 -1
- package/api/resources/{conversation/errors/EmptyConversationError.js → commons/errors/BadRequestError.js} +3 -3
- package/{dist/api/resources/commons/errors/AgentNotFoundError.d.ts → api/resources/commons/errors/NotFoundError.d.ts} +1 -1
- package/{dist/api/resources/commons/errors/AgentNotFoundError.js → api/resources/commons/errors/NotFoundError.js} +3 -3
- package/api/resources/{conversation/errors/EmptyConversationError.d.ts → commons/errors/ServerError.d.ts} +1 -1
- package/api/resources/commons/errors/ServerError.js +14 -0
- package/api/resources/commons/errors/index.d.ts +3 -1
- package/api/resources/commons/errors/index.js +3 -1
- package/api/resources/commons/types/AppUser.d.ts +9 -0
- package/api/resources/commons/types/AppUserIdentifier.d.ts +9 -0
- package/api/resources/commons/types/AppUserIdentifyingPropertyType.d.ts +8 -0
- package/api/resources/commons/types/AppUserIdentifyingPropertyType.js +7 -0
- package/api/resources/commons/types/AppUserRequest.d.ts +26 -0
- package/api/resources/commons/types/AppUserResponse.d.ts +42 -0
- package/api/resources/commons/types/EntityId.d.ts +14 -0
- package/api/resources/commons/types/EntityIdBase.d.ts +10 -0
- package/api/resources/commons/types/EntityType.d.ts +16 -0
- package/api/resources/commons/types/EntityType.js +15 -0
- package/api/resources/commons/types/EventTriggerBase.d.ts +10 -0
- package/api/resources/commons/types/EventTriggerResponse.d.ts +22 -0
- package/api/resources/commons/types/EventTriggerResponse.js +4 -0
- package/api/resources/commons/types/EventTriggerType.d.ts +8 -0
- package/api/resources/commons/types/EventTriggerType.js +7 -0
- package/api/resources/commons/types/Feedback.d.ts +12 -0
- package/api/resources/commons/types/Feedback.js +4 -0
- package/api/resources/commons/types/FeedbackBase.d.ts +10 -0
- package/api/resources/commons/types/FeedbackBase.js +4 -0
- package/api/resources/{conversation → commons}/types/FeedbackType.d.ts +3 -1
- package/{dist/api/resources/conversation → api/resources/commons}/types/FeedbackType.js +2 -0
- package/api/resources/commons/types/UserData.d.ts +10 -0
- package/api/resources/commons/types/UserData.js +4 -0
- package/api/resources/commons/types/VisibilityType.d.ts +9 -0
- package/api/resources/commons/types/VisibilityType.js +8 -0
- package/api/resources/commons/types/index.d.ts +16 -1
- package/api/resources/commons/types/index.js +16 -1
- package/api/resources/conversation/client/Client.d.ts +136 -42
- package/api/resources/conversation/client/Client.js +451 -130
- package/api/resources/conversation/index.d.ts +0 -1
- package/api/resources/conversation/index.js +0 -1
- package/api/resources/conversation/types/ActionFormField.d.ts +1 -0
- package/api/resources/conversation/types/AskRequest.d.ts +15 -3
- package/api/resources/conversation/types/AskStreamActionEvent.d.ts +6 -0
- package/api/resources/conversation/types/AskStreamActionEvent.js +4 -0
- package/api/resources/conversation/types/AskStreamStartEvent.d.ts +2 -1
- package/api/resources/conversation/types/AskStreamTextEvent.d.ts +1 -0
- package/api/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
- package/api/resources/conversation/types/BotMessage.d.ts +2 -0
- package/api/resources/conversation/types/Capability.d.ts +18 -0
- package/api/resources/conversation/types/Capability.js +8 -0
- package/{dist/api/resources/knowledge/types/IdBody.d.ts → api/resources/conversation/types/CategorizationResponse.d.ts} +2 -2
- package/api/resources/conversation/types/CategorizationResponse.js +4 -0
- package/api/resources/conversation/types/ConversationAnalysis.d.ts +12 -0
- package/api/resources/conversation/types/ConversationAnalysis.js +4 -0
- package/api/resources/conversation/types/ConversationBase.d.ts +14 -4
- package/api/resources/conversation/types/ConversationMessageBase.d.ts +4 -5
- package/api/resources/conversation/types/ConversationMessageRequest.d.ts +3 -1
- package/api/resources/conversation/types/ConversationRequest.d.ts +2 -0
- package/api/resources/conversation/types/ConversationResponse.d.ts +4 -0
- package/api/resources/conversation/types/FeedbackRequest.d.ts +7 -7
- package/api/resources/conversation/types/GenerateMavenSuggestionsRequest.d.ts +2 -1
- package/api/resources/conversation/types/ResponseConfig.d.ts +12 -0
- package/api/resources/conversation/types/ResponseConfig.js +4 -0
- package/api/resources/conversation/types/ResponseLength.d.ts +9 -0
- package/api/resources/conversation/types/ResponseLength.js +8 -0
- package/api/resources/conversation/types/Sentiment.d.ts +14 -0
- package/api/resources/conversation/types/Sentiment.js +10 -0
- package/api/resources/conversation/types/StreamResponse.d.ts +4 -1
- package/api/resources/conversation/types/SubmitActionFormRequest.d.ts +8 -0
- package/api/resources/conversation/types/SubmitActionFormRequest.js +4 -0
- package/api/resources/conversation/types/UserMessage.d.ts +3 -3
- package/api/resources/conversation/types/UserMessageBase.d.ts +11 -0
- package/api/resources/conversation/types/UserMessageBase.js +4 -0
- package/api/resources/conversation/types/index.d.ts +9 -3
- package/api/resources/conversation/types/index.js +9 -3
- package/api/resources/index.d.ts +6 -2
- package/api/resources/index.js +6 -2
- package/api/resources/knowledge/client/Client.d.ts +85 -73
- package/api/resources/knowledge/client/Client.js +233 -175
- package/api/resources/knowledge/index.d.ts +0 -1
- package/api/resources/knowledge/index.js +0 -1
- package/{dist/api/resources/knowledge/types/KnowledgeDocument.d.ts → api/resources/knowledge/types/BaseKnowledgeDocument.d.ts} +2 -5
- package/api/resources/knowledge/types/BaseKnowledgeDocument.js +4 -0
- package/api/resources/knowledge/types/{KnowledgeBase.d.ts → KnowledgeBaseProperties.d.ts} +3 -3
- package/api/resources/knowledge/types/KnowledgeBaseProperties.js +4 -0
- package/api/resources/knowledge/types/KnowledgeBaseRequest.d.ts +18 -0
- package/api/resources/knowledge/types/KnowledgeBaseRequest.js +4 -0
- package/api/resources/knowledge/types/KnowledgeBaseResponse.d.ts +22 -0
- package/api/resources/knowledge/types/KnowledgeBaseResponse.js +4 -0
- package/api/resources/knowledge/types/KnowledgeBaseType.d.ts +1 -1
- package/api/resources/knowledge/types/KnowledgeBaseVersion.d.ts +7 -3
- package/api/resources/knowledge/types/KnowledgeDocumentContentType.d.ts +11 -0
- package/api/resources/knowledge/types/KnowledgeDocumentContentType.js +7 -0
- package/api/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +22 -0
- package/api/resources/knowledge/types/KnowledgeDocumentRequest.js +4 -0
- package/api/resources/knowledge/types/KnowledgeDocumentResponse.d.ts +24 -0
- package/api/resources/knowledge/types/KnowledgeDocumentResponse.js +4 -0
- package/api/resources/knowledge/types/index.d.ts +7 -5
- package/api/resources/knowledge/types/index.js +7 -5
- package/api/resources/triggers/client/Client.d.ts +83 -0
- package/api/resources/triggers/client/Client.js +303 -0
- package/api/resources/triggers/client/index.d.ts +1 -0
- package/api/resources/triggers/client/index.js +1 -0
- package/api/resources/triggers/index.d.ts +2 -0
- package/api/resources/triggers/index.js +2 -0
- package/api/resources/triggers/types/EventTriggerRequest.d.ts +18 -0
- package/api/resources/triggers/types/EventTriggerRequest.js +4 -0
- package/api/resources/triggers/types/index.d.ts +1 -0
- package/api/resources/triggers/types/index.js +1 -0
- package/api/resources/users/client/Client.d.ts +77 -0
- package/api/resources/users/client/Client.js +228 -0
- package/api/resources/users/client/index.d.ts +1 -0
- package/api/resources/users/client/index.js +1 -0
- package/api/resources/users/index.d.ts +1 -0
- package/api/resources/users/index.js +1 -0
- package/core/fetcher/Fetcher.d.ts +4 -1
- package/core/fetcher/Fetcher.js +18 -159
- package/core/fetcher/createRequestUrl.d.ts +1 -0
- package/core/fetcher/createRequestUrl.js +6 -0
- package/core/fetcher/getFetchFn.d.ts +4 -0
- package/core/fetcher/getFetchFn.js +32 -0
- package/core/fetcher/getRequestBody.d.ts +7 -0
- package/core/fetcher/getRequestBody.js +19 -0
- package/core/fetcher/getResponseBody.d.ts +1 -0
- package/core/fetcher/getResponseBody.js +48 -0
- package/core/fetcher/makeRequest.d.ts +1 -0
- package/core/fetcher/makeRequest.js +38 -0
- package/core/fetcher/requestWithRetries.d.ts +1 -0
- package/core/fetcher/requestWithRetries.js +28 -0
- package/core/fetcher/signals.d.ts +12 -0
- package/core/fetcher/signals.js +32 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +222 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +104 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +204 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +17 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +23 -0
- package/core/index.d.ts +1 -1
- package/core/index.js +1 -1
- package/core/runtime/runtime.d.ts +1 -0
- package/core/runtime/runtime.js +1 -0
- package/core/schemas/Schema.d.ts +7 -4
- package/core/schemas/builders/lazy/lazy.d.ts +2 -2
- package/core/schemas/builders/lazy/lazy.js +8 -19
- package/core/schemas/builders/lazy/lazyObject.js +1 -10
- package/core/schemas/builders/list/list.js +31 -44
- package/core/schemas/builders/object/object.js +90 -111
- package/core/schemas/builders/object/types.d.ts +2 -2
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
- package/core/schemas/builders/record/record.js +49 -60
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
- package/core/schemas/builders/set/set.js +6 -15
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
- package/core/schemas/builders/union/union.js +51 -62
- package/core/schemas/utils/maybeSkipValidation.js +3 -12
- package/dist/Client.d.ts +21 -0
- package/dist/Client.js +20 -0
- package/dist/api/resources/actions/client/Client.d.ts +96 -0
- package/dist/api/resources/actions/client/Client.js +316 -0
- package/dist/api/resources/actions/client/index.d.ts +1 -0
- package/dist/api/resources/actions/client/index.js +1 -0
- package/dist/api/resources/actions/index.d.ts +2 -0
- package/dist/api/resources/actions/index.js +2 -0
- package/dist/api/resources/actions/types/ActionBase.d.ts +18 -0
- package/dist/api/resources/actions/types/ActionBase.js +4 -0
- package/dist/api/resources/actions/types/ActionParameter.d.ts +9 -0
- package/dist/api/resources/actions/types/ActionParameter.js +4 -0
- package/dist/api/resources/actions/types/ActionRequest.d.ts +31 -0
- package/dist/api/resources/actions/types/ActionRequest.js +4 -0
- package/dist/api/resources/actions/types/ActionResponse.d.ts +35 -0
- package/dist/api/resources/actions/types/ActionResponse.js +4 -0
- package/dist/api/resources/actions/types/ConversationExecutedActionPrecondition.d.ts +12 -0
- package/dist/api/resources/actions/types/ConversationExecutedActionPrecondition.js +4 -0
- package/dist/api/resources/actions/types/ConversationPrecondition.d.ts +20 -0
- package/dist/api/resources/actions/types/ConversationPrecondition.js +4 -0
- package/dist/api/resources/actions/types/MetadataPrecondition.d.ts +12 -0
- package/dist/api/resources/actions/types/MetadataPrecondition.js +4 -0
- package/dist/api/resources/actions/types/Precondition.d.ts +31 -0
- package/dist/api/resources/actions/types/Precondition.js +4 -0
- package/dist/api/resources/actions/types/PreconditionGroup.d.ts +8 -0
- package/dist/api/resources/actions/types/PreconditionGroup.js +4 -0
- package/dist/api/resources/actions/types/PreconditionGroupOperator.d.ts +8 -0
- package/dist/api/resources/actions/types/PreconditionGroupOperator.js +7 -0
- package/dist/api/resources/actions/types/PreconditionOperator.d.ts +7 -0
- package/dist/api/resources/actions/types/PreconditionOperator.js +6 -0
- package/dist/api/resources/actions/types/index.d.ts +11 -0
- package/dist/api/resources/actions/types/index.js +11 -0
- package/dist/api/resources/appSettings/client/Client.d.ts +47 -0
- package/dist/api/resources/appSettings/client/Client.js +124 -0
- package/dist/api/resources/appSettings/client/index.d.ts +1 -0
- package/dist/api/resources/appSettings/client/index.js +1 -0
- package/dist/api/resources/appSettings/index.d.ts +1 -0
- package/dist/api/resources/appSettings/index.js +1 -0
- package/dist/api/resources/{conversation/errors/EmptyConversationError.d.ts → commons/errors/BadRequestError.d.ts} +1 -1
- package/dist/api/resources/{knowledge/errors/VersionInProgressError.js → commons/errors/BadRequestError.js} +3 -3
- package/dist/api/resources/commons/errors/NotFoundError.d.ts +8 -0
- package/{api/resources/commons/errors/AgentNotFoundError.js → dist/api/resources/commons/errors/NotFoundError.js} +3 -3
- package/dist/api/resources/commons/errors/ServerError.d.ts +8 -0
- package/dist/api/resources/commons/errors/ServerError.js +14 -0
- package/dist/api/resources/commons/errors/index.d.ts +3 -1
- package/dist/api/resources/commons/errors/index.js +3 -1
- package/dist/api/resources/commons/types/AppUser.d.ts +9 -0
- package/dist/api/resources/commons/types/AppUser.js +4 -0
- package/dist/api/resources/commons/types/AppUserIdentifier.d.ts +9 -0
- package/dist/api/resources/commons/types/AppUserIdentifier.js +4 -0
- package/dist/api/resources/commons/types/AppUserIdentifyingPropertyType.d.ts +8 -0
- package/dist/api/resources/commons/types/AppUserIdentifyingPropertyType.js +7 -0
- package/dist/api/resources/commons/types/AppUserRequest.d.ts +26 -0
- package/dist/api/resources/commons/types/AppUserRequest.js +4 -0
- package/dist/api/resources/commons/types/AppUserResponse.d.ts +42 -0
- package/dist/api/resources/commons/types/AppUserResponse.js +4 -0
- package/dist/api/resources/commons/types/EntityId.d.ts +14 -0
- package/dist/api/resources/commons/types/EntityId.js +4 -0
- package/dist/api/resources/commons/types/EntityIdBase.d.ts +10 -0
- package/dist/api/resources/commons/types/EntityIdBase.js +4 -0
- package/dist/api/resources/commons/types/EntityType.d.ts +16 -0
- package/dist/api/resources/commons/types/EntityType.js +15 -0
- package/dist/api/resources/commons/types/EventTriggerBase.d.ts +10 -0
- package/dist/api/resources/commons/types/EventTriggerBase.js +4 -0
- package/dist/api/resources/commons/types/EventTriggerResponse.d.ts +22 -0
- package/dist/api/resources/commons/types/EventTriggerResponse.js +4 -0
- package/dist/api/resources/commons/types/EventTriggerType.d.ts +8 -0
- package/dist/api/resources/commons/types/EventTriggerType.js +7 -0
- package/dist/api/resources/commons/types/Feedback.d.ts +12 -0
- package/dist/api/resources/commons/types/Feedback.js +4 -0
- package/dist/api/resources/commons/types/FeedbackBase.d.ts +10 -0
- package/dist/api/resources/commons/types/FeedbackBase.js +4 -0
- package/dist/api/resources/{conversation → commons}/types/FeedbackType.d.ts +3 -1
- package/{api/resources/conversation → dist/api/resources/commons}/types/FeedbackType.js +2 -0
- package/dist/api/resources/commons/types/UserData.d.ts +10 -0
- package/dist/api/resources/commons/types/UserData.js +4 -0
- package/dist/api/resources/commons/types/VisibilityType.d.ts +9 -0
- package/dist/api/resources/commons/types/VisibilityType.js +8 -0
- package/dist/api/resources/commons/types/index.d.ts +16 -1
- package/dist/api/resources/commons/types/index.js +16 -1
- package/dist/api/resources/conversation/client/Client.d.ts +136 -42
- package/dist/api/resources/conversation/client/Client.js +451 -130
- package/dist/api/resources/conversation/index.d.ts +0 -1
- package/dist/api/resources/conversation/index.js +0 -1
- package/dist/api/resources/conversation/types/ActionFormField.d.ts +1 -0
- package/dist/api/resources/conversation/types/AskRequest.d.ts +15 -3
- package/dist/api/resources/conversation/types/AskStreamActionEvent.d.ts +6 -0
- package/dist/api/resources/conversation/types/AskStreamActionEvent.js +4 -0
- package/dist/api/resources/conversation/types/AskStreamStartEvent.d.ts +2 -1
- package/dist/api/resources/conversation/types/AskStreamTextEvent.d.ts +1 -0
- package/dist/api/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
- package/dist/api/resources/conversation/types/BotMessage.d.ts +2 -0
- package/dist/api/resources/conversation/types/Capability.d.ts +18 -0
- package/dist/api/resources/conversation/types/Capability.js +8 -0
- package/dist/api/resources/conversation/types/CategorizationResponse.d.ts +6 -0
- package/dist/api/resources/conversation/types/CategorizationResponse.js +4 -0
- package/dist/api/resources/conversation/types/ConversationAnalysis.d.ts +12 -0
- package/dist/api/resources/conversation/types/ConversationAnalysis.js +4 -0
- package/dist/api/resources/conversation/types/ConversationBase.d.ts +14 -4
- package/dist/api/resources/conversation/types/ConversationMessageBase.d.ts +4 -5
- package/dist/api/resources/conversation/types/ConversationMessageRequest.d.ts +3 -1
- package/dist/api/resources/conversation/types/ConversationRequest.d.ts +2 -0
- package/dist/api/resources/conversation/types/ConversationResponse.d.ts +4 -0
- package/dist/api/resources/conversation/types/FeedbackRequest.d.ts +7 -7
- package/dist/api/resources/conversation/types/GenerateMavenSuggestionsRequest.d.ts +2 -1
- package/dist/api/resources/conversation/types/ResponseConfig.d.ts +12 -0
- package/dist/api/resources/conversation/types/ResponseConfig.js +4 -0
- package/dist/api/resources/conversation/types/ResponseLength.d.ts +9 -0
- package/dist/api/resources/conversation/types/ResponseLength.js +8 -0
- package/dist/api/resources/conversation/types/Sentiment.d.ts +14 -0
- package/dist/api/resources/conversation/types/Sentiment.js +10 -0
- package/dist/api/resources/conversation/types/StreamResponse.d.ts +4 -1
- package/dist/api/resources/conversation/types/SubmitActionFormRequest.d.ts +8 -0
- package/dist/api/resources/conversation/types/SubmitActionFormRequest.js +4 -0
- package/dist/api/resources/conversation/types/UserMessage.d.ts +3 -3
- package/dist/api/resources/conversation/types/UserMessageBase.d.ts +11 -0
- package/dist/api/resources/conversation/types/UserMessageBase.js +4 -0
- package/dist/api/resources/conversation/types/index.d.ts +9 -3
- package/dist/api/resources/conversation/types/index.js +9 -3
- package/dist/api/resources/index.d.ts +6 -2
- package/dist/api/resources/index.js +6 -2
- package/dist/api/resources/knowledge/client/Client.d.ts +85 -73
- package/dist/api/resources/knowledge/client/Client.js +233 -175
- package/dist/api/resources/knowledge/index.d.ts +0 -1
- package/dist/api/resources/knowledge/index.js +0 -1
- package/{api/resources/knowledge/types/KnowledgeDocument.d.ts → dist/api/resources/knowledge/types/BaseKnowledgeDocument.d.ts} +2 -5
- package/dist/api/resources/knowledge/types/BaseKnowledgeDocument.js +4 -0
- package/dist/api/resources/knowledge/types/{KnowledgeBase.d.ts → KnowledgeBaseProperties.d.ts} +3 -3
- package/dist/api/resources/knowledge/types/KnowledgeBaseProperties.js +4 -0
- package/dist/api/resources/knowledge/types/KnowledgeBaseRequest.d.ts +18 -0
- package/dist/api/resources/knowledge/types/KnowledgeBaseRequest.js +4 -0
- package/dist/api/resources/knowledge/types/KnowledgeBaseResponse.d.ts +22 -0
- package/dist/api/resources/knowledge/types/KnowledgeBaseResponse.js +4 -0
- package/dist/api/resources/knowledge/types/KnowledgeBaseType.d.ts +1 -1
- package/dist/api/resources/knowledge/types/KnowledgeBaseVersion.d.ts +7 -3
- package/dist/api/resources/knowledge/types/KnowledgeDocumentContentType.d.ts +11 -0
- package/dist/api/resources/knowledge/types/KnowledgeDocumentContentType.js +7 -0
- package/dist/api/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +22 -0
- package/dist/api/resources/knowledge/types/KnowledgeDocumentRequest.js +4 -0
- package/dist/api/resources/knowledge/types/KnowledgeDocumentResponse.d.ts +24 -0
- package/dist/api/resources/knowledge/types/KnowledgeDocumentResponse.js +4 -0
- package/dist/api/resources/knowledge/types/index.d.ts +7 -5
- package/dist/api/resources/knowledge/types/index.js +7 -5
- package/dist/api/resources/triggers/client/Client.d.ts +83 -0
- package/dist/api/resources/triggers/client/Client.js +303 -0
- package/dist/api/resources/triggers/client/index.d.ts +1 -0
- package/dist/api/resources/triggers/client/index.js +1 -0
- package/dist/api/resources/triggers/index.d.ts +2 -0
- package/dist/api/resources/triggers/index.js +2 -0
- package/dist/api/resources/triggers/types/EventTriggerRequest.d.ts +18 -0
- package/dist/api/resources/triggers/types/EventTriggerRequest.js +4 -0
- package/dist/api/resources/triggers/types/index.d.ts +1 -0
- package/dist/api/resources/triggers/types/index.js +1 -0
- package/dist/api/resources/users/client/Client.d.ts +77 -0
- package/dist/api/resources/users/client/Client.js +228 -0
- package/dist/api/resources/users/client/index.d.ts +1 -0
- package/dist/api/resources/users/client/index.js +1 -0
- package/dist/api/resources/users/index.d.ts +1 -0
- package/dist/api/resources/users/index.js +1 -0
- package/dist/core/fetcher/Fetcher.d.ts +4 -1
- package/dist/core/fetcher/Fetcher.js +18 -159
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +6 -0
- package/dist/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/core/fetcher/getFetchFn.js +32 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +19 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +48 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +38 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +28 -0
- package/dist/core/fetcher/signals.d.ts +12 -0
- package/dist/core/fetcher/signals.js +32 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +222 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +104 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +204 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +17 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +23 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/runtime/runtime.d.ts +1 -0
- package/dist/core/runtime/runtime.js +1 -0
- package/dist/core/schemas/Schema.d.ts +7 -4
- package/dist/core/schemas/builders/lazy/lazy.d.ts +2 -2
- package/dist/core/schemas/builders/lazy/lazy.js +8 -19
- package/dist/core/schemas/builders/lazy/lazyObject.js +1 -10
- package/dist/core/schemas/builders/list/list.js +31 -44
- package/dist/core/schemas/builders/object/object.js +90 -111
- package/dist/core/schemas/builders/object/types.d.ts +2 -2
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
- package/dist/core/schemas/builders/record/record.js +49 -60
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
- package/dist/core/schemas/builders/set/set.js +6 -15
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
- package/dist/core/schemas/builders/union/union.js +51 -62
- package/dist/core/schemas/utils/maybeSkipValidation.js +3 -12
- package/dist/serialization/resources/actions/index.d.ts +1 -0
- package/dist/serialization/resources/actions/index.js +1 -0
- package/dist/serialization/resources/actions/types/ActionBase.d.ts +18 -0
- package/dist/serialization/resources/actions/types/ActionBase.js +14 -0
- package/dist/serialization/resources/actions/types/ActionParameter.d.ts +15 -0
- package/dist/serialization/resources/actions/types/ActionParameter.js +10 -0
- package/dist/serialization/resources/actions/types/ActionRequest.d.ts +14 -0
- package/dist/serialization/resources/actions/types/ActionRequest.js +11 -0
- package/dist/serialization/resources/actions/types/ActionResponse.d.ts +14 -0
- package/dist/serialization/resources/actions/types/ActionResponse.js +11 -0
- package/dist/serialization/resources/actions/types/ConversationExecutedActionPrecondition.d.ts +15 -0
- package/dist/serialization/resources/actions/types/ConversationExecutedActionPrecondition.js +10 -0
- package/dist/serialization/resources/actions/types/ConversationPrecondition.d.ts +22 -0
- package/dist/serialization/resources/actions/types/ConversationPrecondition.js +18 -0
- package/dist/serialization/resources/actions/types/MetadataPrecondition.d.ts +15 -0
- package/dist/serialization/resources/actions/types/MetadataPrecondition.js +10 -0
- package/dist/serialization/resources/actions/types/Precondition.d.ts +22 -0
- package/dist/serialization/resources/actions/types/Precondition.js +19 -0
- package/dist/serialization/resources/actions/types/PreconditionGroup.d.ts +14 -0
- package/dist/serialization/resources/actions/types/PreconditionGroup.js +10 -0
- package/dist/serialization/resources/actions/types/PreconditionGroupOperator.d.ts +10 -0
- package/dist/serialization/resources/actions/types/PreconditionGroupOperator.js +5 -0
- package/dist/serialization/resources/actions/types/PreconditionOperator.d.ts +10 -0
- package/dist/serialization/resources/actions/types/PreconditionOperator.js +5 -0
- package/dist/serialization/resources/actions/types/index.d.ts +11 -0
- package/dist/serialization/resources/actions/types/index.js +11 -0
- package/dist/serialization/resources/appSettings/client/get.d.ts +9 -0
- package/dist/serialization/resources/appSettings/client/get.js +5 -0
- package/dist/serialization/resources/appSettings/client/index.d.ts +1 -0
- package/dist/serialization/resources/appSettings/client/index.js +1 -0
- package/dist/serialization/resources/appSettings/index.d.ts +1 -0
- package/dist/serialization/resources/appSettings/index.js +1 -0
- package/dist/serialization/resources/commons/types/AppUser.d.ts +15 -0
- package/dist/serialization/resources/commons/types/AppUser.js +10 -0
- package/dist/serialization/resources/commons/types/AppUserIdentifier.d.ts +14 -0
- package/dist/serialization/resources/commons/types/AppUserIdentifier.js +9 -0
- package/dist/serialization/resources/commons/types/AppUserIdentifyingPropertyType.d.ts +10 -0
- package/dist/serialization/resources/commons/types/AppUserIdentifyingPropertyType.js +5 -0
- package/dist/serialization/resources/commons/types/AppUserRequest.d.ts +14 -0
- package/dist/serialization/resources/commons/types/AppUserRequest.js +11 -0
- package/dist/serialization/resources/commons/types/AppUserResponse.d.ts +16 -0
- package/dist/serialization/resources/commons/types/AppUserResponse.js +13 -0
- package/dist/serialization/resources/commons/types/EntityId.d.ts +17 -0
- package/dist/serialization/resources/commons/types/EntityId.js +14 -0
- package/{serialization/resources/knowledge/types/IdBody.d.ts → dist/serialization/resources/commons/types/EntityIdBase.d.ts} +3 -3
- package/dist/serialization/resources/{knowledge/types/IdBody.js → commons/types/EntityIdBase.js} +2 -2
- package/dist/serialization/resources/commons/types/EntityType.d.ts +10 -0
- package/dist/serialization/resources/commons/types/EntityType.js +16 -0
- package/dist/serialization/resources/commons/types/EventTriggerBase.d.ts +14 -0
- package/dist/serialization/resources/commons/types/EventTriggerBase.js +9 -0
- package/dist/serialization/resources/commons/types/EventTriggerResponse.d.ts +14 -0
- package/dist/serialization/resources/commons/types/EventTriggerResponse.js +11 -0
- package/dist/serialization/resources/commons/types/EventTriggerType.d.ts +10 -0
- package/dist/serialization/resources/commons/types/EventTriggerType.js +5 -0
- package/dist/serialization/resources/commons/types/Feedback.d.ts +16 -0
- package/dist/serialization/resources/commons/types/Feedback.js +13 -0
- package/dist/serialization/resources/commons/types/FeedbackBase.d.ts +14 -0
- package/dist/serialization/resources/commons/types/FeedbackBase.js +9 -0
- package/{serialization/resources/conversation → dist/serialization/resources/commons}/types/FeedbackType.d.ts +1 -1
- package/dist/serialization/resources/{conversation → commons}/types/FeedbackType.js +1 -1
- package/dist/serialization/resources/commons/types/UserData.d.ts +14 -0
- package/dist/serialization/resources/commons/types/UserData.js +9 -0
- package/dist/serialization/resources/commons/types/VisibilityType.d.ts +10 -0
- package/dist/serialization/resources/commons/types/VisibilityType.js +5 -0
- package/dist/serialization/resources/commons/types/index.d.ts +16 -1
- package/dist/serialization/resources/commons/types/index.js +16 -1
- package/dist/serialization/resources/conversation/client/addConversationMetadata.d.ts +13 -0
- package/dist/serialization/resources/conversation/client/addConversationMetadata.js +6 -0
- package/dist/serialization/resources/conversation/client/index.d.ts +1 -0
- package/dist/serialization/resources/conversation/client/index.js +1 -0
- package/dist/serialization/resources/conversation/types/ActionFormField.d.ts +1 -0
- package/dist/serialization/resources/conversation/types/ActionFormField.js +1 -0
- package/dist/serialization/resources/conversation/types/AskRequest.d.ts +3 -3
- package/dist/serialization/resources/conversation/types/AskRequest.js +3 -3
- package/dist/serialization/resources/conversation/types/AskStreamActionEvent.d.ts +12 -0
- package/dist/serialization/resources/conversation/types/AskStreamActionEvent.js +6 -0
- package/dist/serialization/resources/conversation/types/AskStreamStartEvent.d.ts +2 -1
- package/dist/serialization/resources/conversation/types/AskStreamStartEvent.js +2 -1
- package/dist/serialization/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
- package/dist/serialization/resources/conversation/types/BotActionFormResponse.js +1 -0
- package/dist/serialization/resources/conversation/types/BotMessage.d.ts +2 -0
- package/dist/serialization/resources/conversation/types/BotMessage.js +2 -0
- package/dist/serialization/resources/conversation/types/Capability.d.ts +10 -0
- package/dist/serialization/resources/conversation/types/Capability.js +5 -0
- package/dist/serialization/resources/{commons/types/User.d.ts → conversation/types/CategorizationResponse.d.ts} +3 -5
- package/dist/serialization/resources/conversation/types/CategorizationResponse.js +7 -0
- package/dist/serialization/resources/conversation/types/ConversationAnalysis.d.ts +15 -0
- package/dist/serialization/resources/conversation/types/ConversationAnalysis.js +10 -0
- package/dist/serialization/resources/conversation/types/ConversationBase.d.ts +8 -3
- package/dist/serialization/resources/conversation/types/ConversationBase.js +8 -3
- package/dist/serialization/resources/conversation/types/ConversationMessageBase.d.ts +2 -3
- package/dist/serialization/resources/conversation/types/ConversationMessageBase.js +2 -3
- package/dist/serialization/resources/conversation/types/ConversationMessageRequest.d.ts +4 -2
- package/dist/serialization/resources/conversation/types/ConversationMessageRequest.js +7 -2
- package/dist/serialization/resources/conversation/types/ConversationRequest.d.ts +2 -0
- package/dist/serialization/resources/conversation/types/ConversationRequest.js +2 -0
- package/dist/serialization/resources/conversation/types/ConversationResponse.d.ts +4 -0
- package/dist/serialization/resources/conversation/types/ConversationResponse.js +4 -0
- package/dist/serialization/resources/conversation/types/FeedbackRequest.d.ts +6 -5
- package/dist/serialization/resources/conversation/types/FeedbackRequest.js +9 -6
- package/dist/serialization/resources/conversation/types/GenerateMavenSuggestionsRequest.d.ts +2 -1
- package/dist/serialization/resources/conversation/types/GenerateMavenSuggestionsRequest.js +2 -1
- package/dist/serialization/resources/conversation/types/ResponseConfig.d.ts +16 -0
- package/dist/serialization/resources/conversation/types/ResponseConfig.js +11 -0
- package/dist/serialization/resources/conversation/types/ResponseLength.d.ts +10 -0
- package/dist/serialization/resources/conversation/types/ResponseLength.js +5 -0
- package/dist/serialization/resources/conversation/types/Sentiment.d.ts +10 -0
- package/dist/serialization/resources/conversation/types/Sentiment.js +5 -0
- package/dist/serialization/resources/conversation/types/StreamResponse.d.ts +5 -1
- package/dist/serialization/resources/conversation/types/StreamResponse.js +2 -0
- package/dist/serialization/resources/conversation/types/SubmitActionFormRequest.d.ts +13 -0
- package/dist/serialization/resources/conversation/types/SubmitActionFormRequest.js +8 -0
- package/dist/serialization/resources/conversation/types/UserMessage.d.ts +4 -5
- package/dist/serialization/resources/conversation/types/UserMessage.js +4 -5
- package/dist/serialization/resources/conversation/types/UserMessageBase.d.ts +17 -0
- package/dist/serialization/resources/conversation/types/UserMessageBase.js +14 -0
- package/dist/serialization/resources/conversation/types/index.d.ts +9 -3
- package/dist/serialization/resources/conversation/types/index.js +9 -3
- package/dist/serialization/resources/index.d.ts +5 -0
- package/dist/serialization/resources/index.js +5 -0
- package/dist/serialization/resources/knowledge/types/{KnowledgeDocument.d.ts → BaseKnowledgeDocument.d.ts} +3 -5
- package/{serialization/resources/knowledge/types/KnowledgeDocument.js → dist/serialization/resources/knowledge/types/BaseKnowledgeDocument.js} +2 -6
- package/{serialization/resources/knowledge/types/KnowledgeBase.d.ts → dist/serialization/resources/knowledge/types/KnowledgeBaseProperties.d.ts} +4 -5
- package/dist/serialization/resources/knowledge/types/{KnowledgeBase.js → KnowledgeBaseProperties.js} +3 -6
- package/dist/serialization/resources/knowledge/types/KnowledgeBaseRequest.d.ts +14 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeBaseRequest.js +11 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeBaseResponse.d.ts +14 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeBaseResponse.js +11 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeBaseVersion.d.ts +0 -1
- package/dist/serialization/resources/knowledge/types/KnowledgeBaseVersion.js +0 -1
- package/dist/serialization/resources/knowledge/types/KnowledgeDocumentContentType.d.ts +10 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeDocumentContentType.js +5 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +17 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeDocumentRequest.js +14 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeDocumentResponse.d.ts +15 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeDocumentResponse.js +12 -0
- package/dist/serialization/resources/knowledge/types/index.d.ts +7 -5
- package/dist/serialization/resources/knowledge/types/index.js +7 -5
- package/dist/serialization/resources/triggers/index.d.ts +1 -0
- package/dist/serialization/resources/triggers/index.js +1 -0
- package/dist/serialization/resources/triggers/types/EventTriggerRequest.d.ts +14 -0
- package/dist/serialization/resources/triggers/types/EventTriggerRequest.js +11 -0
- package/dist/serialization/resources/triggers/types/index.d.ts +1 -0
- package/dist/serialization/resources/triggers/types/index.js +1 -0
- package/package.json +7 -2
- package/reference.md +1863 -0
- package/serialization/resources/actions/index.d.ts +1 -0
- package/serialization/resources/actions/index.js +1 -0
- package/serialization/resources/actions/types/ActionBase.d.ts +18 -0
- package/serialization/resources/actions/types/ActionBase.js +14 -0
- package/serialization/resources/actions/types/ActionParameter.d.ts +15 -0
- package/serialization/resources/actions/types/ActionParameter.js +10 -0
- package/serialization/resources/actions/types/ActionRequest.d.ts +14 -0
- package/serialization/resources/actions/types/ActionRequest.js +11 -0
- package/serialization/resources/actions/types/ActionResponse.d.ts +14 -0
- package/serialization/resources/actions/types/ActionResponse.js +11 -0
- package/serialization/resources/actions/types/ConversationExecutedActionPrecondition.d.ts +15 -0
- package/serialization/resources/actions/types/ConversationExecutedActionPrecondition.js +10 -0
- package/serialization/resources/actions/types/ConversationPrecondition.d.ts +22 -0
- package/serialization/resources/actions/types/ConversationPrecondition.js +18 -0
- package/serialization/resources/actions/types/MetadataPrecondition.d.ts +15 -0
- package/serialization/resources/actions/types/MetadataPrecondition.js +10 -0
- package/serialization/resources/actions/types/Precondition.d.ts +22 -0
- package/serialization/resources/actions/types/Precondition.js +19 -0
- package/serialization/resources/actions/types/PreconditionGroup.d.ts +14 -0
- package/serialization/resources/actions/types/PreconditionGroup.js +10 -0
- package/serialization/resources/actions/types/PreconditionGroupOperator.d.ts +10 -0
- package/serialization/resources/actions/types/PreconditionGroupOperator.js +5 -0
- package/serialization/resources/actions/types/PreconditionOperator.d.ts +10 -0
- package/serialization/resources/actions/types/PreconditionOperator.js +5 -0
- package/serialization/resources/actions/types/index.d.ts +11 -0
- package/serialization/resources/actions/types/index.js +11 -0
- package/serialization/resources/appSettings/client/get.d.ts +9 -0
- package/serialization/resources/appSettings/client/get.js +5 -0
- package/serialization/resources/appSettings/client/index.d.ts +1 -0
- package/serialization/resources/appSettings/client/index.js +1 -0
- package/serialization/resources/appSettings/index.d.ts +1 -0
- package/serialization/resources/appSettings/index.js +1 -0
- package/serialization/resources/commons/types/AppUser.d.ts +15 -0
- package/serialization/resources/commons/types/AppUser.js +10 -0
- package/serialization/resources/commons/types/AppUserIdentifier.d.ts +14 -0
- package/serialization/resources/commons/types/AppUserIdentifier.js +9 -0
- package/serialization/resources/commons/types/AppUserIdentifyingPropertyType.d.ts +10 -0
- package/serialization/resources/commons/types/AppUserIdentifyingPropertyType.js +5 -0
- package/serialization/resources/commons/types/AppUserRequest.d.ts +14 -0
- package/serialization/resources/commons/types/AppUserRequest.js +11 -0
- package/serialization/resources/commons/types/AppUserResponse.d.ts +16 -0
- package/serialization/resources/commons/types/AppUserResponse.js +13 -0
- package/serialization/resources/commons/types/EntityId.d.ts +17 -0
- package/serialization/resources/commons/types/EntityId.js +14 -0
- package/{dist/serialization/resources/knowledge/types/IdBody.d.ts → serialization/resources/commons/types/EntityIdBase.d.ts} +3 -3
- package/serialization/resources/{knowledge/types/IdBody.js → commons/types/EntityIdBase.js} +2 -2
- package/serialization/resources/commons/types/EntityType.d.ts +10 -0
- package/serialization/resources/commons/types/EntityType.js +16 -0
- package/serialization/resources/commons/types/EventTriggerBase.d.ts +14 -0
- package/serialization/resources/commons/types/EventTriggerBase.js +9 -0
- package/serialization/resources/commons/types/EventTriggerResponse.d.ts +14 -0
- package/serialization/resources/commons/types/EventTriggerResponse.js +11 -0
- package/serialization/resources/commons/types/EventTriggerType.d.ts +10 -0
- package/serialization/resources/commons/types/EventTriggerType.js +5 -0
- package/serialization/resources/commons/types/Feedback.d.ts +16 -0
- package/serialization/resources/commons/types/Feedback.js +13 -0
- package/serialization/resources/commons/types/FeedbackBase.d.ts +14 -0
- package/serialization/resources/commons/types/FeedbackBase.js +9 -0
- package/{dist/serialization/resources/conversation → serialization/resources/commons}/types/FeedbackType.d.ts +1 -1
- package/serialization/resources/{conversation → commons}/types/FeedbackType.js +1 -1
- package/serialization/resources/commons/types/UserData.d.ts +14 -0
- package/serialization/resources/commons/types/UserData.js +9 -0
- package/serialization/resources/commons/types/VisibilityType.d.ts +10 -0
- package/serialization/resources/commons/types/VisibilityType.js +5 -0
- package/serialization/resources/commons/types/index.d.ts +16 -1
- package/serialization/resources/commons/types/index.js +16 -1
- package/serialization/resources/conversation/client/addConversationMetadata.d.ts +13 -0
- package/serialization/resources/conversation/client/addConversationMetadata.js +6 -0
- package/serialization/resources/conversation/client/index.d.ts +1 -0
- package/serialization/resources/conversation/client/index.js +1 -0
- package/serialization/resources/conversation/types/ActionFormField.d.ts +1 -0
- package/serialization/resources/conversation/types/ActionFormField.js +1 -0
- package/serialization/resources/conversation/types/AskRequest.d.ts +3 -3
- package/serialization/resources/conversation/types/AskRequest.js +3 -3
- package/serialization/resources/conversation/types/AskStreamActionEvent.d.ts +12 -0
- package/serialization/resources/conversation/types/AskStreamActionEvent.js +6 -0
- package/serialization/resources/conversation/types/AskStreamStartEvent.d.ts +2 -1
- package/serialization/resources/conversation/types/AskStreamStartEvent.js +2 -1
- package/serialization/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
- package/serialization/resources/conversation/types/BotActionFormResponse.js +1 -0
- package/serialization/resources/conversation/types/BotMessage.d.ts +2 -0
- package/serialization/resources/conversation/types/BotMessage.js +2 -0
- package/serialization/resources/conversation/types/Capability.d.ts +10 -0
- package/serialization/resources/conversation/types/Capability.js +5 -0
- package/serialization/resources/{commons/types/User.d.ts → conversation/types/CategorizationResponse.d.ts} +3 -5
- package/serialization/resources/conversation/types/CategorizationResponse.js +7 -0
- package/serialization/resources/conversation/types/ConversationAnalysis.d.ts +15 -0
- package/serialization/resources/conversation/types/ConversationAnalysis.js +10 -0
- package/serialization/resources/conversation/types/ConversationBase.d.ts +8 -3
- package/serialization/resources/conversation/types/ConversationBase.js +8 -3
- package/serialization/resources/conversation/types/ConversationMessageBase.d.ts +2 -3
- package/serialization/resources/conversation/types/ConversationMessageBase.js +2 -3
- package/serialization/resources/conversation/types/ConversationMessageRequest.d.ts +4 -2
- package/serialization/resources/conversation/types/ConversationMessageRequest.js +7 -2
- package/serialization/resources/conversation/types/ConversationRequest.d.ts +2 -0
- package/serialization/resources/conversation/types/ConversationRequest.js +2 -0
- package/serialization/resources/conversation/types/ConversationResponse.d.ts +4 -0
- package/serialization/resources/conversation/types/ConversationResponse.js +4 -0
- package/serialization/resources/conversation/types/FeedbackRequest.d.ts +6 -5
- package/serialization/resources/conversation/types/FeedbackRequest.js +9 -6
- package/serialization/resources/conversation/types/GenerateMavenSuggestionsRequest.d.ts +2 -1
- package/serialization/resources/conversation/types/GenerateMavenSuggestionsRequest.js +2 -1
- package/serialization/resources/conversation/types/ResponseConfig.d.ts +16 -0
- package/serialization/resources/conversation/types/ResponseConfig.js +11 -0
- package/serialization/resources/conversation/types/ResponseLength.d.ts +10 -0
- package/serialization/resources/conversation/types/ResponseLength.js +5 -0
- package/serialization/resources/conversation/types/Sentiment.d.ts +10 -0
- package/serialization/resources/conversation/types/Sentiment.js +5 -0
- package/serialization/resources/conversation/types/StreamResponse.d.ts +5 -1
- package/serialization/resources/conversation/types/StreamResponse.js +2 -0
- package/serialization/resources/conversation/types/SubmitActionFormRequest.d.ts +13 -0
- package/serialization/resources/conversation/types/SubmitActionFormRequest.js +8 -0
- package/serialization/resources/conversation/types/UserMessage.d.ts +4 -5
- package/serialization/resources/conversation/types/UserMessage.js +4 -5
- package/serialization/resources/conversation/types/UserMessageBase.d.ts +17 -0
- package/serialization/resources/conversation/types/UserMessageBase.js +14 -0
- package/serialization/resources/conversation/types/index.d.ts +9 -3
- package/serialization/resources/conversation/types/index.js +9 -3
- package/serialization/resources/index.d.ts +5 -0
- package/serialization/resources/index.js +5 -0
- package/serialization/resources/knowledge/types/{KnowledgeDocument.d.ts → BaseKnowledgeDocument.d.ts} +3 -5
- package/{dist/serialization/resources/knowledge/types/KnowledgeDocument.js → serialization/resources/knowledge/types/BaseKnowledgeDocument.js} +2 -6
- package/{dist/serialization/resources/knowledge/types/KnowledgeBase.d.ts → serialization/resources/knowledge/types/KnowledgeBaseProperties.d.ts} +4 -5
- package/serialization/resources/knowledge/types/{KnowledgeBase.js → KnowledgeBaseProperties.js} +3 -6
- package/serialization/resources/knowledge/types/KnowledgeBaseRequest.d.ts +14 -0
- package/serialization/resources/knowledge/types/KnowledgeBaseRequest.js +11 -0
- package/serialization/resources/knowledge/types/KnowledgeBaseResponse.d.ts +14 -0
- package/serialization/resources/knowledge/types/KnowledgeBaseResponse.js +11 -0
- package/serialization/resources/knowledge/types/KnowledgeBaseVersion.d.ts +0 -1
- package/serialization/resources/knowledge/types/KnowledgeBaseVersion.js +0 -1
- package/serialization/resources/knowledge/types/KnowledgeDocumentContentType.d.ts +10 -0
- package/serialization/resources/knowledge/types/KnowledgeDocumentContentType.js +5 -0
- package/serialization/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +17 -0
- package/serialization/resources/knowledge/types/KnowledgeDocumentRequest.js +14 -0
- package/serialization/resources/knowledge/types/KnowledgeDocumentResponse.d.ts +15 -0
- package/serialization/resources/knowledge/types/KnowledgeDocumentResponse.js +12 -0
- package/serialization/resources/knowledge/types/index.d.ts +7 -5
- package/serialization/resources/knowledge/types/index.js +7 -5
- package/serialization/resources/triggers/index.d.ts +1 -0
- package/serialization/resources/triggers/index.js +1 -0
- package/serialization/resources/triggers/types/EventTriggerRequest.d.ts +14 -0
- package/serialization/resources/triggers/types/EventTriggerRequest.js +11 -0
- package/serialization/resources/triggers/types/index.d.ts +1 -0
- package/serialization/resources/triggers/types/index.js +1 -0
- package/api/resources/commons/types/User.d.ts +0 -9
- package/api/resources/conversation/errors/ConversationAlreadyExistsError.d.ts +0 -8
- package/api/resources/conversation/errors/ConversationAlreadyExistsError.js +0 -14
- package/api/resources/conversation/errors/ConversationMessageNotFoundError.d.ts +0 -8
- package/api/resources/conversation/errors/ConversationMessageNotFoundError.js +0 -14
- package/api/resources/conversation/errors/ConversationNotFoundError.d.ts +0 -8
- package/api/resources/conversation/errors/ConversationNotFoundError.js +0 -14
- package/api/resources/conversation/errors/InvalidConversationIdError.d.ts +0 -8
- package/api/resources/conversation/errors/InvalidConversationIdError.js +0 -14
- package/api/resources/conversation/errors/InvalidConversationMessageIdError.d.ts +0 -8
- package/api/resources/conversation/errors/InvalidConversationMessageIdError.js +0 -14
- package/api/resources/conversation/errors/InvalidFeedbackTypeError.d.ts +0 -8
- package/api/resources/conversation/errors/InvalidFeedbackTypeError.js +0 -14
- package/api/resources/conversation/errors/index.d.ts +0 -7
- package/api/resources/conversation/errors/index.js +0 -7
- package/api/resources/conversation/types/ConversationContext.d.ts +0 -20
- package/api/resources/conversation/types/ConversationMessageContext.d.ts +0 -12
- package/api/resources/knowledge/errors/DocumentCreationError.d.ts +0 -7
- package/api/resources/knowledge/errors/DocumentCreationError.js +0 -13
- package/api/resources/knowledge/errors/DocumentNotFoundError.d.ts +0 -8
- package/api/resources/knowledge/errors/DocumentNotFoundError.js +0 -14
- package/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.d.ts +0 -8
- package/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.js +0 -14
- package/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.d.ts +0 -8
- package/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.js +0 -14
- package/api/resources/knowledge/errors/VersionInProgressError.d.ts +0 -8
- package/api/resources/knowledge/errors/VersionInProgressError.js +0 -14
- package/api/resources/knowledge/errors/VersionNotInProgressError.d.ts +0 -8
- package/api/resources/knowledge/errors/VersionNotInProgressError.js +0 -14
- package/api/resources/knowledge/errors/index.d.ts +0 -6
- package/api/resources/knowledge/errors/index.js +0 -6
- package/api/resources/knowledge/types/KnowledgeBaseId.d.ts +0 -7
- package/api/resources/knowledge/types/KnowledgeDocumentId.d.ts +0 -9
- package/dist/api/resources/commons/types/User.d.ts +0 -9
- package/dist/api/resources/conversation/errors/ConversationAlreadyExistsError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/ConversationAlreadyExistsError.js +0 -14
- package/dist/api/resources/conversation/errors/ConversationMessageNotFoundError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/ConversationMessageNotFoundError.js +0 -14
- package/dist/api/resources/conversation/errors/ConversationNotFoundError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/ConversationNotFoundError.js +0 -14
- package/dist/api/resources/conversation/errors/EmptyConversationError.js +0 -14
- package/dist/api/resources/conversation/errors/InvalidConversationIdError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/InvalidConversationIdError.js +0 -14
- package/dist/api/resources/conversation/errors/InvalidConversationMessageIdError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/InvalidConversationMessageIdError.js +0 -14
- package/dist/api/resources/conversation/errors/InvalidFeedbackTypeError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/InvalidFeedbackTypeError.js +0 -14
- package/dist/api/resources/conversation/errors/index.d.ts +0 -7
- package/dist/api/resources/conversation/errors/index.js +0 -7
- package/dist/api/resources/conversation/types/ConversationContext.d.ts +0 -20
- package/dist/api/resources/conversation/types/ConversationMessageContext.d.ts +0 -12
- package/dist/api/resources/knowledge/errors/DocumentCreationError.d.ts +0 -7
- package/dist/api/resources/knowledge/errors/DocumentCreationError.js +0 -13
- package/dist/api/resources/knowledge/errors/DocumentNotFoundError.d.ts +0 -8
- package/dist/api/resources/knowledge/errors/DocumentNotFoundError.js +0 -14
- package/dist/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.d.ts +0 -8
- package/dist/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.js +0 -14
- package/dist/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.d.ts +0 -8
- package/dist/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.js +0 -14
- package/dist/api/resources/knowledge/errors/VersionInProgressError.d.ts +0 -8
- package/dist/api/resources/knowledge/errors/VersionNotInProgressError.d.ts +0 -8
- package/dist/api/resources/knowledge/errors/VersionNotInProgressError.js +0 -14
- package/dist/api/resources/knowledge/errors/index.d.ts +0 -6
- package/dist/api/resources/knowledge/errors/index.js +0 -6
- package/dist/api/resources/knowledge/types/KnowledgeBaseId.d.ts +0 -7
- package/dist/api/resources/knowledge/types/KnowledgeDocumentId.d.ts +0 -9
- package/dist/serialization/resources/commons/types/User.js +0 -9
- package/dist/serialization/resources/conversation/types/ConversationContext.d.ts +0 -20
- package/dist/serialization/resources/conversation/types/ConversationContext.js +0 -15
- package/dist/serialization/resources/conversation/types/ConversationMessageContext.d.ts +0 -16
- package/dist/serialization/resources/conversation/types/ConversationMessageContext.js +0 -11
- package/dist/serialization/resources/knowledge/types/KnowledgeBaseId.d.ts +0 -12
- package/dist/serialization/resources/knowledge/types/KnowledgeBaseId.js +0 -7
- package/dist/serialization/resources/knowledge/types/KnowledgeDocumentId.d.ts +0 -13
- package/dist/serialization/resources/knowledge/types/KnowledgeDocumentId.js +0 -8
- package/serialization/resources/commons/types/User.js +0 -9
- package/serialization/resources/conversation/types/ConversationContext.d.ts +0 -20
- package/serialization/resources/conversation/types/ConversationContext.js +0 -15
- package/serialization/resources/conversation/types/ConversationMessageContext.d.ts +0 -16
- package/serialization/resources/conversation/types/ConversationMessageContext.js +0 -11
- package/serialization/resources/knowledge/types/KnowledgeBaseId.d.ts +0 -12
- package/serialization/resources/knowledge/types/KnowledgeBaseId.js +0 -7
- package/serialization/resources/knowledge/types/KnowledgeDocumentId.d.ts +0 -13
- package/serialization/resources/knowledge/types/KnowledgeDocumentId.js +0 -8
- /package/api/resources/{commons/types/User.js → actions/types/ActionBase.js} +0 -0
- /package/api/resources/{conversation/types/ConversationContext.js → actions/types/ActionParameter.js} +0 -0
- /package/api/resources/{conversation/types/ConversationMessageContext.js → actions/types/ActionRequest.js} +0 -0
- /package/api/resources/{knowledge/types/IdBody.js → actions/types/ActionResponse.js} +0 -0
- /package/api/resources/{knowledge/types/KnowledgeBase.js → actions/types/ConversationExecutedActionPrecondition.js} +0 -0
- /package/api/resources/{knowledge/types/KnowledgeBaseId.js → actions/types/ConversationPrecondition.js} +0 -0
- /package/api/resources/{knowledge/types/KnowledgeDocument.js → actions/types/MetadataPrecondition.js} +0 -0
- /package/api/resources/{knowledge/types/KnowledgeDocumentId.js → actions/types/Precondition.js} +0 -0
- /package/{dist/api/resources/commons/types/User.js → api/resources/actions/types/PreconditionGroup.js} +0 -0
- /package/{dist/api/resources/conversation/types/ConversationContext.js → api/resources/commons/types/AppUser.js} +0 -0
- /package/{dist/api/resources/conversation/types/ConversationMessageContext.js → api/resources/commons/types/AppUserIdentifier.js} +0 -0
- /package/{dist/api/resources/knowledge/types/IdBody.js → api/resources/commons/types/AppUserRequest.js} +0 -0
- /package/{dist/api/resources/knowledge/types/KnowledgeBase.js → api/resources/commons/types/AppUserResponse.js} +0 -0
- /package/{dist/api/resources/knowledge/types/KnowledgeBaseId.js → api/resources/commons/types/EntityId.js} +0 -0
- /package/{dist/api/resources/knowledge/types/KnowledgeDocument.js → api/resources/commons/types/EntityIdBase.js} +0 -0
- /package/{dist/api/resources/knowledge/types/KnowledgeDocumentId.js → api/resources/commons/types/EventTriggerBase.js} +0 -0
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SchemaType } from "../../Schema";
|
|
11
2
|
import { entries } from "../../utils/entries";
|
|
12
3
|
import { filterObject } from "../../utils/filterObject";
|
|
@@ -20,9 +11,9 @@ import { getSchemaUtils } from "../schema-utils";
|
|
|
20
11
|
import { isProperty } from "./property";
|
|
21
12
|
export function object(schemas) {
|
|
22
13
|
const baseSchema = {
|
|
23
|
-
_getRawProperties: () =>
|
|
24
|
-
_getParsedProperties: () =>
|
|
25
|
-
parse: (raw, opts) =>
|
|
14
|
+
_getRawProperties: () => Object.entries(schemas).map(([parsedKey, propertySchema]) => isProperty(propertySchema) ? propertySchema.rawKey : parsedKey),
|
|
15
|
+
_getParsedProperties: () => keys(schemas),
|
|
16
|
+
parse: (raw, opts) => {
|
|
26
17
|
const rawKeyToProperty = {};
|
|
27
18
|
const requiredKeys = [];
|
|
28
19
|
for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) {
|
|
@@ -59,9 +50,10 @@ export function object(schemas) {
|
|
|
59
50
|
unrecognizedObjectKeys: opts === null || opts === void 0 ? void 0 : opts.unrecognizedObjectKeys,
|
|
60
51
|
skipValidation: opts === null || opts === void 0 ? void 0 : opts.skipValidation,
|
|
61
52
|
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
53
|
+
omitUndefined: opts === null || opts === void 0 ? void 0 : opts.omitUndefined,
|
|
62
54
|
});
|
|
63
|
-
}
|
|
64
|
-
json: (parsed, opts) =>
|
|
55
|
+
},
|
|
56
|
+
json: (parsed, opts) => {
|
|
65
57
|
const requiredKeys = [];
|
|
66
58
|
for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) {
|
|
67
59
|
const valueSchema = isProperty(schemaOrObjectProperty)
|
|
@@ -102,109 +94,98 @@ export function object(schemas) {
|
|
|
102
94
|
unrecognizedObjectKeys: opts === null || opts === void 0 ? void 0 : opts.unrecognizedObjectKeys,
|
|
103
95
|
skipValidation: opts === null || opts === void 0 ? void 0 : opts.skipValidation,
|
|
104
96
|
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
97
|
+
omitUndefined: opts === null || opts === void 0 ? void 0 : opts.omitUndefined,
|
|
105
98
|
});
|
|
106
|
-
}
|
|
99
|
+
},
|
|
107
100
|
getType: () => SchemaType.OBJECT,
|
|
108
101
|
};
|
|
109
102
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, maybeSkipValidation(baseSchema)), getSchemaUtils(baseSchema)), getObjectLikeUtils(baseSchema)), getObjectUtils(baseSchema));
|
|
110
103
|
}
|
|
111
104
|
function validateAndTransformObject({ value, requiredKeys, getProperty, unrecognizedObjectKeys = "fail", skipValidation = false, breadcrumbsPrefix = [], }) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
transformed[property.transformedKey] = value.value;
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
transformed[preTransformedKey] = preTransformedItemValue;
|
|
137
|
-
errors.push(...value.errors);
|
|
138
|
-
}
|
|
105
|
+
if (!isPlainObject(value)) {
|
|
106
|
+
return {
|
|
107
|
+
ok: false,
|
|
108
|
+
errors: [
|
|
109
|
+
{
|
|
110
|
+
path: breadcrumbsPrefix,
|
|
111
|
+
message: getErrorMessageForIncorrectType(value, "object"),
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const missingRequiredKeys = new Set(requiredKeys);
|
|
117
|
+
const errors = [];
|
|
118
|
+
const transformed = {};
|
|
119
|
+
for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) {
|
|
120
|
+
const property = getProperty(preTransformedKey);
|
|
121
|
+
if (property != null) {
|
|
122
|
+
missingRequiredKeys.delete(preTransformedKey);
|
|
123
|
+
const value = property.transform(preTransformedItemValue);
|
|
124
|
+
if (value.ok) {
|
|
125
|
+
transformed[property.transformedKey] = value.value;
|
|
139
126
|
}
|
|
140
127
|
else {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
errors.push({
|
|
144
|
-
path: [...breadcrumbsPrefix, preTransformedKey],
|
|
145
|
-
message: `Unexpected key "${preTransformedKey}"`,
|
|
146
|
-
});
|
|
147
|
-
break;
|
|
148
|
-
case "strip":
|
|
149
|
-
break;
|
|
150
|
-
case "passthrough":
|
|
151
|
-
transformed[preTransformedKey] = preTransformedItemValue;
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
128
|
+
transformed[preTransformedKey] = preTransformedItemValue;
|
|
129
|
+
errors.push(...value.errors);
|
|
154
130
|
}
|
|
155
131
|
}
|
|
156
|
-
errors.push(...requiredKeys
|
|
157
|
-
.filter((key) => missingRequiredKeys.has(key))
|
|
158
|
-
.map((key) => ({
|
|
159
|
-
path: breadcrumbsPrefix,
|
|
160
|
-
message: `Missing required key "${key}"`,
|
|
161
|
-
})));
|
|
162
|
-
if (errors.length === 0 || skipValidation) {
|
|
163
|
-
return {
|
|
164
|
-
ok: true,
|
|
165
|
-
value: transformed,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
132
|
else {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
133
|
+
switch (unrecognizedObjectKeys) {
|
|
134
|
+
case "fail":
|
|
135
|
+
errors.push({
|
|
136
|
+
path: [...breadcrumbsPrefix, preTransformedKey],
|
|
137
|
+
message: `Unexpected key "${preTransformedKey}"`,
|
|
138
|
+
});
|
|
139
|
+
break;
|
|
140
|
+
case "strip":
|
|
141
|
+
break;
|
|
142
|
+
case "passthrough":
|
|
143
|
+
transformed[preTransformedKey] = preTransformedItemValue;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
173
146
|
}
|
|
174
|
-
}
|
|
147
|
+
}
|
|
148
|
+
errors.push(...requiredKeys
|
|
149
|
+
.filter((key) => missingRequiredKeys.has(key))
|
|
150
|
+
.map((key) => ({
|
|
151
|
+
path: breadcrumbsPrefix,
|
|
152
|
+
message: `Missing required key "${key}"`,
|
|
153
|
+
})));
|
|
154
|
+
if (errors.length === 0 || skipValidation) {
|
|
155
|
+
return {
|
|
156
|
+
ok: true,
|
|
157
|
+
value: transformed,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
return {
|
|
162
|
+
ok: false,
|
|
163
|
+
errors,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
175
166
|
}
|
|
176
167
|
export function getObjectUtils(schema) {
|
|
177
168
|
return {
|
|
178
169
|
extend: (extension) => {
|
|
179
170
|
const baseSchema = {
|
|
180
|
-
_getParsedProperties: () =>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
...(yield extension._getParsedProperties()),
|
|
184
|
-
];
|
|
185
|
-
}),
|
|
186
|
-
_getRawProperties: () => __awaiter(this, void 0, void 0, function* () {
|
|
187
|
-
return [
|
|
188
|
-
...(yield schema._getRawProperties()),
|
|
189
|
-
...(yield extension._getRawProperties()),
|
|
190
|
-
];
|
|
191
|
-
}),
|
|
192
|
-
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
_getParsedProperties: () => [...schema._getParsedProperties(), ...extension._getParsedProperties()],
|
|
172
|
+
_getRawProperties: () => [...schema._getRawProperties(), ...extension._getRawProperties()],
|
|
173
|
+
parse: (raw, opts) => {
|
|
193
174
|
return validateAndTransformExtendedObject({
|
|
194
|
-
extensionKeys:
|
|
175
|
+
extensionKeys: extension._getRawProperties(),
|
|
195
176
|
value: raw,
|
|
196
177
|
transformBase: (rawBase) => schema.parse(rawBase, opts),
|
|
197
178
|
transformExtension: (rawExtension) => extension.parse(rawExtension, opts),
|
|
198
179
|
});
|
|
199
|
-
}
|
|
200
|
-
json: (parsed, opts) =>
|
|
180
|
+
},
|
|
181
|
+
json: (parsed, opts) => {
|
|
201
182
|
return validateAndTransformExtendedObject({
|
|
202
|
-
extensionKeys:
|
|
183
|
+
extensionKeys: extension._getParsedProperties(),
|
|
203
184
|
value: parsed,
|
|
204
185
|
transformBase: (parsedBase) => schema.json(parsedBase, opts),
|
|
205
186
|
transformExtension: (parsedExtension) => extension.json(parsedExtension, opts),
|
|
206
187
|
});
|
|
207
|
-
}
|
|
188
|
+
},
|
|
208
189
|
getType: () => SchemaType.OBJECT,
|
|
209
190
|
};
|
|
210
191
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema)), getObjectLikeUtils(baseSchema)), getObjectUtils(baseSchema));
|
|
@@ -212,27 +193,25 @@ export function getObjectUtils(schema) {
|
|
|
212
193
|
};
|
|
213
194
|
}
|
|
214
195
|
function validateAndTransformExtendedObject({ extensionKeys, value, transformBase, transformExtension, }) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
});
|
|
196
|
+
const extensionPropertiesSet = new Set(extensionKeys);
|
|
197
|
+
const [extensionProperties, baseProperties] = partition(keys(value), (key) => extensionPropertiesSet.has(key));
|
|
198
|
+
const transformedBase = transformBase(filterObject(value, baseProperties));
|
|
199
|
+
const transformedExtension = transformExtension(filterObject(value, extensionProperties));
|
|
200
|
+
if (transformedBase.ok && transformedExtension.ok) {
|
|
201
|
+
return {
|
|
202
|
+
ok: true,
|
|
203
|
+
value: Object.assign(Object.assign({}, transformedBase.value), transformedExtension.value),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
return {
|
|
208
|
+
ok: false,
|
|
209
|
+
errors: [
|
|
210
|
+
...(transformedBase.ok ? [] : transformedBase.errors),
|
|
211
|
+
...(transformedExtension.ok ? [] : transformedExtension.errors),
|
|
212
|
+
],
|
|
213
|
+
};
|
|
214
|
+
}
|
|
236
215
|
}
|
|
237
216
|
function isSchemaRequired(schema) {
|
|
238
217
|
return !isSchemaOptional(schema);
|
|
@@ -5,8 +5,8 @@ import { SchemaUtils } from "../schema-utils";
|
|
|
5
5
|
import { Property } from "./property";
|
|
6
6
|
export declare type ObjectSchema<Raw, Parsed> = BaseObjectSchema<Raw, Parsed> & ObjectLikeUtils<Raw, Parsed> & ObjectUtils<Raw, Parsed> & SchemaUtils<Raw, Parsed>;
|
|
7
7
|
export interface BaseObjectSchema<Raw, Parsed> extends BaseSchema<Raw, Parsed> {
|
|
8
|
-
_getRawProperties: () =>
|
|
9
|
-
_getParsedProperties: () =>
|
|
8
|
+
_getRawProperties: () => (keyof Raw)[];
|
|
9
|
+
_getParsedProperties: () => (keyof Parsed)[];
|
|
10
10
|
}
|
|
11
11
|
export interface ObjectUtils<Raw, Parsed> {
|
|
12
12
|
extend: <RawExtension, ParsedExtension>(schemas: ObjectSchema<RawExtension, ParsedExtension>) => ObjectSchema<Raw & RawExtension, Parsed & ParsedExtension>;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { filterObject } from "../../utils/filterObject";
|
|
11
2
|
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
12
3
|
import { isPlainObject } from "../../utils/isPlainObject";
|
|
@@ -21,8 +12,8 @@ export function getObjectLikeUtils(schema) {
|
|
|
21
12
|
*/
|
|
22
13
|
export function withParsedProperties(objectLike, properties) {
|
|
23
14
|
const objectSchema = {
|
|
24
|
-
parse: (raw, opts) =>
|
|
25
|
-
const parsedObject =
|
|
15
|
+
parse: (raw, opts) => {
|
|
16
|
+
const parsedObject = objectLike.parse(raw, opts);
|
|
26
17
|
if (!parsedObject.ok) {
|
|
27
18
|
return parsedObject;
|
|
28
19
|
}
|
|
@@ -33,7 +24,7 @@ export function withParsedProperties(objectLike, properties) {
|
|
|
33
24
|
ok: true,
|
|
34
25
|
value: Object.assign(Object.assign({}, parsedObject.value), additionalProperties),
|
|
35
26
|
};
|
|
36
|
-
}
|
|
27
|
+
},
|
|
37
28
|
json: (parsed, opts) => {
|
|
38
29
|
var _a;
|
|
39
30
|
if (!isPlainObject(parsed)) {
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SchemaType } from "../../Schema";
|
|
11
2
|
import { entries } from "../../utils/entries";
|
|
12
3
|
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
@@ -15,10 +6,10 @@ import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
|
15
6
|
import { getSchemaUtils } from "../schema-utils";
|
|
16
7
|
export function record(keySchema, valueSchema) {
|
|
17
8
|
const baseSchema = {
|
|
18
|
-
parse: (raw, opts) =>
|
|
9
|
+
parse: (raw, opts) => {
|
|
19
10
|
return validateAndTransformRecord({
|
|
20
11
|
value: raw,
|
|
21
|
-
isKeyNumeric:
|
|
12
|
+
isKeyNumeric: keySchema.getType() === SchemaType.NUMBER,
|
|
22
13
|
transformKey: (key) => {
|
|
23
14
|
var _a;
|
|
24
15
|
return keySchema.parse(key, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `${key} (key)`] }));
|
|
@@ -29,11 +20,11 @@ export function record(keySchema, valueSchema) {
|
|
|
29
20
|
},
|
|
30
21
|
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
31
22
|
});
|
|
32
|
-
}
|
|
33
|
-
json: (parsed, opts) =>
|
|
23
|
+
},
|
|
24
|
+
json: (parsed, opts) => {
|
|
34
25
|
return validateAndTransformRecord({
|
|
35
26
|
value: parsed,
|
|
36
|
-
isKeyNumeric:
|
|
27
|
+
isKeyNumeric: keySchema.getType() === SchemaType.NUMBER,
|
|
37
28
|
transformKey: (key) => {
|
|
38
29
|
var _a;
|
|
39
30
|
return keySchema.json(key, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `${key} (key)`] }));
|
|
@@ -44,59 +35,57 @@ export function record(keySchema, valueSchema) {
|
|
|
44
35
|
},
|
|
45
36
|
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
46
37
|
});
|
|
47
|
-
}
|
|
38
|
+
},
|
|
48
39
|
getType: () => SchemaType.RECORD,
|
|
49
40
|
};
|
|
50
41
|
return Object.assign(Object.assign({}, maybeSkipValidation(baseSchema)), getSchemaUtils(baseSchema));
|
|
51
42
|
}
|
|
52
43
|
function validateAndTransformRecord({ value, isKeyNumeric, transformKey, transformValue, breadcrumbsPrefix = [], }) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
if (!isPlainObject(value)) {
|
|
45
|
+
return {
|
|
46
|
+
ok: false,
|
|
47
|
+
errors: [
|
|
48
|
+
{
|
|
49
|
+
path: breadcrumbsPrefix,
|
|
50
|
+
message: getErrorMessageForIncorrectType(value, "object"),
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return entries(value).reduce((accPromise, [stringKey, value]) => {
|
|
56
|
+
// skip nullish keys
|
|
57
|
+
if (value == null) {
|
|
58
|
+
return accPromise;
|
|
64
59
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
let key = stringKey;
|
|
72
|
-
if (isKeyNumeric) {
|
|
73
|
-
const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
|
|
74
|
-
if (!isNaN(numberKey)) {
|
|
75
|
-
key = numberKey;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const transformedKey = yield transformKey(key);
|
|
79
|
-
const transformedValue = yield transformValue(value, key);
|
|
80
|
-
if (acc.ok && transformedKey.ok && transformedValue.ok) {
|
|
81
|
-
return {
|
|
82
|
-
ok: true,
|
|
83
|
-
value: Object.assign(Object.assign({}, acc.value), { [transformedKey.value]: transformedValue.value }),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
const errors = [];
|
|
87
|
-
if (!acc.ok) {
|
|
88
|
-
errors.push(...acc.errors);
|
|
89
|
-
}
|
|
90
|
-
if (!transformedKey.ok) {
|
|
91
|
-
errors.push(...transformedKey.errors);
|
|
92
|
-
}
|
|
93
|
-
if (!transformedValue.ok) {
|
|
94
|
-
errors.push(...transformedValue.errors);
|
|
60
|
+
const acc = accPromise;
|
|
61
|
+
let key = stringKey;
|
|
62
|
+
if (isKeyNumeric) {
|
|
63
|
+
const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
|
|
64
|
+
if (!isNaN(numberKey)) {
|
|
65
|
+
key = numberKey;
|
|
95
66
|
}
|
|
67
|
+
}
|
|
68
|
+
const transformedKey = transformKey(key);
|
|
69
|
+
const transformedValue = transformValue(value, key);
|
|
70
|
+
if (acc.ok && transformedKey.ok && transformedValue.ok) {
|
|
96
71
|
return {
|
|
97
|
-
ok:
|
|
98
|
-
|
|
72
|
+
ok: true,
|
|
73
|
+
value: Object.assign(Object.assign({}, acc.value), { [transformedKey.value]: transformedValue.value }),
|
|
99
74
|
};
|
|
100
|
-
}
|
|
101
|
-
|
|
75
|
+
}
|
|
76
|
+
const errors = [];
|
|
77
|
+
if (!acc.ok) {
|
|
78
|
+
errors.push(...acc.errors);
|
|
79
|
+
}
|
|
80
|
+
if (!transformedKey.ok) {
|
|
81
|
+
errors.push(...transformedKey.errors);
|
|
82
|
+
}
|
|
83
|
+
if (!transformedValue.ok) {
|
|
84
|
+
errors.push(...transformedValue.errors);
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
ok: false,
|
|
88
|
+
errors,
|
|
89
|
+
};
|
|
90
|
+
}, { ok: true, value: {} });
|
|
102
91
|
}
|
|
@@ -2,8 +2,8 @@ import { BaseSchema, Schema, SchemaOptions } from "../../Schema";
|
|
|
2
2
|
export interface SchemaUtils<Raw, Parsed> {
|
|
3
3
|
optional: () => Schema<Raw | null | undefined, Parsed | undefined>;
|
|
4
4
|
transform: <Transformed>(transformer: SchemaTransformer<Parsed, Transformed>) => Schema<Raw, Transformed>;
|
|
5
|
-
parseOrThrow: (raw: unknown, opts?: SchemaOptions) =>
|
|
6
|
-
jsonOrThrow: (raw: unknown, opts?: SchemaOptions) =>
|
|
5
|
+
parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed;
|
|
6
|
+
jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw;
|
|
7
7
|
}
|
|
8
8
|
export interface SchemaTransformer<Parsed, Transformed> {
|
|
9
9
|
transform: (parsed: Parsed) => Transformed;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SchemaType } from "../../Schema";
|
|
11
2
|
import { JsonError } from "./JsonError";
|
|
12
3
|
import { ParseError } from "./ParseError";
|
|
@@ -14,20 +5,20 @@ export function getSchemaUtils(schema) {
|
|
|
14
5
|
return {
|
|
15
6
|
optional: () => optional(schema),
|
|
16
7
|
transform: (transformer) => transform(schema, transformer),
|
|
17
|
-
parseOrThrow: (raw, opts) =>
|
|
18
|
-
const parsed =
|
|
8
|
+
parseOrThrow: (raw, opts) => {
|
|
9
|
+
const parsed = schema.parse(raw, opts);
|
|
19
10
|
if (parsed.ok) {
|
|
20
11
|
return parsed.value;
|
|
21
12
|
}
|
|
22
13
|
throw new ParseError(parsed.errors);
|
|
23
|
-
}
|
|
24
|
-
jsonOrThrow: (parsed, opts) =>
|
|
25
|
-
const raw =
|
|
14
|
+
},
|
|
15
|
+
jsonOrThrow: (parsed, opts) => {
|
|
16
|
+
const raw = schema.json(parsed, opts);
|
|
26
17
|
if (raw.ok) {
|
|
27
18
|
return raw.value;
|
|
28
19
|
}
|
|
29
20
|
throw new JsonError(raw.errors);
|
|
30
|
-
}
|
|
21
|
+
},
|
|
31
22
|
};
|
|
32
23
|
}
|
|
33
24
|
/**
|
|
@@ -45,6 +36,12 @@ export function optional(schema) {
|
|
|
45
36
|
return schema.parse(raw, opts);
|
|
46
37
|
},
|
|
47
38
|
json: (parsed, opts) => {
|
|
39
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.omitUndefined) && parsed === undefined) {
|
|
40
|
+
return {
|
|
41
|
+
ok: true,
|
|
42
|
+
value: undefined,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
48
45
|
if (parsed == null) {
|
|
49
46
|
return {
|
|
50
47
|
ok: true,
|
|
@@ -59,8 +56,8 @@ export function optional(schema) {
|
|
|
59
56
|
}
|
|
60
57
|
export function transform(schema, transformer) {
|
|
61
58
|
const baseSchema = {
|
|
62
|
-
parse: (raw, opts) =>
|
|
63
|
-
const parsed =
|
|
59
|
+
parse: (raw, opts) => {
|
|
60
|
+
const parsed = schema.parse(raw, opts);
|
|
64
61
|
if (!parsed.ok) {
|
|
65
62
|
return parsed;
|
|
66
63
|
}
|
|
@@ -68,11 +65,11 @@ export function transform(schema, transformer) {
|
|
|
68
65
|
ok: true,
|
|
69
66
|
value: transformer.transform(parsed.value),
|
|
70
67
|
};
|
|
71
|
-
}
|
|
72
|
-
json: (transformed, opts) =>
|
|
73
|
-
const parsed =
|
|
68
|
+
},
|
|
69
|
+
json: (transformed, opts) => {
|
|
70
|
+
const parsed = transformer.untransform(transformed);
|
|
74
71
|
return schema.json(parsed, opts);
|
|
75
|
-
}
|
|
72
|
+
},
|
|
76
73
|
getType: () => schema.getType(),
|
|
77
74
|
};
|
|
78
75
|
return Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema));
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SchemaType } from "../../Schema";
|
|
11
2
|
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
12
3
|
import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
@@ -15,8 +6,8 @@ import { getSchemaUtils } from "../schema-utils";
|
|
|
15
6
|
export function set(schema) {
|
|
16
7
|
const listSchema = list(schema);
|
|
17
8
|
const baseSchema = {
|
|
18
|
-
parse: (raw, opts) =>
|
|
19
|
-
const parsedList =
|
|
9
|
+
parse: (raw, opts) => {
|
|
10
|
+
const parsedList = listSchema.parse(raw, opts);
|
|
20
11
|
if (parsedList.ok) {
|
|
21
12
|
return {
|
|
22
13
|
ok: true,
|
|
@@ -26,8 +17,8 @@ export function set(schema) {
|
|
|
26
17
|
else {
|
|
27
18
|
return parsedList;
|
|
28
19
|
}
|
|
29
|
-
}
|
|
30
|
-
json: (parsed, opts) =>
|
|
20
|
+
},
|
|
21
|
+
json: (parsed, opts) => {
|
|
31
22
|
var _a;
|
|
32
23
|
if (!(parsed instanceof Set)) {
|
|
33
24
|
return {
|
|
@@ -40,9 +31,9 @@ export function set(schema) {
|
|
|
40
31
|
],
|
|
41
32
|
};
|
|
42
33
|
}
|
|
43
|
-
const jsonList =
|
|
34
|
+
const jsonList = listSchema.json([...parsed], opts);
|
|
44
35
|
return jsonList;
|
|
45
|
-
}
|
|
36
|
+
},
|
|
46
37
|
getType: () => SchemaType.SET,
|
|
47
38
|
};
|
|
48
39
|
return Object.assign(Object.assign({}, maybeSkipValidation(baseSchema)), getSchemaUtils(baseSchema));
|
|
@@ -1,47 +1,36 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SchemaType } from "../../Schema";
|
|
11
2
|
import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
12
3
|
import { getSchemaUtils } from "../schema-utils";
|
|
13
4
|
export function undiscriminatedUnion(schemas) {
|
|
14
5
|
const baseSchema = {
|
|
15
|
-
parse: (raw, opts) =>
|
|
6
|
+
parse: (raw, opts) => {
|
|
16
7
|
return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.parse(raw, opts), schemas, opts);
|
|
17
|
-
}
|
|
18
|
-
json: (parsed, opts) =>
|
|
8
|
+
},
|
|
9
|
+
json: (parsed, opts) => {
|
|
19
10
|
return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.json(parsed, opts), schemas, opts);
|
|
20
|
-
}
|
|
11
|
+
},
|
|
21
12
|
getType: () => SchemaType.UNDISCRIMINATED_UNION,
|
|
22
13
|
};
|
|
23
14
|
return Object.assign(Object.assign({}, maybeSkipValidation(baseSchema)), getSchemaUtils(baseSchema));
|
|
24
15
|
}
|
|
25
16
|
function validateAndTransformUndiscriminatedUnion(transform, schemas, opts) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
}
|
|
17
|
+
const errors = [];
|
|
18
|
+
for (const [index, schema] of schemas.entries()) {
|
|
19
|
+
const transformed = transform(schema, Object.assign(Object.assign({}, opts), { skipValidation: false }));
|
|
20
|
+
if (transformed.ok) {
|
|
21
|
+
return transformed;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
for (const error of transformed.errors) {
|
|
25
|
+
errors.push({
|
|
26
|
+
path: error.path,
|
|
27
|
+
message: `[Variant ${index}] ${error.message}`,
|
|
28
|
+
});
|
|
40
29
|
}
|
|
41
30
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
ok: false,
|
|
34
|
+
errors,
|
|
35
|
+
};
|
|
47
36
|
}
|