@cognigy/rest-api-client 0.11.0 → 0.13.0
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/.eslintignore +15 -0
- package/.eslintrc.json +28 -0
- package/.prettierrc.json +7 -0
- package/.snyk +1 -1
- package/build/GenericAPIFn.js +3 -3
- package/build/GenericUploadFn.js +8 -5
- package/build/PluginBase.js +1 -1
- package/build/RestAPIClient.js +15 -1
- package/build/apigroups/AdministrationAPIGroup_2_0.js +68 -40
- package/build/apigroups/AnalyticsAPIGroup_2_0.js +12 -0
- package/build/apigroups/ExternalAPIGroup_2_0.js +5 -5
- package/build/apigroups/InsightsAPIGroup_2_0.js +58 -0
- package/build/apigroups/ManagementAPIGroup_2_0.js +19 -15
- package/build/apigroups/MetricsAPIGroup_2_0.js +29 -29
- package/build/apigroups/ResourcesAPIGroup_2_0.js +250 -177
- package/build/apigroups/SessionsAPIGroup_2_0.js +7 -7
- package/build/apigroups/index.js +5 -1
- package/build/authentication/ApiKey/ApiKeyAuthentication.js +1 -1
- package/build/authentication/AuthenticationAPI.js +2 -2
- package/build/authentication/BasicAuthentication/BasicAuthentication.js +9 -2
- package/build/authentication/OAuth2/ILoginByClientCredentialsParameters.js +3 -0
- package/build/authentication/OAuth2/IOAuth2ClientCredentialsGrantAccessTokenRequest.js +11 -0
- package/build/authentication/OAuth2/IOAuth2ErrorResponse.js +1 -1
- package/build/authentication/OAuth2/OAuth2Authentication.js +67 -34
- package/build/connector/AxiosAdapter.js +28 -24
- package/build/connector/isRetryAllowed.js +0 -1
- package/build/connector/retryAfterDelay.js +3 -3
- package/build/shared/{interfaces/restAPI/administration/user/v2.0/IDeleteUserMeRest_2_0.js → api/liveAgent/liveAgentInterfaces.js} +1 -1
- package/build/shared/charts/createNodeDescriptor.js +1 -1
- package/build/shared/charts/descriptors/allFields.js +1 -1
- package/build/shared/charts/descriptors/{profile → analytics}/activateProfile.js +2 -2
- package/build/shared/charts/descriptors/{profile → analytics}/blindMode.js +11 -4
- package/build/shared/charts/descriptors/{profile → analytics}/completeGoal.js +2 -2
- package/build/shared/charts/descriptors/{profile → analytics}/deactivateProfile.js +2 -2
- package/build/shared/charts/descriptors/{profile → analytics}/deleteProfile.js +2 -2
- package/build/shared/charts/descriptors/{profile → analytics}/index.js +5 -1
- package/build/shared/charts/descriptors/{profile → analytics}/mergeProfile.js +2 -2
- package/build/shared/charts/descriptors/{profile → analytics}/overwriteAnalytics.js +59 -4
- package/build/shared/charts/descriptors/analytics/requestRating.js +57 -0
- package/build/shared/charts/descriptors/analytics/setRating.js +39 -0
- package/build/shared/charts/descriptors/{profile → analytics}/updateProfile.js +2 -2
- package/build/shared/charts/descriptors/apps/getAppSessionPin.js +46 -0
- package/build/shared/charts/descriptors/apps/index.js +14 -0
- package/build/shared/charts/descriptors/apps/initAppSession.js +488 -0
- package/build/shared/charts/descriptors/apps/setAdaptiveCardAppState.js +79 -0
- package/build/shared/charts/descriptors/apps/setAppState.js +44 -0
- package/build/shared/charts/descriptors/apps/setHtmlAppState.js +108 -0
- package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/amazonStorageProviderConnection.js +14 -0
- package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/azureBlobStorageProviderConnection.js +13 -0
- package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/googleCloudStorageProviderConnection.js +13 -0
- package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/index.js +23 -0
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/aggregate.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/find.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/findOne.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/index.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/insert.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/remove.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/updateMany.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/updateOne.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/smtp/emailNotification.js +8 -6
- package/build/shared/charts/descriptors/connectionNodes/smtp/index.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/smtp/sendEmail.js +4 -4
- package/build/shared/charts/descriptors/connectionNodes/sql/index.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/sql/runQuery.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/sql/runStoredProcedure.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/sql/runTransaction.js +1 -1
- package/build/shared/charts/descriptors/data/addToContext.js +1 -1
- package/build/shared/charts/descriptors/data/code.js +1 -1
- package/build/shared/charts/descriptors/data/copyDataToContext.js +1 -1
- package/build/shared/charts/descriptors/data/copySlotsToContext.js +1 -1
- package/build/shared/charts/descriptors/data/log.js +1 -1
- package/build/shared/charts/descriptors/data/removeFromContext.js +1 -1
- package/build/shared/charts/descriptors/data/resetContext.js +1 -1
- package/build/shared/charts/descriptors/end.js +2 -1
- package/build/shared/charts/descriptors/index.js +98 -70
- package/build/shared/charts/descriptors/liveAgent/assistInfo.js +195 -0
- package/build/shared/charts/descriptors/liveAgent/index.js +6 -0
- package/build/shared/charts/descriptors/liveAgent/utils/buildCognigyWhisperAssistResponse.js +135 -0
- package/build/shared/charts/descriptors/liveAgent/utils/index.js +6 -0
- package/build/shared/charts/descriptors/logic/disableSlotFillers.js +1 -1
- package/build/shared/charts/descriptors/logic/enableSlotFillers.js +1 -1
- package/build/shared/charts/descriptors/logic/executeFlow.js +1 -1
- package/build/shared/charts/descriptors/logic/goTo.js +2 -1
- package/build/shared/charts/descriptors/logic/if/else.js +3 -1
- package/build/shared/charts/descriptors/logic/if/if.js +3 -2
- package/build/shared/charts/descriptors/logic/if/then.js +3 -1
- package/build/shared/charts/descriptors/logic/index.js +5 -3
- package/build/shared/charts/descriptors/logic/interval/elseInterval.js +2 -1
- package/build/shared/charts/descriptors/logic/interval/interval.js +1 -1
- package/build/shared/charts/descriptors/logic/interval/onInterval.js +2 -1
- package/build/shared/charts/descriptors/logic/once/afterwards.js +2 -1
- package/build/shared/charts/descriptors/logic/once/onFirstExecution.js +2 -1
- package/build/shared/charts/descriptors/logic/once/once.js +1 -1
- package/build/shared/charts/descriptors/logic/resetState.js +1 -1
- package/build/shared/charts/descriptors/logic/setState.js +1 -1
- package/build/shared/charts/descriptors/logic/setTranslation.js +88 -0
- package/build/shared/charts/descriptors/logic/sleep.js +1 -1
- package/build/shared/charts/descriptors/logic/stop.js +1 -1
- package/build/shared/charts/descriptors/logic/switch/case.js +3 -1
- package/build/shared/charts/descriptors/logic/switch/default.js +3 -1
- package/build/shared/charts/descriptors/logic/switch/switch.js +74 -12
- package/build/shared/charts/descriptors/logic/switchLocale.js +31 -3
- package/build/shared/charts/descriptors/logic/think.js +8 -4
- package/build/shared/charts/descriptors/logic/thinkV2.js +104 -0
- package/build/shared/charts/descriptors/logic/wait.js +3 -10
- package/build/shared/charts/descriptors/message/checkChannelChange/checkChannelChange.js +2 -1
- package/build/shared/charts/descriptors/message/checkChannelChange/onNo.js +4 -2
- package/build/shared/charts/descriptors/message/checkChannelChange/onYes.js +4 -2
- package/build/shared/charts/descriptors/message/checkChannelChange/unchanged.js +4 -2
- package/build/shared/charts/descriptors/message/datePicker.js +5 -5
- package/build/shared/charts/descriptors/message/question/onAnswer.js +4 -2
- package/build/shared/charts/descriptors/message/question/onQuestion.js +4 -2
- package/build/shared/charts/descriptors/message/question/optionalQuestion.js +2 -2
- package/build/shared/charts/descriptors/message/question/question.js +655 -60
- package/build/shared/charts/descriptors/message/question/utils/datepickerUtils.js +32 -2
- package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +12 -3
- package/build/shared/charts/descriptors/message/question/utils/generateAnswerShortForm.js +37 -0
- package/build/shared/charts/descriptors/message/question/utils/getQuestionText.js +36 -0
- package/build/shared/charts/descriptors/message/question/utils/questionHandover.js +13 -0
- package/build/shared/charts/descriptors/message/question/utils/resetNodeState.js +12 -0
- package/build/shared/charts/descriptors/message/question/utils/storeQuestionAnswer.js +30 -0
- package/build/shared/charts/descriptors/message/question/utils/validateQuestionAnswer.js +22 -0
- package/build/shared/charts/descriptors/message/say.js +10 -4
- package/build/shared/charts/descriptors/message/sendImage.js +1 -1
- package/build/shared/charts/descriptors/message/sendText.js +1 -1
- package/build/shared/charts/descriptors/microsoft/getToken.js +34 -0
- package/build/shared/charts/descriptors/microsoft/index.js +22 -0
- package/build/shared/charts/descriptors/microsoft/invalidateToken.js +29 -0
- package/build/shared/charts/descriptors/microsoft/tokenStatus/index.js +51 -0
- package/build/shared/charts/descriptors/microsoft/tokenStatus/tokenGranted.js +24 -0
- package/build/shared/charts/descriptors/microsoft/tokenStatus/tokenNotGranted.js +24 -0
- package/build/shared/charts/descriptors/microsoft/utils/design.js +5 -0
- package/build/shared/charts/descriptors/nlu/addLexiconKeyphrase.js +1 -1
- package/build/shared/charts/descriptors/nlu/executeCognigyNLU.js +23 -3
- package/build/shared/charts/descriptors/nlu/extractAnswer.js +115 -0
- package/build/shared/charts/descriptors/nlu/fuzzySearch.js +270 -0
- package/build/shared/charts/descriptors/nlu/index.js +7 -1
- package/build/shared/charts/descriptors/nlu/matchPattern.js +113 -0
- package/build/shared/charts/descriptors/nlu/regexSlotFiller.js +1 -1
- package/build/shared/charts/descriptors/nlu/utils/patternMatcher.js +265 -0
- package/build/shared/charts/descriptors/placeholder.js +1 -1
- package/build/shared/charts/descriptors/requiredFields.js +1 -1
- package/build/shared/charts/descriptors/service/checkAgentAvailability.js +203 -0
- package/build/shared/charts/descriptors/service/handover.js +30 -3
- package/build/shared/charts/descriptors/service/handoverV2.js +192 -0
- package/build/shared/charts/descriptors/service/httpRequest.js +40 -10
- package/build/shared/charts/descriptors/service/index.js +5 -1
- package/build/shared/charts/descriptors/service/triggerFunction/onScheduled.js +3 -1
- package/build/shared/charts/descriptors/service/triggerFunction/onSchedulingError.js +3 -1
- package/build/shared/charts/descriptors/service/triggerFunction/triggerFunction.js +1 -1
- package/build/shared/charts/descriptors/start.js +2 -1
- package/build/shared/charts/descriptors/voice/index.js +20 -0
- package/build/shared/charts/descriptors/voice/interface/IAudioCodes.js +3 -0
- package/build/shared/charts/descriptors/voice/interface/IVoiceGateway2.js +3 -0
- package/build/shared/charts/descriptors/voice/mappers/hangup.mapper.js +59 -0
- package/build/shared/charts/descriptors/voice/mappers/play.mapper.js +99 -0
- package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +296 -0
- package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +86 -0
- package/build/shared/charts/descriptors/voice/nodes/bargeIn.js +60 -0
- package/build/shared/charts/descriptors/voice/nodes/continuousAsr.js +72 -0
- package/build/shared/charts/descriptors/voice/nodes/dtmf.js +86 -0
- package/build/shared/charts/descriptors/voice/nodes/hangup.js +48 -0
- package/build/shared/charts/descriptors/voice/nodes/noUserInput.js +105 -0
- package/build/shared/charts/descriptors/voice/nodes/play.js +95 -0
- package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +105 -0
- package/build/shared/charts/descriptors/voice/nodes/transfer.js +114 -0
- package/build/shared/charts/descriptors/voice/utils/constants.js +8 -0
- package/build/shared/charts/descriptors/voice/utils/design.js +5 -0
- package/build/shared/charts/descriptors/voice/utils/helper.js +11 -0
- package/build/shared/charts/descriptors/voicegateway/index.js +1 -1
- package/build/shared/charts/descriptors/voicegateway/nodes/agentAssist.js +1 -1
- package/build/shared/charts/descriptors/voicegateway/nodes/callRecording.js +37 -17
- package/build/shared/charts/descriptors/voicegateway/nodes/handover.js +20 -34
- package/build/shared/charts/descriptors/voicegateway/nodes/hangup.js +11 -20
- package/build/shared/charts/descriptors/voicegateway/nodes/playURL.js +23 -29
- package/build/shared/charts/descriptors/voicegateway/nodes/sendMessage.js +5 -5
- package/build/shared/charts/descriptors/voicegateway/nodes/sendMetaData.js +1 -1
- package/build/shared/charts/descriptors/voicegateway/nodes/setSessionParams.js +4 -4
- package/build/shared/charts/descriptors/voicegateway/utils/paramUtils.js +34 -6
- package/build/shared/charts/descriptors/voicegateway2/index.js +25 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/dtmf.js +60 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/hangup.js +46 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +113 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +103 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/sendMetadata.js +64 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +354 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +99 -0
- package/build/shared/charts/descriptors/voicegateway2/utils/constants.js +7 -0
- package/build/shared/charts/descriptors/voicegateway2/utils/design.js +5 -0
- package/build/shared/charts/descriptors/voicegateway2/utils/helper.js +39 -0
- package/build/shared/charts/descriptors/voicegateway2/utils/strip-nulls.js +19 -0
- package/build/shared/constants.js +11 -1
- package/build/shared/errors/baseError.js +35 -2
- package/build/shared/handoverClients/interfaces/TAnyProviderResponse.js +3 -0
- package/build/shared/handoverClients/interfaces/THandoverEventType.js +12 -0
- package/build/shared/helper/BaseContext.js +1 -1
- package/build/shared/helper/defaultDatepickerFunction.js +13 -0
- package/build/shared/helper/rest/array.js +19 -0
- package/build/shared/helper/rest/boolean.js +5 -1
- package/build/shared/helper/rest/index.js +4 -1
- package/build/shared/helper/rest/query-string/index.js +5 -5
- package/build/shared/helper/rest/query.js +0 -0
- package/build/shared/interfaces/IApiKey.js +1 -1
- package/build/shared/interfaces/IEndpointTranslationSettings.js +32 -0
- package/build/shared/interfaces/IHandoverRequestStatus.js +3 -0
- package/build/shared/interfaces/IHttpRequest.js +3 -0
- package/build/shared/interfaces/IOrganisation.js +22 -3
- package/build/shared/interfaces/IProfile.js +1 -1
- package/build/shared/interfaces/ISayNodeSettings.js +3 -0
- package/build/shared/interfaces/TEntrypointType.js +2 -0
- package/build/shared/interfaces/ai.js +0 -1
- package/build/shared/interfaces/amazonLexV2Interface.js +3 -0
- package/build/shared/interfaces/amqpInterface.js +4 -1
- package/build/shared/interfaces/analytics/IAnalyticsFlowHistoryData.js +3 -0
- package/build/shared/interfaces/analytics/IAnalyticsRating.js +13 -0
- package/build/shared/interfaces/analytics/IAnalyticsSourceData.js +196 -45
- package/build/shared/interfaces/analytics/IStepEvent.js +4 -1
- package/build/shared/interfaces/analytics/TAnalyticsMode.js +10 -0
- package/build/shared/interfaces/analytics/TAnalyticsType.js +5 -0
- package/build/shared/interfaces/debugEvents/IErrorEventPayload.js +3 -0
- package/build/shared/interfaces/debugEvents/TDebugEndpointEvent.js +1 -0
- package/build/shared/interfaces/debugEvents/TDebugEventType.js +2 -1
- package/build/shared/interfaces/fileStorage.js +23 -0
- package/build/shared/interfaces/handover.js +151 -3
- package/build/shared/interfaces/journeys/IJourney.js +1 -1
- package/build/shared/interfaces/license.js +34 -0
- package/build/shared/interfaces/license.js.map +1 -0
- package/build/shared/interfaces/management/deleteOrganisation/deleteOrganisationTypes.js +3 -0
- package/build/shared/interfaces/messageAPI/ai.js +15 -1
- package/build/shared/interfaces/messageAPI/analytics.js +3 -0
- package/build/shared/interfaces/messageAPI/endpoints.js +361 -11
- package/build/shared/interfaces/messageAPI/handover.js +270 -0
- package/build/shared/interfaces/resources/IAppTemplate.js +24 -0
- package/build/shared/interfaces/resources/IAuditEvent.js +39 -3
- package/build/shared/interfaces/resources/IChart.js +2 -1
- package/build/shared/interfaces/resources/IChartNode.js +58 -11
- package/build/shared/interfaces/resources/IConnection.js +1 -1
- package/build/shared/interfaces/resources/IConnectionSchema.js +1 -1
- package/build/shared/interfaces/resources/IEndpoint.js +7 -2
- package/build/shared/interfaces/resources/IExtension.js +17 -0
- package/build/shared/interfaces/resources/IFile.js +1 -1
- package/build/shared/interfaces/resources/IFlow.js +10 -2
- package/build/shared/interfaces/resources/IFlowState.js +1 -1
- package/build/shared/interfaces/resources/IFunctionInstance.js +1 -1
- package/build/shared/interfaces/resources/IHandoverConfiguration.js +13 -0
- package/build/shared/interfaces/resources/ILexicon.js +9 -3
- package/build/shared/interfaces/resources/ILexiconEntry.js +1 -1
- package/build/shared/interfaces/resources/INLUConnector.js +15 -2
- package/build/shared/interfaces/resources/INodeDescriptorSet.js +169 -53
- package/build/shared/interfaces/resources/IOptionsResolverFunction.js +18 -0
- package/build/shared/interfaces/resources/IOrganisationDeletion.js +10 -0
- package/build/shared/interfaces/resources/IPlaybookRun.js +61 -0
- package/build/shared/interfaces/resources/IProject.js +20 -1
- package/build/shared/interfaces/resources/IRemoveDuplicatedSlotsAndUpdateLexionEntries.js +3 -0
- package/build/shared/interfaces/resources/ISlotFiller.js +38 -21
- package/build/shared/interfaces/resources/ISnapshot.js +1 -1
- package/build/shared/interfaces/resources/ITrackAnalyticsStepsArguments.js +3 -0
- package/build/shared/interfaces/resources/TNLUConnectorType.js +3 -1
- package/build/shared/interfaces/resources/TResourceType.js +1 -0
- package/build/shared/interfaces/resources/TRestChannelType.js +10 -0
- package/build/shared/interfaces/resources/TSocketChannelType.js +9 -5
- package/build/shared/interfaces/resources/TWebhookChannelType.js +10 -0
- package/build/shared/interfaces/resources/chart/IChartExecutable.js +3 -2
- package/build/shared/interfaces/resources/chart/IChartExecutableNode.js +1 -0
- package/build/shared/interfaces/resources/intent/IIntent.js +26 -6
- package/build/shared/interfaces/resources/intent/IIntentTrainGroup.js +22 -2
- package/build/shared/interfaces/resources/intent/ISentence.js +32 -8
- package/build/shared/interfaces/resources/settings/IAgentSettings.js +81 -2
- package/build/shared/interfaces/resources/settings/IFlowSettings.js +20 -2
- package/build/shared/interfaces/resources/settings/ISharedSettings.js +5 -1
- package/build/shared/interfaces/resources/yesNoIntent/IYesNoItem.js +9 -0
- package/build/shared/interfaces/resources/yesNoIntent/index.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/IReadLiveAgentAccountRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/IReadProjectInboxRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ISetupCognigyLiveAgentInboxRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ISetupCognigyLiveAgentRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/IUpdateCognigyLiveAgentInboxRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/administration/organisations/v2.0/IReadCollectionsToBeDeletedRest_2_0.js +21 -0
- package/build/shared/interfaces/restAPI/administration/organisations/v2.0/IRequestOrganisationDeletionRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/organisations/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/analytics/IDeleteAnalyticsRecordsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/analytics/IUpdateAnalyticsRecordProperties_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/analytics/IUpdateAnalyticsRecordsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IAudioPreviewLanguages_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IAudioPreviewRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IIndexAudioPreviewLanguages_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/ITestVoiceProviderRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/ITestVoiceProvider_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IVGCallSettings_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IVoicePrepareCallRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IVoicePrepareCall_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/insights/IAnalyticsQueryFilter_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/TAnalyticsQueryFilterOperator_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/messages/IGenerateMessagesRest_2_0.js +5 -0
- package/build/shared/interfaces/restAPI/insights/messages/ILoadMessagesReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/messages/ILoadMessagesReportByQueryHashRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/messages/ITopNMessages_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/publish/IPublishAnalyticsRestDataBody.js +4 -0
- package/build/shared/interfaces/restAPI/insights/reports/IGenerateReportResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/reports/IGenerateReportRest_2_0.js +41 -0
- package/build/shared/interfaces/restAPI/insights/reports/ILoadReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/reports/ILoadReportByQueryHashRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IGenerateStepReportRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IIndexStepsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/ILoadStepReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/ILoadStepReportByQueryHashRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IStepIndexItem_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IStepReport_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IStep_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/IGenerateTranscriptsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/ILoadTranscriptsReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/ILoadTranscriptsReportByQueryHashRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/IStepPath_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/management/organisations/v2.0/IDeleteOrganisationRest_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/chart/v2.0/ISearchChartNodesRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/extension/v2.0/IUpdateExtensionPackageRest_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/file/v2.0/IUploadFileRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/file/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/flow/v2.0/ICloneFlowRest_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/flow/v2.0/ICreateFlowFromChildrenRest_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/flow/v2.0/sentence/IYesNoSentence_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/flow/v2.0/settings/ILocaleSettings_2_0.js +16 -0
- package/build/shared/interfaces/restAPI/resources/lexicon/v2.0/IComposeLexiconDownloadLinkRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IDeleteYesNoIntentRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IReadYesNoIntentsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/ITrainYesNoIntentsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IUpdateYesNoIntentRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IYesNoIntentItem_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IYesNoIntentMetaData_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IYesNoIntents_2_0.js +8 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/ICreateYesNoSentenceRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/IDeleteYesNoSentenceRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/IIndexYesNoSentencesRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/IReadYesNoSentenceRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/IUpdateYesNoSentenceRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/nluconnector/v2.0/TNLUConnectorType_2_0.js +5 -1
- package/build/shared/interfaces/restAPI/resources/nodedescriptorsets/v2.0/IOptionsResolverRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IDeletePlaybookRunRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IIndexPlaybookRunsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IPlaybookRunIndexItem_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IPlaybookRun_2_0.js +7 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IReadPlaybookRunRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/ISchedulePlaybookRunRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/project/v2.0/ICreateProjectRest_2_0.js +1 -0
- package/build/shared/interfaces/restAPI/resources/project/v2.0/ITrainAllProjectFlowsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/project/v2.0/settings/ITestTranslationSettingsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/project/v2.0/settings/ITestTranslationSettings_2_0.js +3 -0
- package/build/shared/interfaces/security/IACL.js +1 -1
- package/build/shared/interfaces/security/IPermission.js +10 -0
- package/build/shared/interfaces/security/IRole.js +21 -3
- package/build/shared/interfaces/sessionstate/ISessionState.js +3 -0
- package/build/shared/interfaces/sessionstate/index.js +3 -0
- package/build/shared/interfaces/trainer/ITrainerRecord.js +5 -1
- package/build/shared/interfaces/translation.js +11 -0
- package/build/shared/interfaces/user.js +1 -1
- package/package.json +40 -31
- package/types/index.d.ts +12527 -8567
- package/build/shared/charts/descriptors/logic/checkFrustration.js +0 -82
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXTRACT_ANSWER = void 0;
|
|
4
|
+
/* Custom modules */
|
|
5
|
+
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
6
|
+
/**
|
|
7
|
+
* Node name: 'extractAnswer'
|
|
8
|
+
*
|
|
9
|
+
* Purpose:
|
|
10
|
+
* Answers a question based on a given context with the built-in question answering module
|
|
11
|
+
*/
|
|
12
|
+
exports.EXTRACT_ANSWER = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
13
|
+
type: "extractAnswer",
|
|
14
|
+
defaultLabel: "Extract Answer",
|
|
15
|
+
summary: "Answers a question based on a given context with the built-in question answering module",
|
|
16
|
+
appearance: {
|
|
17
|
+
showIcon: false
|
|
18
|
+
},
|
|
19
|
+
fields: [
|
|
20
|
+
{
|
|
21
|
+
key: "text",
|
|
22
|
+
type: "cognigyText",
|
|
23
|
+
label: "Text",
|
|
24
|
+
defaultValue: ""
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: "question",
|
|
28
|
+
type: "cognigyText",
|
|
29
|
+
label: "Question",
|
|
30
|
+
params: {
|
|
31
|
+
required: true
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
key: "storeLocation",
|
|
36
|
+
type: "select",
|
|
37
|
+
label: "Where to store the result",
|
|
38
|
+
params: {
|
|
39
|
+
options: [
|
|
40
|
+
{
|
|
41
|
+
label: "Input",
|
|
42
|
+
value: "input"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "Context",
|
|
46
|
+
value: "context"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
required: true
|
|
50
|
+
},
|
|
51
|
+
defaultValue: "input"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: "inputKey",
|
|
55
|
+
type: "cognigyText",
|
|
56
|
+
label: "Input Key to store Result",
|
|
57
|
+
description: "Where to store the result in the Input object. E.g. input.extractAnswer",
|
|
58
|
+
defaultValue: "extractAnswer",
|
|
59
|
+
condition: {
|
|
60
|
+
key: "storeLocation",
|
|
61
|
+
value: "input"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: "contextKey",
|
|
66
|
+
type: "cognigyText",
|
|
67
|
+
label: "Context Key to store Result",
|
|
68
|
+
description: "Where to store the result in the Context object. E.g. context.extractAnswer",
|
|
69
|
+
defaultValue: "extractAnswer",
|
|
70
|
+
condition: {
|
|
71
|
+
key: "storeLocation",
|
|
72
|
+
value: "context"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
sections: [
|
|
77
|
+
{
|
|
78
|
+
key: "storage",
|
|
79
|
+
label: "Storage Options",
|
|
80
|
+
defaultCollapsed: true,
|
|
81
|
+
fields: [
|
|
82
|
+
"storeLocation",
|
|
83
|
+
"inputKey",
|
|
84
|
+
"contextKey",
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
form: [
|
|
89
|
+
{ type: "field", key: "text" },
|
|
90
|
+
{ type: "field", key: "question" },
|
|
91
|
+
{ type: "field", key: "maxTextLength" },
|
|
92
|
+
{ type: "section", key: "storage" },
|
|
93
|
+
],
|
|
94
|
+
preview: {
|
|
95
|
+
key: "text",
|
|
96
|
+
type: "text",
|
|
97
|
+
},
|
|
98
|
+
tags: ["nlu"],
|
|
99
|
+
function: async (extractAnswerParams) => {
|
|
100
|
+
const { cognigy, config } = extractAnswerParams;
|
|
101
|
+
const { api } = cognigy;
|
|
102
|
+
const { question, storeLocation, contextKey, inputKey } = config;
|
|
103
|
+
if (!question) {
|
|
104
|
+
throw new Error("Unable to answer question. Question is missing.");
|
|
105
|
+
}
|
|
106
|
+
if (storeLocation === "context" && !contextKey) {
|
|
107
|
+
throw new Error("Unable to answer question. Context Key is missing.");
|
|
108
|
+
}
|
|
109
|
+
if (storeLocation === "input" && !inputKey) {
|
|
110
|
+
throw new Error("Unable to answer question. Input Key is missing.");
|
|
111
|
+
}
|
|
112
|
+
return await api.extractAnswer(extractAnswerParams);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=extractAnswer.js.map
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FUZZY_SEARCH = void 0;
|
|
4
|
+
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
5
|
+
const objectSizeValidator_1 = require("../../../helper/objectSizeValidator");
|
|
6
|
+
const getFuzzySearchMaxObjectSizeInBytes = () => {
|
|
7
|
+
return parseInt(process.env.FUZZYSEARCH_MAX_OBJECT_SIZE) || 524288;
|
|
8
|
+
};
|
|
9
|
+
exports.FUZZY_SEARCH = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
10
|
+
type: "fuzzySearch",
|
|
11
|
+
defaultLabel: "Fuzzy Search",
|
|
12
|
+
summary: "Performs a fuzzy search on a given collection of source data",
|
|
13
|
+
preview: {
|
|
14
|
+
key: "searchPattern",
|
|
15
|
+
type: "text"
|
|
16
|
+
},
|
|
17
|
+
tags: ["nlu", "fuzzy", "search"],
|
|
18
|
+
fields: [
|
|
19
|
+
{
|
|
20
|
+
key: "searchPattern",
|
|
21
|
+
label: "Search Pattern",
|
|
22
|
+
description: "The pattern to search for",
|
|
23
|
+
type: "cognigyText",
|
|
24
|
+
params: {
|
|
25
|
+
required: true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
key: "items",
|
|
30
|
+
label: "Source Data",
|
|
31
|
+
description: "An array of type string or object to search through..",
|
|
32
|
+
type: "json",
|
|
33
|
+
params: {
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
defaultValue: `[
|
|
37
|
+
"apple",
|
|
38
|
+
"orange",
|
|
39
|
+
"banana",
|
|
40
|
+
"pear"
|
|
41
|
+
]`
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: "isCaseSensitive",
|
|
45
|
+
label: "Is Case Sensitive",
|
|
46
|
+
defaultValue: false,
|
|
47
|
+
type: "toggle",
|
|
48
|
+
description: "Indicates whether comparisons should be case sensitive"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: "includeScore",
|
|
52
|
+
label: "Include Score",
|
|
53
|
+
defaultValue: true,
|
|
54
|
+
type: "toggle",
|
|
55
|
+
description: "Whether the score should be included in the result set. A score of 1 indicates a perfect match, while a score of 0 indicates a complete mismatch"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: "includeMatches",
|
|
59
|
+
label: "Include Matches",
|
|
60
|
+
defaultValue: false,
|
|
61
|
+
type: "toggle",
|
|
62
|
+
description: "Whether the matches should be included in the result set. When true, each record in the result set will include the indices of the matched characters."
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: "minMatchCharLength",
|
|
66
|
+
label: "Minimum Characters",
|
|
67
|
+
defaultValue: 1,
|
|
68
|
+
type: "number",
|
|
69
|
+
description: "Only the matches whose length exceeds this value will be returned.",
|
|
70
|
+
params: {
|
|
71
|
+
min: 1,
|
|
72
|
+
max: 100
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "shouldSort",
|
|
77
|
+
label: "Should Sort",
|
|
78
|
+
defaultValue: true,
|
|
79
|
+
type: "toggle",
|
|
80
|
+
description: "Whether to sort the result list, by score."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: "findAllMatches",
|
|
84
|
+
label: "Find All Matches",
|
|
85
|
+
defaultValue: true,
|
|
86
|
+
type: "toggle",
|
|
87
|
+
description: "When activated, the matching function will continue to the end of a search pattern even if a perfect match has already been located in the string."
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
key: "location",
|
|
91
|
+
label: "Location",
|
|
92
|
+
defaultValue: 0,
|
|
93
|
+
type: "number",
|
|
94
|
+
description: "Determines approximately where in the text is the pattern expected to be found.",
|
|
95
|
+
params: {
|
|
96
|
+
min: 0,
|
|
97
|
+
max: 100
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: "threshold",
|
|
102
|
+
label: "Threshold",
|
|
103
|
+
defaultValue: 0.1,
|
|
104
|
+
type: "slider",
|
|
105
|
+
description: "At what point does the match algorithm give up. A threshold of 1.0 requires a perfect match (of both letters and location), a threshold of 0.0 would match anything.",
|
|
106
|
+
params: {
|
|
107
|
+
min: 0,
|
|
108
|
+
max: 1,
|
|
109
|
+
step: 0.1
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
key: "distance",
|
|
114
|
+
label: "Distance",
|
|
115
|
+
defaultValue: 100,
|
|
116
|
+
type: "number",
|
|
117
|
+
description: "Determines how close the match must be to the fuzzy location (specified by location).",
|
|
118
|
+
params: {
|
|
119
|
+
min: 0,
|
|
120
|
+
max: 1000
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
key: "ignoreLocation",
|
|
125
|
+
label: "Ignore Location",
|
|
126
|
+
defaultValue: true,
|
|
127
|
+
type: "toggle",
|
|
128
|
+
description: "When activated, search will ignore location and distance, so it won't matter where in the string the pattern appears."
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
key: "storeLocation",
|
|
132
|
+
type: "select",
|
|
133
|
+
label: "Where to store the result",
|
|
134
|
+
params: {
|
|
135
|
+
options: [
|
|
136
|
+
{
|
|
137
|
+
label: "Input",
|
|
138
|
+
value: "input"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: "Context",
|
|
142
|
+
value: "context"
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
required: true
|
|
146
|
+
},
|
|
147
|
+
defaultValue: "input"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
key: "inputKey",
|
|
151
|
+
type: "cognigyText",
|
|
152
|
+
label: "Input Key to store Result",
|
|
153
|
+
defaultValue: "search",
|
|
154
|
+
condition: {
|
|
155
|
+
key: "storeLocation",
|
|
156
|
+
value: "input"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
key: "contextKey",
|
|
161
|
+
type: "cognigyText",
|
|
162
|
+
label: "Context Key to store Result",
|
|
163
|
+
defaultValue: "search",
|
|
164
|
+
condition: {
|
|
165
|
+
key: "storeLocation",
|
|
166
|
+
value: "context"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
sections: [
|
|
171
|
+
{
|
|
172
|
+
key: "storageOption",
|
|
173
|
+
label: "Storage Option",
|
|
174
|
+
defaultCollapsed: true,
|
|
175
|
+
fields: [
|
|
176
|
+
"storeLocation",
|
|
177
|
+
"inputKey",
|
|
178
|
+
"contextKey"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
key: "basicOptions",
|
|
183
|
+
label: "Basic Options",
|
|
184
|
+
defaultCollapsed: true,
|
|
185
|
+
fields: [
|
|
186
|
+
"isCaseSensitive",
|
|
187
|
+
"includeScore",
|
|
188
|
+
"includeMatches",
|
|
189
|
+
"minMatchCharLength",
|
|
190
|
+
"shouldSort",
|
|
191
|
+
"findAllMatches",
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
key: "fuzzyOptions",
|
|
196
|
+
label: "Fuzzy Matching Options",
|
|
197
|
+
defaultCollapsed: true,
|
|
198
|
+
fields: [
|
|
199
|
+
"location",
|
|
200
|
+
"threshold",
|
|
201
|
+
"distance",
|
|
202
|
+
"ignoreLocation",
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
form: [
|
|
207
|
+
{ type: "field", key: "searchPattern" },
|
|
208
|
+
{ type: "field", key: "items" },
|
|
209
|
+
{ type: "section", key: "basicOptions" },
|
|
210
|
+
{ type: "section", key: "fuzzyOptions" },
|
|
211
|
+
{ type: "section", key: "storageOption" }
|
|
212
|
+
],
|
|
213
|
+
function: async ({ cognigy, config }) => {
|
|
214
|
+
const { api } = cognigy;
|
|
215
|
+
const { searchPattern, items, distance, findAllMatches, ignoreLocation, includeMatches, includeScore, isCaseSensitive, location, minMatchCharLength, shouldSort, threshold, storeLocation, inputKey, contextKey } = config;
|
|
216
|
+
if (!searchPattern)
|
|
217
|
+
throw new Error("No search pattern provided.");
|
|
218
|
+
if (!items)
|
|
219
|
+
throw new Error("No source data provided.");
|
|
220
|
+
try {
|
|
221
|
+
// reverse threshold as fuse requires it inverse (0 = perfect match, 1 = matches everything)
|
|
222
|
+
const newThreshold = 1 - threshold;
|
|
223
|
+
const options = {
|
|
224
|
+
distance,
|
|
225
|
+
findAllMatches,
|
|
226
|
+
ignoreLocation,
|
|
227
|
+
includeMatches,
|
|
228
|
+
includeScore,
|
|
229
|
+
isCaseSensitive,
|
|
230
|
+
location,
|
|
231
|
+
minMatchCharLength,
|
|
232
|
+
shouldSort,
|
|
233
|
+
threshold: newThreshold,
|
|
234
|
+
};
|
|
235
|
+
const validObjectSize = (0, objectSizeValidator_1.validateObjectSize)(items, getFuzzySearchMaxObjectSizeInBytes());
|
|
236
|
+
let result = null;
|
|
237
|
+
if (validObjectSize.valid) {
|
|
238
|
+
result = api.fuseSearch(items, options, searchPattern);
|
|
239
|
+
// reverse scores from fuse's 0 = perfect match to Cognigy's 1 = perfect match.
|
|
240
|
+
if (includeScore && result && Array.isArray(result) && result.length > 0) {
|
|
241
|
+
result.forEach((item) => {
|
|
242
|
+
if (item.score || item.score === 0) {
|
|
243
|
+
item.score = 1 - item.score;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
result = {
|
|
250
|
+
"error": `Source data file size limit (${getFuzzySearchMaxObjectSizeInBytes()} bytes) exceeded`
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
if (storeLocation === "context") {
|
|
254
|
+
api.addToContext(contextKey, result, "simple");
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
api.addToInput(inputKey, result);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
if (storeLocation === "context") {
|
|
262
|
+
api.addToContext(contextKey, error, "simple");
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
api.addToInput(inputKey, error);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
//# sourceMappingURL=fuzzySearch.js.map
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REGEX_SLOT_FILLER = exports.EXECUTE_COGNIGY_NLU = exports.ADD_LEXICON_KEYPHRASE = void 0;
|
|
3
|
+
exports.FUZZY_SEARCH = exports.MATCH_PATTERN = exports.REGEX_SLOT_FILLER = exports.EXTRACT_ANSWER = exports.EXECUTE_COGNIGY_NLU = exports.ADD_LEXICON_KEYPHRASE = void 0;
|
|
4
4
|
var addLexiconKeyphrase_1 = require("./addLexiconKeyphrase");
|
|
5
5
|
Object.defineProperty(exports, "ADD_LEXICON_KEYPHRASE", { enumerable: true, get: function () { return addLexiconKeyphrase_1.ADD_LEXICON_KEYPHRASE; } });
|
|
6
6
|
var executeCognigyNLU_1 = require("./executeCognigyNLU");
|
|
7
7
|
Object.defineProperty(exports, "EXECUTE_COGNIGY_NLU", { enumerable: true, get: function () { return executeCognigyNLU_1.EXECUTE_COGNIGY_NLU; } });
|
|
8
|
+
var extractAnswer_1 = require("./extractAnswer");
|
|
9
|
+
Object.defineProperty(exports, "EXTRACT_ANSWER", { enumerable: true, get: function () { return extractAnswer_1.EXTRACT_ANSWER; } });
|
|
8
10
|
var regexSlotFiller_1 = require("./regexSlotFiller");
|
|
9
11
|
Object.defineProperty(exports, "REGEX_SLOT_FILLER", { enumerable: true, get: function () { return regexSlotFiller_1.REGEX_SLOT_FILLER; } });
|
|
12
|
+
var matchPattern_1 = require("./matchPattern");
|
|
13
|
+
Object.defineProperty(exports, "MATCH_PATTERN", { enumerable: true, get: function () { return matchPattern_1.MATCH_PATTERN; } });
|
|
14
|
+
var fuzzySearch_1 = require("./fuzzySearch");
|
|
15
|
+
Object.defineProperty(exports, "FUZZY_SEARCH", { enumerable: true, get: function () { return fuzzySearch_1.FUZZY_SEARCH; } });
|
|
10
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MATCH_PATTERN = void 0;
|
|
4
|
+
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
5
|
+
const patternMatcher_1 = require("./utils/patternMatcher");
|
|
6
|
+
exports.MATCH_PATTERN = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
7
|
+
type: "matchPattern",
|
|
8
|
+
defaultLabel: "Match Pattern",
|
|
9
|
+
preview: {
|
|
10
|
+
key: "patternGroupName",
|
|
11
|
+
type: "text"
|
|
12
|
+
},
|
|
13
|
+
summary: "Rule-based pattern matching for compound slot groups",
|
|
14
|
+
tags: ["nlu", "pattern", "patterns"],
|
|
15
|
+
fields: [
|
|
16
|
+
{
|
|
17
|
+
key: "patterns",
|
|
18
|
+
label: "Patterns",
|
|
19
|
+
type: "textArray",
|
|
20
|
+
description: "The patterns to match, e.g. 'from @city>origin to @city>destination'. Maximum: 20.",
|
|
21
|
+
defaultValue: ["@NUMBER>val1 or @NUMBER>val2"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
key: "patternGroupName",
|
|
25
|
+
label: "Pattern Group Name",
|
|
26
|
+
description: "Name for the slot compound group to be found under input.matchedPatterns.groupname",
|
|
27
|
+
type: "cognigyText",
|
|
28
|
+
defaultValue: "patternGroupName",
|
|
29
|
+
params: {
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: "alternateInput",
|
|
35
|
+
label: "Alternate Input",
|
|
36
|
+
description: "The input text to use instead of the current input text",
|
|
37
|
+
type: "cognigyText",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key: "detailedCompoundSlots",
|
|
41
|
+
label: "Detailed Match Results",
|
|
42
|
+
description: "Whether to store detailed results for the matched patterns or not",
|
|
43
|
+
type: "toggle",
|
|
44
|
+
defaultValue: false
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: "createNewSlots",
|
|
48
|
+
label: "Create New Slots",
|
|
49
|
+
description: "Whether to create new slots from tags or not",
|
|
50
|
+
type: "toggle",
|
|
51
|
+
defaultValue: false
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: "tagExistingSlots",
|
|
55
|
+
label: "Tag Existing Slots",
|
|
56
|
+
description: "Whether to tag existing slots or not",
|
|
57
|
+
type: "toggle",
|
|
58
|
+
defaultValue: true
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: "useFullSystemslotText",
|
|
62
|
+
label: "Replace system slots with full text",
|
|
63
|
+
description: "Match the full system slot text and use detailed values",
|
|
64
|
+
type: "toggle",
|
|
65
|
+
defaultValue: true,
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
sections: [
|
|
69
|
+
{
|
|
70
|
+
key: "advanced",
|
|
71
|
+
label: "Advanced",
|
|
72
|
+
defaultCollapsed: true,
|
|
73
|
+
fields: [
|
|
74
|
+
"createNewSlots",
|
|
75
|
+
"tagExistingSlots",
|
|
76
|
+
"detailedCompoundSlots",
|
|
77
|
+
"useFullSystemslotText",
|
|
78
|
+
"alternateInput",
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
form: [
|
|
83
|
+
{ type: "field", key: "patterns" },
|
|
84
|
+
{ type: "field", key: "patternGroupName" },
|
|
85
|
+
{ type: "section", key: "advanced" }
|
|
86
|
+
],
|
|
87
|
+
function: async ({ cognigy, config }) => {
|
|
88
|
+
let { input, api } = cognigy;
|
|
89
|
+
const { patterns, patternGroupName, alternateInput, detailedCompoundSlots, createNewSlots, tagExistingSlots, useFullSystemslotText } = config;
|
|
90
|
+
if (!patterns || !Array.isArray(patterns) || patterns.length === 0) {
|
|
91
|
+
throw new Error("No patterns to match specified");
|
|
92
|
+
}
|
|
93
|
+
if (patterns.length > 20) {
|
|
94
|
+
throw new Error("Maximum of 20 patterns allowed");
|
|
95
|
+
}
|
|
96
|
+
// When using an alternative input, input.slots is empty - we need to call the cognigy nlu again to get the slots
|
|
97
|
+
let nluResult = {};
|
|
98
|
+
if (alternateInput) {
|
|
99
|
+
nluResult = await api.executeCognigyNLU(alternateInput, {}, input.inputId, {});
|
|
100
|
+
}
|
|
101
|
+
(0, patternMatcher_1.patternMatcher)({
|
|
102
|
+
input,
|
|
103
|
+
patterns,
|
|
104
|
+
patternGroupName,
|
|
105
|
+
detailedCompoundSlots,
|
|
106
|
+
tagExistingSlots,
|
|
107
|
+
createNewSlots,
|
|
108
|
+
useFullSystemslotText,
|
|
109
|
+
nluResult
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=matchPattern.js.map
|
|
@@ -9,7 +9,7 @@ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
|
9
9
|
* Purpose:
|
|
10
10
|
* Fills slots dynamically by evaluating a custom regular expression
|
|
11
11
|
*/
|
|
12
|
-
exports.REGEX_SLOT_FILLER = createNodeDescriptor_1.createNodeDescriptor({
|
|
12
|
+
exports.REGEX_SLOT_FILLER = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
13
13
|
type: "regexSlotFiller",
|
|
14
14
|
defaultLabel: "Regex Slot Filler",
|
|
15
15
|
summary: "Fills Slots dynamically by evaluating a custom regular expression",
|