mavenagi 1.2.10 → 1.2.12
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 +6 -0
- package/Client.js +32 -22
- package/api/resources/auth/client/Client.d.ts +33 -0
- package/api/resources/auth/client/Client.js +171 -0
- package/api/resources/auth/client/index.d.ts +1 -0
- package/api/resources/auth/client/index.js +2 -0
- package/api/resources/auth/index.d.ts +2 -0
- package/api/resources/auth/index.js +18 -0
- package/api/resources/auth/types/SessionTokenRequest.d.ts +3 -0
- package/api/resources/auth/types/SessionTokenRequest.js +3 -0
- package/api/resources/auth/types/SessionTokenResponse.d.ts +6 -0
- package/api/resources/auth/types/SessionTokenResponse.js +3 -0
- package/api/resources/auth/types/index.d.ts +2 -0
- package/api/resources/auth/types/index.js +18 -0
- package/api/resources/commons/types/ActionBase.d.ts +1 -11
- package/api/resources/commons/types/ActionParameterType.d.ts +3 -0
- package/api/resources/commons/types/ActionParameterType.js +3 -0
- package/api/resources/commons/types/ActionProperties.d.ts +13 -0
- package/api/resources/commons/types/ActionProperties.js +3 -0
- package/api/resources/commons/types/ActionUser.d.ts +46 -0
- package/api/resources/commons/types/ActionUser.js +3 -0
- package/api/resources/commons/types/EntityType.d.ts +1 -0
- package/api/resources/commons/types/EntityType.js +1 -0
- package/api/resources/commons/types/EventField.d.ts +1 -0
- package/api/resources/commons/types/EventField.js +1 -0
- package/api/resources/commons/types/MetadataPrecondition.d.ts +3 -1
- package/api/resources/commons/types/PreconditionOperator.d.ts +20 -0
- package/api/resources/commons/types/PreconditionOperator.js +20 -0
- package/api/resources/commons/types/UserEvent.d.ts +2 -0
- package/api/resources/commons/types/index.d.ts +3 -0
- package/api/resources/commons/types/index.js +3 -0
- package/api/resources/index.d.ts +4 -0
- package/api/resources/index.js +5 -1
- package/api/resources/knowledge/types/KnowledgeBaseResponse.d.ts +2 -0
- package/api/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +1 -1
- package/api/resources/segments/types/SegmentResponse.d.ts +6 -0
- package/api/resources/triggers/types/index.d.ts +0 -1
- package/api/resources/triggers/types/index.js +0 -1
- package/api/resources/websockets/client/Client.d.ts +22 -0
- package/api/resources/websockets/client/Client.js +89 -0
- package/api/resources/websockets/client/Socket.d.ts +48 -0
- package/api/resources/websockets/client/Socket.js +172 -0
- package/api/resources/websockets/client/index.d.ts +1 -0
- package/api/resources/websockets/client/index.js +2 -0
- package/api/resources/websockets/index.d.ts +2 -0
- package/api/resources/websockets/index.js +18 -0
- package/api/resources/websockets/types/AgentAudioChunk.d.ts +9 -0
- package/api/resources/websockets/types/AgentAudioChunk.js +3 -0
- package/api/resources/websockets/types/AgentTranscript.d.ts +9 -0
- package/api/resources/websockets/types/AgentTranscript.js +3 -0
- package/api/resources/websockets/types/AudioFormat.d.ts +7 -0
- package/api/resources/websockets/types/AudioFormat.js +10 -0
- package/api/resources/websockets/types/Config.d.ts +15 -0
- package/api/resources/websockets/types/Config.js +3 -0
- package/api/resources/websockets/types/ConversationEnded.d.ts +7 -0
- package/api/resources/websockets/types/ConversationEnded.js +3 -0
- package/api/resources/websockets/types/ConversationReady.d.ts +6 -0
- package/api/resources/websockets/types/ConversationReady.js +3 -0
- package/api/resources/websockets/types/Error_.d.ts +9 -0
- package/api/resources/websockets/types/Error_.js +3 -0
- package/api/resources/websockets/types/ServerEventBase.d.ts +6 -0
- package/api/resources/websockets/types/ServerEventBase.js +3 -0
- package/api/resources/websockets/types/UserAudioChunk.d.ts +8 -0
- package/api/resources/websockets/types/UserAudioChunk.js +3 -0
- package/api/resources/websockets/types/UserFinishedSpeaking.d.ts +7 -0
- package/api/resources/websockets/types/UserFinishedSpeaking.js +3 -0
- package/api/resources/websockets/types/UserStartedSpeaking.d.ts +7 -0
- package/api/resources/websockets/types/UserStartedSpeaking.js +3 -0
- package/api/resources/websockets/types/UserTranscript.d.ts +9 -0
- package/api/resources/websockets/types/UserTranscript.js +3 -0
- package/api/resources/websockets/types/index.d.ts +12 -0
- package/api/resources/websockets/types/index.js +28 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/websocket/events.d.ts +36 -0
- package/core/websocket/events.js +27 -0
- package/core/websocket/index.d.ts +1 -0
- package/core/websocket/index.js +17 -0
- package/core/websocket/ws.d.ts +147 -0
- package/core/websocket/ws.js +444 -0
- package/dist/Client.d.ts +6 -0
- package/dist/Client.js +32 -22
- package/dist/api/resources/auth/client/Client.d.ts +33 -0
- package/dist/api/resources/auth/client/Client.js +171 -0
- package/dist/api/resources/auth/client/index.d.ts +1 -0
- package/dist/api/resources/auth/client/index.js +2 -0
- package/dist/api/resources/auth/index.d.ts +2 -0
- package/dist/api/resources/auth/index.js +18 -0
- package/dist/api/resources/auth/types/SessionTokenRequest.d.ts +3 -0
- package/dist/api/resources/auth/types/SessionTokenRequest.js +3 -0
- package/dist/api/resources/auth/types/SessionTokenResponse.d.ts +6 -0
- package/dist/api/resources/auth/types/SessionTokenResponse.js +3 -0
- package/dist/api/resources/auth/types/index.d.ts +2 -0
- package/dist/api/resources/auth/types/index.js +18 -0
- package/dist/api/resources/commons/types/ActionBase.d.ts +1 -11
- package/dist/api/resources/commons/types/ActionParameterType.d.ts +3 -0
- package/dist/api/resources/commons/types/ActionParameterType.js +3 -0
- package/dist/api/resources/commons/types/ActionProperties.d.ts +13 -0
- package/dist/api/resources/commons/types/ActionProperties.js +3 -0
- package/dist/api/resources/commons/types/ActionUser.d.ts +46 -0
- package/dist/api/resources/commons/types/ActionUser.js +3 -0
- package/dist/api/resources/commons/types/EntityType.d.ts +1 -0
- package/dist/api/resources/commons/types/EntityType.js +1 -0
- package/dist/api/resources/commons/types/EventField.d.ts +1 -0
- package/dist/api/resources/commons/types/EventField.js +1 -0
- package/dist/api/resources/commons/types/MetadataPrecondition.d.ts +3 -1
- package/dist/api/resources/commons/types/PreconditionOperator.d.ts +20 -0
- package/dist/api/resources/commons/types/PreconditionOperator.js +20 -0
- package/dist/api/resources/commons/types/UserEvent.d.ts +2 -0
- package/dist/api/resources/commons/types/index.d.ts +3 -0
- package/dist/api/resources/commons/types/index.js +3 -0
- package/dist/api/resources/index.d.ts +4 -0
- package/dist/api/resources/index.js +5 -1
- package/dist/api/resources/knowledge/types/KnowledgeBaseResponse.d.ts +2 -0
- package/dist/api/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +1 -1
- package/dist/api/resources/segments/types/SegmentResponse.d.ts +6 -0
- package/dist/api/resources/triggers/types/index.d.ts +0 -1
- package/dist/api/resources/triggers/types/index.js +0 -1
- package/dist/api/resources/websockets/client/Client.d.ts +22 -0
- package/dist/api/resources/websockets/client/Client.js +89 -0
- package/dist/api/resources/websockets/client/Socket.d.ts +48 -0
- package/dist/api/resources/websockets/client/Socket.js +172 -0
- package/dist/api/resources/websockets/client/index.d.ts +1 -0
- package/dist/api/resources/websockets/client/index.js +2 -0
- package/dist/api/resources/websockets/index.d.ts +2 -0
- package/dist/api/resources/websockets/index.js +18 -0
- package/dist/api/resources/websockets/types/AgentAudioChunk.d.ts +9 -0
- package/dist/api/resources/websockets/types/AgentAudioChunk.js +3 -0
- package/dist/api/resources/websockets/types/AgentTranscript.d.ts +9 -0
- package/dist/api/resources/websockets/types/AgentTranscript.js +3 -0
- package/dist/api/resources/websockets/types/AudioFormat.d.ts +7 -0
- package/dist/api/resources/websockets/types/AudioFormat.js +10 -0
- package/dist/api/resources/websockets/types/Config.d.ts +15 -0
- package/dist/api/resources/websockets/types/Config.js +3 -0
- package/dist/api/resources/websockets/types/ConversationEnded.d.ts +7 -0
- package/dist/api/resources/websockets/types/ConversationEnded.js +3 -0
- package/dist/api/resources/websockets/types/ConversationReady.d.ts +6 -0
- package/dist/api/resources/websockets/types/ConversationReady.js +3 -0
- package/dist/api/resources/websockets/types/Error_.d.ts +9 -0
- package/dist/api/resources/websockets/types/Error_.js +3 -0
- package/dist/api/resources/websockets/types/ServerEventBase.d.ts +6 -0
- package/dist/api/resources/websockets/types/ServerEventBase.js +3 -0
- package/dist/api/resources/websockets/types/UserAudioChunk.d.ts +8 -0
- package/dist/api/resources/websockets/types/UserAudioChunk.js +3 -0
- package/dist/api/resources/websockets/types/UserFinishedSpeaking.d.ts +7 -0
- package/dist/api/resources/websockets/types/UserFinishedSpeaking.js +3 -0
- package/dist/api/resources/websockets/types/UserStartedSpeaking.d.ts +7 -0
- package/dist/api/resources/websockets/types/UserStartedSpeaking.js +3 -0
- package/dist/api/resources/websockets/types/UserTranscript.d.ts +9 -0
- package/dist/api/resources/websockets/types/UserTranscript.js +3 -0
- package/dist/api/resources/websockets/types/index.d.ts +12 -0
- package/dist/api/resources/websockets/types/index.js +28 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/websocket/events.d.ts +36 -0
- package/dist/core/websocket/events.js +27 -0
- package/dist/core/websocket/index.d.ts +1 -0
- package/dist/core/websocket/index.js +17 -0
- package/dist/core/websocket/ws.d.ts +147 -0
- package/dist/core/websocket/ws.js +444 -0
- package/dist/serialization/resources/auth/index.d.ts +1 -0
- package/dist/serialization/resources/auth/index.js +17 -0
- package/dist/serialization/resources/auth/types/SessionTokenRequest.d.ts +9 -0
- package/dist/serialization/resources/auth/types/SessionTokenRequest.js +41 -0
- package/dist/serialization/resources/auth/types/SessionTokenResponse.d.ts +10 -0
- package/dist/serialization/resources/auth/types/SessionTokenResponse.js +42 -0
- package/dist/serialization/resources/auth/types/index.d.ts +2 -0
- package/dist/serialization/resources/auth/types/index.js +18 -0
- package/dist/serialization/resources/commons/types/ActionBase.d.ts +3 -8
- package/dist/serialization/resources/commons/types/ActionBase.js +5 -9
- package/dist/serialization/resources/commons/types/ActionParameterType.d.ts +1 -1
- package/dist/serialization/resources/commons/types/ActionParameterType.js +1 -0
- package/dist/serialization/resources/commons/types/ActionProperties.d.ts +14 -0
- package/dist/serialization/resources/commons/types/ActionProperties.js +47 -0
- package/dist/serialization/resources/commons/types/ActionUser.d.ts +17 -0
- package/dist/serialization/resources/commons/types/ActionUser.js +49 -0
- package/dist/serialization/resources/commons/types/EntityType.d.ts +1 -1
- package/dist/serialization/resources/commons/types/EntityType.js +1 -0
- package/dist/serialization/resources/commons/types/EventField.d.ts +1 -1
- package/dist/serialization/resources/commons/types/EventField.js +1 -0
- package/dist/serialization/resources/commons/types/MetadataPrecondition.d.ts +1 -0
- package/dist/serialization/resources/commons/types/MetadataPrecondition.js +1 -0
- package/dist/serialization/resources/commons/types/PreconditionOperator.d.ts +1 -1
- package/dist/serialization/resources/commons/types/PreconditionOperator.js +9 -1
- package/dist/serialization/resources/commons/types/UserEvent.d.ts +1 -0
- package/dist/serialization/resources/commons/types/UserEvent.js +1 -0
- package/dist/serialization/resources/commons/types/index.d.ts +3 -0
- package/dist/serialization/resources/commons/types/index.js +3 -0
- package/dist/serialization/resources/index.d.ts +5 -0
- package/dist/serialization/resources/index.js +6 -1
- package/dist/serialization/resources/knowledge/types/KnowledgeBaseResponse.d.ts +1 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeBaseResponse.js +1 -0
- package/dist/serialization/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +1 -1
- package/dist/serialization/resources/knowledge/types/KnowledgeDocumentRequest.js +1 -1
- package/dist/serialization/resources/segments/types/SegmentResponse.d.ts +2 -0
- package/dist/serialization/resources/segments/types/SegmentResponse.js +2 -0
- package/dist/serialization/resources/triggers/types/EventTriggerBase.d.ts +1 -1
- package/dist/serialization/resources/triggers/types/EventTriggerBase.js +1 -1
- package/dist/serialization/resources/triggers/types/index.d.ts +0 -1
- package/dist/serialization/resources/triggers/types/index.js +0 -1
- package/dist/serialization/resources/websockets/client/index.d.ts +1 -0
- package/dist/serialization/resources/websockets/client/index.js +17 -0
- package/dist/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.d.ts +15 -0
- package/dist/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.js +56 -0
- package/dist/serialization/resources/websockets/client/socket/index.d.ts +1 -0
- package/dist/serialization/resources/websockets/client/socket/index.js +5 -0
- package/dist/serialization/resources/websockets/index.d.ts +2 -0
- package/dist/serialization/resources/websockets/index.js +18 -0
- package/dist/serialization/resources/websockets/types/AgentAudioChunk.d.ts +11 -0
- package/dist/serialization/resources/websockets/types/AgentAudioChunk.js +45 -0
- package/dist/serialization/resources/websockets/types/AgentTranscript.d.ts +11 -0
- package/dist/serialization/resources/websockets/types/AgentTranscript.js +45 -0
- package/dist/serialization/resources/websockets/types/AudioFormat.d.ts +7 -0
- package/dist/serialization/resources/websockets/types/AudioFormat.js +39 -0
- package/dist/serialization/resources/websockets/types/Config.d.ts +14 -0
- package/dist/serialization/resources/websockets/types/Config.js +46 -0
- package/dist/serialization/resources/websockets/types/ConversationEnded.d.ts +10 -0
- package/dist/serialization/resources/websockets/types/ConversationEnded.js +44 -0
- package/dist/serialization/resources/websockets/types/ConversationReady.d.ts +9 -0
- package/dist/serialization/resources/websockets/types/ConversationReady.js +41 -0
- package/dist/serialization/resources/websockets/types/Error_.d.ts +12 -0
- package/dist/serialization/resources/websockets/types/Error_.js +46 -0
- package/dist/serialization/resources/websockets/types/ServerEventBase.d.ts +9 -0
- package/dist/serialization/resources/websockets/types/ServerEventBase.js +41 -0
- package/dist/serialization/resources/websockets/types/UserAudioChunk.d.ts +10 -0
- package/dist/serialization/resources/websockets/types/UserAudioChunk.js +42 -0
- package/dist/serialization/resources/websockets/types/UserFinishedSpeaking.d.ts +10 -0
- package/dist/serialization/resources/websockets/types/UserFinishedSpeaking.js +44 -0
- package/dist/serialization/resources/websockets/types/UserStartedSpeaking.d.ts +10 -0
- package/dist/serialization/resources/websockets/types/UserStartedSpeaking.js +44 -0
- package/dist/serialization/resources/websockets/types/UserTranscript.d.ts +11 -0
- package/dist/serialization/resources/websockets/types/UserTranscript.js +45 -0
- package/dist/serialization/resources/websockets/types/index.d.ts +12 -0
- package/dist/serialization/resources/websockets/types/index.js +28 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -1
- package/reference.md +73 -5
- package/serialization/resources/auth/index.d.ts +1 -0
- package/serialization/resources/auth/index.js +17 -0
- package/serialization/resources/auth/types/SessionTokenRequest.d.ts +9 -0
- package/serialization/resources/auth/types/SessionTokenRequest.js +41 -0
- package/serialization/resources/auth/types/SessionTokenResponse.d.ts +10 -0
- package/serialization/resources/auth/types/SessionTokenResponse.js +42 -0
- package/serialization/resources/auth/types/index.d.ts +2 -0
- package/serialization/resources/auth/types/index.js +18 -0
- package/serialization/resources/commons/types/ActionBase.d.ts +3 -8
- package/serialization/resources/commons/types/ActionBase.js +5 -9
- package/serialization/resources/commons/types/ActionParameterType.d.ts +1 -1
- package/serialization/resources/commons/types/ActionParameterType.js +1 -0
- package/serialization/resources/commons/types/ActionProperties.d.ts +14 -0
- package/serialization/resources/commons/types/ActionProperties.js +47 -0
- package/serialization/resources/commons/types/ActionUser.d.ts +17 -0
- package/serialization/resources/commons/types/ActionUser.js +49 -0
- package/serialization/resources/commons/types/EntityType.d.ts +1 -1
- package/serialization/resources/commons/types/EntityType.js +1 -0
- package/serialization/resources/commons/types/EventField.d.ts +1 -1
- package/serialization/resources/commons/types/EventField.js +1 -0
- package/serialization/resources/commons/types/MetadataPrecondition.d.ts +1 -0
- package/serialization/resources/commons/types/MetadataPrecondition.js +1 -0
- package/serialization/resources/commons/types/PreconditionOperator.d.ts +1 -1
- package/serialization/resources/commons/types/PreconditionOperator.js +9 -1
- package/serialization/resources/commons/types/UserEvent.d.ts +1 -0
- package/serialization/resources/commons/types/UserEvent.js +1 -0
- package/serialization/resources/commons/types/index.d.ts +3 -0
- package/serialization/resources/commons/types/index.js +3 -0
- package/serialization/resources/index.d.ts +5 -0
- package/serialization/resources/index.js +6 -1
- package/serialization/resources/knowledge/types/KnowledgeBaseResponse.d.ts +1 -0
- package/serialization/resources/knowledge/types/KnowledgeBaseResponse.js +1 -0
- package/serialization/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +1 -1
- package/serialization/resources/knowledge/types/KnowledgeDocumentRequest.js +1 -1
- package/serialization/resources/segments/types/SegmentResponse.d.ts +2 -0
- package/serialization/resources/segments/types/SegmentResponse.js +2 -0
- package/serialization/resources/triggers/types/EventTriggerBase.d.ts +1 -1
- package/serialization/resources/triggers/types/EventTriggerBase.js +1 -1
- package/serialization/resources/triggers/types/index.d.ts +0 -1
- package/serialization/resources/triggers/types/index.js +0 -1
- package/serialization/resources/websockets/client/index.d.ts +1 -0
- package/serialization/resources/websockets/client/index.js +17 -0
- package/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.d.ts +15 -0
- package/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.js +56 -0
- package/serialization/resources/websockets/client/socket/index.d.ts +1 -0
- package/serialization/resources/websockets/client/socket/index.js +5 -0
- package/serialization/resources/websockets/index.d.ts +2 -0
- package/serialization/resources/websockets/index.js +18 -0
- package/serialization/resources/websockets/types/AgentAudioChunk.d.ts +11 -0
- package/serialization/resources/websockets/types/AgentAudioChunk.js +45 -0
- package/serialization/resources/websockets/types/AgentTranscript.d.ts +11 -0
- package/serialization/resources/websockets/types/AgentTranscript.js +45 -0
- package/serialization/resources/websockets/types/AudioFormat.d.ts +7 -0
- package/serialization/resources/websockets/types/AudioFormat.js +39 -0
- package/serialization/resources/websockets/types/Config.d.ts +14 -0
- package/serialization/resources/websockets/types/Config.js +46 -0
- package/serialization/resources/websockets/types/ConversationEnded.d.ts +10 -0
- package/serialization/resources/websockets/types/ConversationEnded.js +44 -0
- package/serialization/resources/websockets/types/ConversationReady.d.ts +9 -0
- package/serialization/resources/websockets/types/ConversationReady.js +41 -0
- package/serialization/resources/websockets/types/Error_.d.ts +12 -0
- package/serialization/resources/websockets/types/Error_.js +46 -0
- package/serialization/resources/websockets/types/ServerEventBase.d.ts +9 -0
- package/serialization/resources/websockets/types/ServerEventBase.js +41 -0
- package/serialization/resources/websockets/types/UserAudioChunk.d.ts +10 -0
- package/serialization/resources/websockets/types/UserAudioChunk.js +42 -0
- package/serialization/resources/websockets/types/UserFinishedSpeaking.d.ts +10 -0
- package/serialization/resources/websockets/types/UserFinishedSpeaking.js +44 -0
- package/serialization/resources/websockets/types/UserStartedSpeaking.d.ts +10 -0
- package/serialization/resources/websockets/types/UserStartedSpeaking.js +44 -0
- package/serialization/resources/websockets/types/UserTranscript.d.ts +11 -0
- package/serialization/resources/websockets/types/UserTranscript.js +45 -0
- package/serialization/resources/websockets/types/index.d.ts +12 -0
- package/serialization/resources/websockets/types/index.js +28 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- /package/api/resources/{triggers → commons}/types/EventTriggerType.d.ts +0 -0
- /package/api/resources/{triggers → commons}/types/EventTriggerType.js +0 -0
- /package/dist/api/resources/{triggers → commons}/types/EventTriggerType.d.ts +0 -0
- /package/dist/api/resources/{triggers → commons}/types/EventTriggerType.js +0 -0
- /package/dist/serialization/resources/{triggers → commons}/types/EventTriggerType.d.ts +0 -0
- /package/dist/serialization/resources/{triggers → commons}/types/EventTriggerType.js +0 -0
- /package/serialization/resources/{triggers → commons}/types/EventTriggerType.d.ts +0 -0
- /package/serialization/resources/{triggers → commons}/types/EventTriggerType.js +0 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ReconnectingWebSocket = void 0;
|
|
37
|
+
const ws_1 = require("ws");
|
|
38
|
+
const runtime_1 = require("../runtime");
|
|
39
|
+
const qs_1 = require("../url/qs");
|
|
40
|
+
const Events = __importStar(require("./events"));
|
|
41
|
+
const getGlobalWebSocket = () => {
|
|
42
|
+
if (typeof WebSocket !== "undefined") {
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
return WebSocket;
|
|
45
|
+
}
|
|
46
|
+
else if (runtime_1.RUNTIME.type === "node") {
|
|
47
|
+
return ws_1.WebSocket;
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Returns true if given argument looks like a WebSocket class
|
|
53
|
+
*/
|
|
54
|
+
const isWebSocket = (w) => typeof w !== "undefined" && !!w && w.CLOSING === 2;
|
|
55
|
+
const DEFAULT_OPTIONS = {
|
|
56
|
+
maxReconnectionDelay: 10000,
|
|
57
|
+
minReconnectionDelay: 1000 + Math.random() * 4000,
|
|
58
|
+
minUptime: 5000,
|
|
59
|
+
reconnectionDelayGrowFactor: 1.3,
|
|
60
|
+
connectionTimeout: 4000,
|
|
61
|
+
maxRetries: Infinity,
|
|
62
|
+
maxEnqueuedMessages: Infinity,
|
|
63
|
+
startClosed: false,
|
|
64
|
+
debug: false,
|
|
65
|
+
};
|
|
66
|
+
class ReconnectingWebSocket {
|
|
67
|
+
constructor({ url, protocols, options, headers, queryParameters }) {
|
|
68
|
+
this._listeners = {
|
|
69
|
+
error: [],
|
|
70
|
+
message: [],
|
|
71
|
+
open: [],
|
|
72
|
+
close: [],
|
|
73
|
+
};
|
|
74
|
+
this._retryCount = -1;
|
|
75
|
+
this._shouldReconnect = true;
|
|
76
|
+
this._connectLock = false;
|
|
77
|
+
this._binaryType = "blob";
|
|
78
|
+
this._closeCalled = false;
|
|
79
|
+
this._messageQueue = [];
|
|
80
|
+
this.CONNECTING = ReconnectingWebSocket.CONNECTING;
|
|
81
|
+
this.OPEN = ReconnectingWebSocket.OPEN;
|
|
82
|
+
this.CLOSING = ReconnectingWebSocket.CLOSING;
|
|
83
|
+
this.CLOSED = ReconnectingWebSocket.CLOSED;
|
|
84
|
+
/**
|
|
85
|
+
* An event listener to be called when the WebSocket connection's readyState changes to CLOSED
|
|
86
|
+
*/
|
|
87
|
+
this.onclose = null;
|
|
88
|
+
/**
|
|
89
|
+
* An event listener to be called when an error occurs
|
|
90
|
+
*/
|
|
91
|
+
this.onerror = null;
|
|
92
|
+
/**
|
|
93
|
+
* An event listener to be called when a message is received from the server
|
|
94
|
+
*/
|
|
95
|
+
this.onmessage = null;
|
|
96
|
+
/**
|
|
97
|
+
* An event listener to be called when the WebSocket connection's readyState changes to OPEN;
|
|
98
|
+
* this indicates that the connection is ready to send and receive data
|
|
99
|
+
*/
|
|
100
|
+
this.onopen = null;
|
|
101
|
+
this._handleOpen = (event) => {
|
|
102
|
+
this._debug("open event");
|
|
103
|
+
const { minUptime = DEFAULT_OPTIONS.minUptime } = this._options;
|
|
104
|
+
clearTimeout(this._connectTimeout);
|
|
105
|
+
this._uptimeTimeout = setTimeout(() => this._acceptOpen(), minUptime);
|
|
106
|
+
this._ws.binaryType = this._binaryType;
|
|
107
|
+
// send enqueued messages (messages sent before websocket open event)
|
|
108
|
+
this._messageQueue.forEach((message) => { var _a; return (_a = this._ws) === null || _a === void 0 ? void 0 : _a.send(message); });
|
|
109
|
+
this._messageQueue = [];
|
|
110
|
+
if (this.onopen) {
|
|
111
|
+
this.onopen(event);
|
|
112
|
+
}
|
|
113
|
+
this._listeners.open.forEach((listener) => this._callEventListener(event, listener));
|
|
114
|
+
};
|
|
115
|
+
this._handleMessage = (event) => {
|
|
116
|
+
this._debug("message event");
|
|
117
|
+
if (this.onmessage) {
|
|
118
|
+
this.onmessage(event);
|
|
119
|
+
}
|
|
120
|
+
this._listeners.message.forEach((listener) => this._callEventListener(event, listener));
|
|
121
|
+
};
|
|
122
|
+
this._handleError = (event) => {
|
|
123
|
+
this._debug("error event", event.message);
|
|
124
|
+
this._disconnect(undefined, event.message === "TIMEOUT" ? "timeout" : undefined);
|
|
125
|
+
if (this.onerror) {
|
|
126
|
+
this.onerror(event);
|
|
127
|
+
}
|
|
128
|
+
this._debug("exec error listeners");
|
|
129
|
+
this._listeners.error.forEach((listener) => this._callEventListener(event, listener));
|
|
130
|
+
this._connect();
|
|
131
|
+
};
|
|
132
|
+
this._handleClose = (event) => {
|
|
133
|
+
this._debug("close event");
|
|
134
|
+
this._clearTimeouts();
|
|
135
|
+
if (event.code === 1000) {
|
|
136
|
+
this._shouldReconnect = false;
|
|
137
|
+
}
|
|
138
|
+
if (this._shouldReconnect) {
|
|
139
|
+
this._connect();
|
|
140
|
+
}
|
|
141
|
+
if (this.onclose) {
|
|
142
|
+
this.onclose(event);
|
|
143
|
+
}
|
|
144
|
+
this._listeners.close.forEach((listener) => this._callEventListener(event, listener));
|
|
145
|
+
};
|
|
146
|
+
this._url = url;
|
|
147
|
+
this._protocols = protocols;
|
|
148
|
+
this._options = options !== null && options !== void 0 ? options : DEFAULT_OPTIONS;
|
|
149
|
+
this._headers = headers;
|
|
150
|
+
this._queryParameters = queryParameters;
|
|
151
|
+
if (this._options.startClosed) {
|
|
152
|
+
this._shouldReconnect = false;
|
|
153
|
+
}
|
|
154
|
+
this._connect();
|
|
155
|
+
}
|
|
156
|
+
get binaryType() {
|
|
157
|
+
return this._ws ? this._ws.binaryType : this._binaryType;
|
|
158
|
+
}
|
|
159
|
+
set binaryType(value) {
|
|
160
|
+
this._binaryType = value;
|
|
161
|
+
if (this._ws) {
|
|
162
|
+
this._ws.binaryType = value;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns the number or connection retries
|
|
167
|
+
*/
|
|
168
|
+
get retryCount() {
|
|
169
|
+
return Math.max(this._retryCount, 0);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The number of bytes of data that have been queued using calls to send() but not yet
|
|
173
|
+
* transmitted to the network. This value resets to zero once all queued data has been sent.
|
|
174
|
+
* This value does not reset to zero when the connection is closed; if you keep calling send(),
|
|
175
|
+
* this will continue to climb. Read only
|
|
176
|
+
*/
|
|
177
|
+
get bufferedAmount() {
|
|
178
|
+
const bytes = this._messageQueue.reduce((acc, message) => {
|
|
179
|
+
if (typeof message === "string") {
|
|
180
|
+
acc += message.length; // not byte size
|
|
181
|
+
}
|
|
182
|
+
else if (message instanceof Blob) {
|
|
183
|
+
acc += message.size;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
acc += message.byteLength;
|
|
187
|
+
}
|
|
188
|
+
return acc;
|
|
189
|
+
}, 0);
|
|
190
|
+
return bytes + (this._ws ? this._ws.bufferedAmount : 0);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The extensions selected by the server. This is currently only the empty string or a list of
|
|
194
|
+
* extensions as negotiated by the connection
|
|
195
|
+
*/
|
|
196
|
+
get extensions() {
|
|
197
|
+
return this._ws ? this._ws.extensions : "";
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* A string indicating the name of the sub-protocol the server selected;
|
|
201
|
+
* this will be one of the strings specified in the protocols parameter when creating the
|
|
202
|
+
* WebSocket object
|
|
203
|
+
*/
|
|
204
|
+
get protocol() {
|
|
205
|
+
return this._ws ? this._ws.protocol : "";
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The current state of the connection; this is one of the Ready state constants
|
|
209
|
+
*/
|
|
210
|
+
get readyState() {
|
|
211
|
+
if (this._ws) {
|
|
212
|
+
return this._ws.readyState;
|
|
213
|
+
}
|
|
214
|
+
return this._options.startClosed ? ReconnectingWebSocket.CLOSED : ReconnectingWebSocket.CONNECTING;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The URL as resolved by the constructor
|
|
218
|
+
*/
|
|
219
|
+
get url() {
|
|
220
|
+
return this._ws ? this._ws.url : "";
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Closes the WebSocket connection or connection attempt, if any. If the connection is already
|
|
224
|
+
* CLOSED, this method does nothing
|
|
225
|
+
*/
|
|
226
|
+
close(code = 1000, reason) {
|
|
227
|
+
this._closeCalled = true;
|
|
228
|
+
this._shouldReconnect = false;
|
|
229
|
+
this._clearTimeouts();
|
|
230
|
+
if (!this._ws) {
|
|
231
|
+
this._debug("close enqueued: no ws instance");
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (this._ws.readyState === this.CLOSED) {
|
|
235
|
+
this._debug("close: already closed");
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
this._ws.close(code, reason);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Closes the WebSocket connection or connection attempt and connects again.
|
|
242
|
+
* Resets retry counter;
|
|
243
|
+
*/
|
|
244
|
+
reconnect(code, reason) {
|
|
245
|
+
this._shouldReconnect = true;
|
|
246
|
+
this._closeCalled = false;
|
|
247
|
+
this._retryCount = -1;
|
|
248
|
+
if (!this._ws || this._ws.readyState === this.CLOSED) {
|
|
249
|
+
this._connect();
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
this._disconnect(code, reason);
|
|
253
|
+
this._connect();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Enqueue specified data to be transmitted to the server over the WebSocket connection
|
|
258
|
+
*/
|
|
259
|
+
send(data) {
|
|
260
|
+
if (this._ws && this._ws.readyState === this.OPEN) {
|
|
261
|
+
this._debug("send", data);
|
|
262
|
+
this._ws.send(data);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
const { maxEnqueuedMessages = DEFAULT_OPTIONS.maxEnqueuedMessages } = this._options;
|
|
266
|
+
if (this._messageQueue.length < maxEnqueuedMessages) {
|
|
267
|
+
this._debug("enqueue", data);
|
|
268
|
+
this._messageQueue.push(data);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Register an event handler of a specific event type
|
|
274
|
+
*/
|
|
275
|
+
addEventListener(type, listener) {
|
|
276
|
+
if (this._listeners[type]) {
|
|
277
|
+
// @ts-ignore
|
|
278
|
+
this._listeners[type].push(listener);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
dispatchEvent(event) {
|
|
282
|
+
const listeners = this._listeners[event.type];
|
|
283
|
+
if (listeners) {
|
|
284
|
+
for (const listener of listeners) {
|
|
285
|
+
this._callEventListener(event, listener);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Removes an event listener
|
|
292
|
+
*/
|
|
293
|
+
removeEventListener(type, listener) {
|
|
294
|
+
if (this._listeners[type]) {
|
|
295
|
+
// @ts-ignore
|
|
296
|
+
this._listeners[type] = this._listeners[type].filter(
|
|
297
|
+
// @ts-ignore
|
|
298
|
+
(l) => l !== listener);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
_debug(...args) {
|
|
302
|
+
if (this._options.debug) {
|
|
303
|
+
// not using spread because compiled version uses Symbols
|
|
304
|
+
// tslint:disable-next-line
|
|
305
|
+
// biome-ignore lint/suspicious/noConsole: allow console
|
|
306
|
+
console.log.apply(console, ["RWS>", ...args]);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
_getNextDelay() {
|
|
310
|
+
const { reconnectionDelayGrowFactor = DEFAULT_OPTIONS.reconnectionDelayGrowFactor, minReconnectionDelay = DEFAULT_OPTIONS.minReconnectionDelay, maxReconnectionDelay = DEFAULT_OPTIONS.maxReconnectionDelay, } = this._options;
|
|
311
|
+
let delay = 0;
|
|
312
|
+
if (this._retryCount > 0) {
|
|
313
|
+
delay = minReconnectionDelay * Math.pow(reconnectionDelayGrowFactor, (this._retryCount - 1));
|
|
314
|
+
if (delay > maxReconnectionDelay) {
|
|
315
|
+
delay = maxReconnectionDelay;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
this._debug("next delay", delay);
|
|
319
|
+
return delay;
|
|
320
|
+
}
|
|
321
|
+
_wait() {
|
|
322
|
+
return new Promise((resolve) => {
|
|
323
|
+
setTimeout(resolve, this._getNextDelay());
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
_getNextUrl(urlProvider) {
|
|
327
|
+
if (typeof urlProvider === "string") {
|
|
328
|
+
return Promise.resolve(urlProvider);
|
|
329
|
+
}
|
|
330
|
+
if (typeof urlProvider === "function") {
|
|
331
|
+
const url = urlProvider();
|
|
332
|
+
if (typeof url === "string") {
|
|
333
|
+
return Promise.resolve(url);
|
|
334
|
+
}
|
|
335
|
+
// @ts-ignore redundant check
|
|
336
|
+
if (url.then) {
|
|
337
|
+
return url;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
throw Error("Invalid URL");
|
|
341
|
+
}
|
|
342
|
+
_connect() {
|
|
343
|
+
if (this._connectLock || !this._shouldReconnect) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
this._connectLock = true;
|
|
347
|
+
const { maxRetries = DEFAULT_OPTIONS.maxRetries, connectionTimeout = DEFAULT_OPTIONS.connectionTimeout, WebSocket = getGlobalWebSocket(), } = this._options;
|
|
348
|
+
if (this._retryCount >= maxRetries) {
|
|
349
|
+
this._debug("max retries reached", this._retryCount, ">=", maxRetries);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
this._retryCount++;
|
|
353
|
+
this._debug("connect", this._retryCount);
|
|
354
|
+
this._removeListeners();
|
|
355
|
+
if (!isWebSocket(WebSocket)) {
|
|
356
|
+
throw Error("No valid WebSocket class provided");
|
|
357
|
+
}
|
|
358
|
+
this._wait()
|
|
359
|
+
.then(() => this._getNextUrl(this._url))
|
|
360
|
+
.then((url) => {
|
|
361
|
+
if (this._closeCalled) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const options = {};
|
|
365
|
+
if (this._headers) {
|
|
366
|
+
options.headers = this._headers;
|
|
367
|
+
}
|
|
368
|
+
if (this._queryParameters && Object.keys(this._queryParameters).length > 0) {
|
|
369
|
+
const queryString = (0, qs_1.toQueryString)(this._queryParameters, { arrayFormat: "repeat" });
|
|
370
|
+
if (queryString) {
|
|
371
|
+
url = `${url}?${queryString}`;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
this._ws = new WebSocket(url, this._protocols, options);
|
|
375
|
+
this._ws.binaryType = this._binaryType;
|
|
376
|
+
this._connectLock = false;
|
|
377
|
+
this._addListeners();
|
|
378
|
+
this._connectTimeout = setTimeout(() => this._handleTimeout(), connectionTimeout);
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
_handleTimeout() {
|
|
382
|
+
this._debug("timeout event");
|
|
383
|
+
this._handleError(new Events.ErrorEvent(Error("TIMEOUT"), this));
|
|
384
|
+
}
|
|
385
|
+
_disconnect(code = 1000, reason) {
|
|
386
|
+
this._clearTimeouts();
|
|
387
|
+
if (!this._ws) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
this._removeListeners();
|
|
391
|
+
try {
|
|
392
|
+
this._ws.close(code, reason);
|
|
393
|
+
this._handleClose(new Events.CloseEvent(code, reason, this));
|
|
394
|
+
}
|
|
395
|
+
catch (_error) {
|
|
396
|
+
// ignore
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
_acceptOpen() {
|
|
400
|
+
this._debug("accept open");
|
|
401
|
+
this._retryCount = 0;
|
|
402
|
+
}
|
|
403
|
+
_callEventListener(event, listener) {
|
|
404
|
+
if ("handleEvent" in listener) {
|
|
405
|
+
// @ts-ignore
|
|
406
|
+
listener.handleEvent(event);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
// @ts-ignore
|
|
410
|
+
listener(event);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
_removeListeners() {
|
|
414
|
+
if (!this._ws) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
this._debug("removeListeners");
|
|
418
|
+
this._ws.removeEventListener("open", this._handleOpen);
|
|
419
|
+
this._ws.removeEventListener("close", this._handleClose);
|
|
420
|
+
this._ws.removeEventListener("message", this._handleMessage);
|
|
421
|
+
// @ts-ignore
|
|
422
|
+
this._ws.removeEventListener("error", this._handleError);
|
|
423
|
+
}
|
|
424
|
+
_addListeners() {
|
|
425
|
+
if (!this._ws) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
this._debug("addListeners");
|
|
429
|
+
this._ws.addEventListener("open", this._handleOpen);
|
|
430
|
+
this._ws.addEventListener("close", this._handleClose);
|
|
431
|
+
this._ws.addEventListener("message", this._handleMessage);
|
|
432
|
+
// @ts-ignore
|
|
433
|
+
this._ws.addEventListener("error", this._handleError);
|
|
434
|
+
}
|
|
435
|
+
_clearTimeouts() {
|
|
436
|
+
clearTimeout(this._connectTimeout);
|
|
437
|
+
clearTimeout(this._uptimeTimeout);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
exports.ReconnectingWebSocket = ReconnectingWebSocket;
|
|
441
|
+
ReconnectingWebSocket.CONNECTING = 0;
|
|
442
|
+
ReconnectingWebSocket.OPEN = 1;
|
|
443
|
+
ReconnectingWebSocket.CLOSING = 2;
|
|
444
|
+
ReconnectingWebSocket.CLOSED = 3;
|
package/dist/Client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Agents } from "./api/resources/agents/client/Client";
|
|
|
3
3
|
import { Analytics } from "./api/resources/analytics/client/Client";
|
|
4
4
|
import { AppSettings } from "./api/resources/appSettings/client/Client";
|
|
5
5
|
import { Assets } from "./api/resources/assets/client/Client";
|
|
6
|
+
import { Auth } from "./api/resources/auth/client/Client";
|
|
6
7
|
import { Conversation } from "./api/resources/conversation/client/Client";
|
|
7
8
|
import { Customers } from "./api/resources/customers/client/Client";
|
|
8
9
|
import { Events } from "./api/resources/events/client/Client";
|
|
@@ -13,6 +14,7 @@ import { Segments } from "./api/resources/segments/client/Client";
|
|
|
13
14
|
import { Translations } from "./api/resources/translations/client/Client";
|
|
14
15
|
import { Triggers } from "./api/resources/triggers/client/Client";
|
|
15
16
|
import { Users } from "./api/resources/users/client/Client";
|
|
17
|
+
import { Websockets } from "./api/resources/websockets/client/Client";
|
|
16
18
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient";
|
|
17
19
|
export declare namespace MavenAGIClient {
|
|
18
20
|
interface Options extends BaseClientOptions {
|
|
@@ -27,6 +29,7 @@ export declare class MavenAGIClient {
|
|
|
27
29
|
protected _analytics: Analytics | undefined;
|
|
28
30
|
protected _appSettings: AppSettings | undefined;
|
|
29
31
|
protected _assets: Assets | undefined;
|
|
32
|
+
protected _auth: Auth | undefined;
|
|
30
33
|
protected _conversation: Conversation | undefined;
|
|
31
34
|
protected _customers: Customers | undefined;
|
|
32
35
|
protected _events: Events | undefined;
|
|
@@ -37,12 +40,14 @@ export declare class MavenAGIClient {
|
|
|
37
40
|
protected _translations: Translations | undefined;
|
|
38
41
|
protected _triggers: Triggers | undefined;
|
|
39
42
|
protected _users: Users | undefined;
|
|
43
|
+
protected _websockets: Websockets | undefined;
|
|
40
44
|
constructor(_options: MavenAGIClient.Options);
|
|
41
45
|
get actions(): Actions;
|
|
42
46
|
get agents(): Agents;
|
|
43
47
|
get analytics(): Analytics;
|
|
44
48
|
get appSettings(): AppSettings;
|
|
45
49
|
get assets(): Assets;
|
|
50
|
+
get auth(): Auth;
|
|
46
51
|
get conversation(): Conversation;
|
|
47
52
|
get customers(): Customers;
|
|
48
53
|
get events(): Events;
|
|
@@ -53,4 +58,5 @@ export declare class MavenAGIClient {
|
|
|
53
58
|
get translations(): Translations;
|
|
54
59
|
get triggers(): Triggers;
|
|
55
60
|
get users(): Users;
|
|
61
|
+
get websockets(): Websockets;
|
|
56
62
|
}
|
package/dist/Client.js
CHANGED
|
@@ -40,16 +40,18 @@ const Client_2 = require("./api/resources/agents/client/Client");
|
|
|
40
40
|
const Client_3 = require("./api/resources/analytics/client/Client");
|
|
41
41
|
const Client_4 = require("./api/resources/appSettings/client/Client");
|
|
42
42
|
const Client_5 = require("./api/resources/assets/client/Client");
|
|
43
|
-
const Client_6 = require("./api/resources/
|
|
44
|
-
const Client_7 = require("./api/resources/
|
|
45
|
-
const Client_8 = require("./api/resources/
|
|
46
|
-
const Client_9 = require("./api/resources/
|
|
47
|
-
const Client_10 = require("./api/resources/
|
|
48
|
-
const Client_11 = require("./api/resources/
|
|
49
|
-
const Client_12 = require("./api/resources/
|
|
50
|
-
const Client_13 = require("./api/resources/
|
|
51
|
-
const Client_14 = require("./api/resources/
|
|
52
|
-
const Client_15 = require("./api/resources/
|
|
43
|
+
const Client_6 = require("./api/resources/auth/client/Client");
|
|
44
|
+
const Client_7 = require("./api/resources/conversation/client/Client");
|
|
45
|
+
const Client_8 = require("./api/resources/customers/client/Client");
|
|
46
|
+
const Client_9 = require("./api/resources/events/client/Client");
|
|
47
|
+
const Client_10 = require("./api/resources/inbox/client/Client");
|
|
48
|
+
const Client_11 = require("./api/resources/knowledge/client/Client");
|
|
49
|
+
const Client_12 = require("./api/resources/organizations/client/Client");
|
|
50
|
+
const Client_13 = require("./api/resources/segments/client/Client");
|
|
51
|
+
const Client_14 = require("./api/resources/translations/client/Client");
|
|
52
|
+
const Client_15 = require("./api/resources/triggers/client/Client");
|
|
53
|
+
const Client_16 = require("./api/resources/users/client/Client");
|
|
54
|
+
const Client_17 = require("./api/resources/websockets/client/Client");
|
|
53
55
|
const core = __importStar(require("./core"));
|
|
54
56
|
const headers_1 = require("./core/headers");
|
|
55
57
|
class MavenAGIClient {
|
|
@@ -59,8 +61,8 @@ class MavenAGIClient {
|
|
|
59
61
|
"X-Agent-Id": _options === null || _options === void 0 ? void 0 : _options.agentId,
|
|
60
62
|
"X-Fern-Language": "JavaScript",
|
|
61
63
|
"X-Fern-SDK-Name": "mavenagi",
|
|
62
|
-
"X-Fern-SDK-Version": "1.2.
|
|
63
|
-
"User-Agent": "mavenagi/1.2.
|
|
64
|
+
"X-Fern-SDK-Version": "1.2.12",
|
|
65
|
+
"User-Agent": "mavenagi/1.2.12",
|
|
64
66
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
65
67
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
66
68
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -85,45 +87,53 @@ class MavenAGIClient {
|
|
|
85
87
|
var _a;
|
|
86
88
|
return ((_a = this._assets) !== null && _a !== void 0 ? _a : (this._assets = new Client_5.Assets(this._options)));
|
|
87
89
|
}
|
|
90
|
+
get auth() {
|
|
91
|
+
var _a;
|
|
92
|
+
return ((_a = this._auth) !== null && _a !== void 0 ? _a : (this._auth = new Client_6.Auth(this._options)));
|
|
93
|
+
}
|
|
88
94
|
get conversation() {
|
|
89
95
|
var _a;
|
|
90
|
-
return ((_a = this._conversation) !== null && _a !== void 0 ? _a : (this._conversation = new
|
|
96
|
+
return ((_a = this._conversation) !== null && _a !== void 0 ? _a : (this._conversation = new Client_7.Conversation(this._options)));
|
|
91
97
|
}
|
|
92
98
|
get customers() {
|
|
93
99
|
var _a;
|
|
94
|
-
return ((_a = this._customers) !== null && _a !== void 0 ? _a : (this._customers = new
|
|
100
|
+
return ((_a = this._customers) !== null && _a !== void 0 ? _a : (this._customers = new Client_8.Customers(this._options)));
|
|
95
101
|
}
|
|
96
102
|
get events() {
|
|
97
103
|
var _a;
|
|
98
|
-
return ((_a = this._events) !== null && _a !== void 0 ? _a : (this._events = new
|
|
104
|
+
return ((_a = this._events) !== null && _a !== void 0 ? _a : (this._events = new Client_9.Events(this._options)));
|
|
99
105
|
}
|
|
100
106
|
get inbox() {
|
|
101
107
|
var _a;
|
|
102
|
-
return ((_a = this._inbox) !== null && _a !== void 0 ? _a : (this._inbox = new
|
|
108
|
+
return ((_a = this._inbox) !== null && _a !== void 0 ? _a : (this._inbox = new Client_10.Inbox(this._options)));
|
|
103
109
|
}
|
|
104
110
|
get knowledge() {
|
|
105
111
|
var _a;
|
|
106
|
-
return ((_a = this._knowledge) !== null && _a !== void 0 ? _a : (this._knowledge = new
|
|
112
|
+
return ((_a = this._knowledge) !== null && _a !== void 0 ? _a : (this._knowledge = new Client_11.Knowledge(this._options)));
|
|
107
113
|
}
|
|
108
114
|
get organizations() {
|
|
109
115
|
var _a;
|
|
110
|
-
return ((_a = this._organizations) !== null && _a !== void 0 ? _a : (this._organizations = new
|
|
116
|
+
return ((_a = this._organizations) !== null && _a !== void 0 ? _a : (this._organizations = new Client_12.Organizations(this._options)));
|
|
111
117
|
}
|
|
112
118
|
get segments() {
|
|
113
119
|
var _a;
|
|
114
|
-
return ((_a = this._segments) !== null && _a !== void 0 ? _a : (this._segments = new
|
|
120
|
+
return ((_a = this._segments) !== null && _a !== void 0 ? _a : (this._segments = new Client_13.Segments(this._options)));
|
|
115
121
|
}
|
|
116
122
|
get translations() {
|
|
117
123
|
var _a;
|
|
118
|
-
return ((_a = this._translations) !== null && _a !== void 0 ? _a : (this._translations = new
|
|
124
|
+
return ((_a = this._translations) !== null && _a !== void 0 ? _a : (this._translations = new Client_14.Translations(this._options)));
|
|
119
125
|
}
|
|
120
126
|
get triggers() {
|
|
121
127
|
var _a;
|
|
122
|
-
return ((_a = this._triggers) !== null && _a !== void 0 ? _a : (this._triggers = new
|
|
128
|
+
return ((_a = this._triggers) !== null && _a !== void 0 ? _a : (this._triggers = new Client_15.Triggers(this._options)));
|
|
123
129
|
}
|
|
124
130
|
get users() {
|
|
125
131
|
var _a;
|
|
126
|
-
return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new
|
|
132
|
+
return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_16.Users(this._options)));
|
|
133
|
+
}
|
|
134
|
+
get websockets() {
|
|
135
|
+
var _a;
|
|
136
|
+
return ((_a = this._websockets) !== null && _a !== void 0 ? _a : (this._websockets = new Client_17.Websockets(this._options)));
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
139
|
exports.MavenAGIClient = MavenAGIClient;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient";
|
|
2
|
+
import * as core from "../../../../core";
|
|
3
|
+
import * as MavenAGI from "../../../index";
|
|
4
|
+
export declare namespace Auth {
|
|
5
|
+
interface Options extends BaseClientOptions {
|
|
6
|
+
}
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class Auth {
|
|
11
|
+
protected readonly _options: Auth.Options;
|
|
12
|
+
constructor(_options: Auth.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Creates a short-lived session token that can be used to authenticate
|
|
15
|
+
* WebSocket connections. Session tokens are useful for client-side applications where
|
|
16
|
+
* you don’t want to expose your API key.
|
|
17
|
+
*
|
|
18
|
+
* @param {MavenAGI.SessionTokenRequest} request
|
|
19
|
+
* @param {Auth.RequestOptions} requestOptions - Request-specific configuration.
|
|
20
|
+
*
|
|
21
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
22
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
23
|
+
* @throws {@link MavenAGI.ServerError}
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* await client.auth.sessionToken({
|
|
27
|
+
* ttlSeconds: 3600
|
|
28
|
+
* })
|
|
29
|
+
*/
|
|
30
|
+
sessionToken(request: MavenAGI.SessionTokenRequest, requestOptions?: Auth.RequestOptions): core.HttpResponsePromise<MavenAGI.SessionTokenResponse>;
|
|
31
|
+
private __sessionToken;
|
|
32
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
33
|
+
}
|