@yrpri/api 9.0.103 → 9.0.104
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/package.json +1 -1
- package/dist/active-citizen/controllers/activities.cjs +0 -174
- package/dist/active-citizen/controllers/news_feeds.cjs +0 -96
- package/dist/active-citizen/controllers/notifications.cjs +0 -243
- package/dist/active-citizen/controllers/recommendations.cjs +0 -280
- package/dist/active-citizen/engine/allOurIdeas/aiHelper.js +0 -204
- package/dist/active-citizen/engine/allOurIdeas/explainAnswersAssistant.js +0 -66
- package/dist/active-citizen/engine/allOurIdeas/iconGenerator.js +0 -38
- package/dist/active-citizen/engine/analytics/export_anon_community_activities.js +0 -334
- package/dist/active-citizen/engine/analytics/importer.js +0 -308
- package/dist/active-citizen/engine/analytics/manager.cjs +0 -377
- package/dist/active-citizen/engine/analytics/plausible/manager.cjs +0 -500
- package/dist/active-citizen/engine/analytics/statsCalc.cjs +0 -194
- package/dist/active-citizen/engine/analytics/utils.cjs +0 -369
- package/dist/active-citizen/engine/marketing/campaign.cjs +0 -90
- package/dist/active-citizen/engine/moderation/fraud/CreateFraudAuditReport.cjs +0 -313
- package/dist/active-citizen/engine/moderation/fraud/FraudBase.cjs +0 -239
- package/dist/active-citizen/engine/moderation/fraud/FraudDeleteBase.cjs +0 -211
- package/dist/active-citizen/engine/moderation/fraud/FraudDeleteEndorsements.cjs +0 -120
- package/dist/active-citizen/engine/moderation/fraud/FraudDeletePointQualities.cjs +0 -114
- package/dist/active-citizen/engine/moderation/fraud/FraudDeletePoints.cjs +0 -101
- package/dist/active-citizen/engine/moderation/fraud/FraudDeletePosts.cjs +0 -84
- package/dist/active-citizen/engine/moderation/fraud/FraudDeleteRatings.cjs +0 -15
- package/dist/active-citizen/engine/moderation/fraud/FraudGetBase.cjs +0 -133
- package/dist/active-citizen/engine/moderation/fraud/FraudGetEndorsements.cjs +0 -185
- package/dist/active-citizen/engine/moderation/fraud/FraudGetPointQualities.cjs +0 -184
- package/dist/active-citizen/engine/moderation/fraud/FraudGetPoints.cjs +0 -170
- package/dist/active-citizen/engine/moderation/fraud/FraudGetPosts.cjs +0 -109
- package/dist/active-citizen/engine/moderation/fraud/FraudGetRatings.cjs +0 -140
- package/dist/active-citizen/engine/moderation/fraud/FraudScannerNotifier.cjs +0 -279
- package/dist/active-citizen/engine/moderation/get_moderation_items.cjs +0 -386
- package/dist/active-citizen/engine/moderation/image_labeling/CommunityLabeling.cjs +0 -49
- package/dist/active-citizen/engine/moderation/image_labeling/GroupLabeling.cjs +0 -68
- package/dist/active-citizen/engine/moderation/image_labeling/ImageLabelingBase.cjs +0 -288
- package/dist/active-citizen/engine/moderation/image_labeling/PointLabeling.cjs +0 -33
- package/dist/active-citizen/engine/moderation/image_labeling/PostLabeling.cjs +0 -56
- package/dist/active-citizen/engine/moderation/perspective_api_client.cjs +0 -106
- package/dist/active-citizen/engine/moderation/process_moderation_items.cjs +0 -344
- package/dist/active-citizen/engine/moderation/toxicity_analysis.cjs +0 -810
- package/dist/active-citizen/engine/news_feeds/activity_and_item_index_definitions.cjs +0 -15
- package/dist/active-citizen/engine/news_feeds/generate_dynamically.cjs +0 -362
- package/dist/active-citizen/engine/news_feeds/generate_from_notifications.cjs +0 -268
- package/dist/active-citizen/engine/news_feeds/news_feeds_utils.cjs +0 -439
- package/dist/active-citizen/engine/notifications/emails_utils.cjs +0 -569
- package/dist/active-citizen/engine/notifications/generate_point_notifications.cjs +0 -233
- package/dist/active-citizen/engine/notifications/generate_post_notifications.cjs +0 -118
- package/dist/active-citizen/engine/notifications/generate_post_status_change_notifications.cjs +0 -41
- package/dist/active-citizen/engine/notifications/notifications_utils.cjs +0 -148
- package/dist/active-citizen/engine/notifications/point_delivery.cjs +0 -54
- package/dist/active-citizen/engine/notifications/post_delivery.cjs +0 -31
- package/dist/active-citizen/engine/notifications/process_delayed_notifications.cjs +0 -471
- package/dist/active-citizen/engine/notifications/process_general_notifications.cjs +0 -212
- package/dist/active-citizen/engine/old/exporters/categories_dataset.js +0 -153
- package/dist/active-citizen/engine/old/exporters/dataset_tools.js +0 -80
- package/dist/active-citizen/engine/old/exporters/sentiment_dataset.js +0 -157
- package/dist/active-citizen/engine/recommendations/events_importer.cjs +0 -139
- package/dist/active-citizen/engine/recommendations/events_manager.cjs +0 -212
- package/dist/active-citizen/engine/reports/add_points_to_sheet.cjs +0 -83
- package/dist/active-citizen/engine/reports/commonUtils.js +0 -75
- package/dist/active-citizen/engine/reports/common_utils.cjs +0 -740
- package/dist/active-citizen/engine/reports/docx_group_report.cjs +0 -596
- package/dist/active-citizen/engine/reports/xlsAllOurIdeasExport.js +0 -232
- package/dist/active-citizen/engine/reports/xls_community_users_report.cjs +0 -277
- package/dist/active-citizen/engine/reports/xls_group_report.cjs +0 -718
- package/dist/active-citizen/llms/baseChatBot.js +0 -183
- package/dist/active-citizen/llms/imageGeneration/chatGptImageGenerator.js +0 -56
- package/dist/active-citizen/llms/imageGeneration/collectionImageGenerator.js +0 -109
- package/dist/active-citizen/llms/imageGeneration/dalleImageGenerator.js +0 -84
- package/dist/active-citizen/llms/imageGeneration/fluxImageGenerator.js +0 -49
- package/dist/active-citizen/llms/imageGeneration/iImageGenerator.js +0 -1
- package/dist/active-citizen/llms/imageGeneration/imageProcessorService.js +0 -64
- package/dist/active-citizen/llms/imageGeneration/imagenImageGenerator.js +0 -107
- package/dist/active-citizen/llms/imageGeneration/s3Service.js +0 -110
- package/dist/active-citizen/llms/llmTranslation.js +0 -472
- package/dist/active-citizen/models/ac_activity.cjs +0 -216
- package/dist/active-citizen/models/ac_background_job.cjs +0 -109
- package/dist/active-citizen/models/ac_campaign.cjs +0 -97
- package/dist/active-citizen/models/ac_client_activity.cjs +0 -23
- package/dist/active-citizen/models/ac_delayed_notification.cjs +0 -43
- package/dist/active-citizen/models/ac_following.cjs +0 -43
- package/dist/active-citizen/models/ac_list.cjs +0 -68
- package/dist/active-citizen/models/ac_list_users.cjs +0 -19
- package/dist/active-citizen/models/ac_mute.cjs +0 -27
- package/dist/active-citizen/models/ac_news_feed_item.cjs +0 -57
- package/dist/active-citizen/models/ac_news_feed_processed_range.cjs +0 -59
- package/dist/active-citizen/models/ac_notification.cjs +0 -292
- package/dist/active-citizen/models/ac_translation_cache.cjs +0 -750
- package/dist/active-citizen/models/ac_watching.cjs +0 -31
- package/dist/active-citizen/scripts/analytics/setup_all_plausible_goals.cjs +0 -13
- package/dist/active-citizen/scripts/fix_old_delayed_notifications.js +0 -63
- package/dist/active-citizen/scripts/kue_status.js +0 -31
- package/dist/active-citizen/scripts/kue_watch_stuck_jobs.js +0 -24
- package/dist/active-citizen/scripts/translation_clear_language.js +0 -117
- package/dist/active-citizen/scripts/translation_delete.js +0 -27
- package/dist/active-citizen/scripts/translation_replace_text_from_url.js +0 -180
- package/dist/active-citizen/scripts/translation_update.js +0 -28
- package/dist/active-citizen/scripts/translations_list.js +0 -27
- package/dist/active-citizen/utils/airbrake.cjs +0 -17
- package/dist/active-citizen/utils/get_anonymous_system_user.cjs +0 -21
- package/dist/active-citizen/utils/i18n.cjs +0 -3
- package/dist/active-citizen/utils/logger.cjs +0 -25
- package/dist/active-citizen/utils/redisConnection.cjs +0 -29
- package/dist/active-citizen/utils/to_json.cjs +0 -9
- package/dist/active-citizen/utils/translation_cloning.cjs +0 -171
- package/dist/active-citizen/utils/translation_helpers.cjs +0 -534
- package/dist/active-citizen/utils/truncate_text.cjs +0 -21
- package/dist/active-citizen/utils/updateAllLocalesFromEn.js +0 -253
- package/dist/active-citizen/utils/updateLocaleFolders.js +0 -34
- package/dist/active-citizen/workers/activity.cjs +0 -189
- package/dist/active-citizen/workers/anonymizations.cjs +0 -734
- package/dist/active-citizen/workers/bulk_status_update.cjs +0 -458
- package/dist/active-citizen/workers/delayed_jobs.cjs +0 -244
- package/dist/active-citizen/workers/deletions.cjs +0 -1911
- package/dist/active-citizen/workers/email.cjs +0 -9
- package/dist/active-citizen/workers/fraud_management.cjs +0 -109
- package/dist/active-citizen/workers/generativeAi.js +0 -56
- package/dist/active-citizen/workers/main.cjs +0 -89
- package/dist/active-citizen/workers/marketing.cjs +0 -25
- package/dist/active-citizen/workers/moderation.cjs +0 -73
- package/dist/active-citizen/workers/notification_delivery.cjs +0 -368
- package/dist/active-citizen/workers/notification_news_feed.cjs +0 -142
- package/dist/active-citizen/workers/queue.cjs +0 -99
- package/dist/active-citizen/workers/recount.cjs +0 -74
- package/dist/active-citizen/workers/reports.cjs +0 -42
- package/dist/active-citizen/workers/similarities.cjs +0 -21
- package/dist/active-citizen/workers/speech_to_text.cjs +0 -482
- package/dist/agents/assistants/agentAssistant.js +0 -88
- package/dist/agents/assistants/baseAssistant.js +0 -888
- package/dist/agents/assistants/baseAssistantWithVoice.js +0 -150
- package/dist/agents/assistants/modes/agentDirectConnection.js +0 -84
- package/dist/agents/assistants/modes/agentSelectionMode.js +0 -44
- package/dist/agents/assistants/modes/baseAssistantMode.js +0 -54
- package/dist/agents/assistants/modes/tools/agentTools.js +0 -447
- package/dist/agents/assistants/modes/tools/baseTools.js +0 -58
- package/dist/agents/assistants/modes/tools/loginTools.js +0 -156
- package/dist/agents/assistants/modes/tools/models/agents.js +0 -146
- package/dist/agents/assistants/modes/tools/models/subscriptions.js +0 -332
- package/dist/agents/assistants/modes/tools/models/users.js +0 -11
- package/dist/agents/assistants/modes/tools/navigationTools.js +0 -166
- package/dist/agents/assistants/modes/tools/subscriptionTools.js +0 -323
- package/dist/agents/assistants/modes/tools/workflowConverstationTools.js +0 -112
- package/dist/agents/assistants/voiceAssistant.js +0 -619
- package/dist/agents/controllers/agentProductController.js +0 -103
- package/dist/agents/controllers/agentSubscriptionController.js +0 -261
- package/dist/agents/controllers/assistantsController.js +0 -511
- package/dist/agents/controllers/policySynthAgents.js +0 -395
- package/dist/agents/managers/agentProductManager.js +0 -91
- package/dist/agents/managers/emailInvitesManager.js +0 -55
- package/dist/agents/managers/emailTemplateRenderer.js +0 -362
- package/dist/agents/managers/newAiModelSetup.js +0 -650
- package/dist/agents/managers/notificationAgentQueueManager.js +0 -510
- package/dist/agents/managers/subscriptionManager.js +0 -535
- package/dist/agents/managers/workflowConversationManager.js +0 -79
- package/dist/agents/models/agentProduct.js +0 -116
- package/dist/agents/models/agentProductBoosterPurchase.js +0 -58
- package/dist/agents/models/agentProductBundle.js +0 -68
- package/dist/agents/models/agentProductRun.js +0 -52
- package/dist/agents/models/discount.js +0 -88
- package/dist/agents/models/subscription.js +0 -79
- package/dist/agents/models/subscriptionPlan.js +0 -46
- package/dist/agents/models/subscriptionUser.js +0 -27
- package/dist/agents/models/testData/createEvolyAgentProduct.js +0 -477
- package/dist/agents/models/testData/old/updateAgentWorkflowConfiguration.js +0 -230
- package/dist/agents/models/testData/setupEvolyAgentProductConfig.js +0 -233
- package/dist/agents/models/testData/updateAgentWorkflowConfiguration.js +0 -230
- package/dist/agents/models/workflowConversation.js +0 -53
- package/dist/agents/tools/setTemplateWorkflowCommunityId.js +0 -46
- package/dist/app.js +0 -943
- package/dist/authorization.cjs +0 -1860
- package/dist/bot_control.js +0 -1930
- package/dist/config/config.cjs +0 -14
- package/dist/config/config.js +0 -14
- package/dist/controllers/allOurIdeas.js +0 -696
- package/dist/controllers/audios.cjs +0 -100
- package/dist/controllers/bulkStatusUpdates.cjs +0 -202
- package/dist/controllers/categories.cjs +0 -199
- package/dist/controllers/communities.cjs +0 -2996
- package/dist/controllers/domains.cjs +0 -1341
- package/dist/controllers/externalIds.cjs +0 -223
- package/dist/controllers/groups.cjs +0 -4309
- package/dist/controllers/images.cjs +0 -499
- package/dist/controllers/index.cjs +0 -449
- package/dist/controllers/legacyPages.cjs +0 -35
- package/dist/controllers/legacyPosts.cjs +0 -56
- package/dist/controllers/legacyUsers.cjs +0 -36
- package/dist/controllers/nonSpa.cjs +0 -574
- package/dist/controllers/organizations.cjs +0 -250
- package/dist/controllers/points.cjs +0 -1137
- package/dist/controllers/posts.cjs +0 -2036
- package/dist/controllers/ratings.cjs +0 -234
- package/dist/controllers/users.cjs +0 -2255
- package/dist/controllers/videos.cjs +0 -226
- package/dist/deleteUnwantedDeclerations.cjs +0 -55
- package/dist/migrations/agentAuditLogs.cjs +0 -46
- package/dist/migrations/agentClasses.cjs +0 -60
- package/dist/migrations/agentConnectorClasses.cjs +0 -61
- package/dist/migrations/agentConnectors.cjs +0 -50
- package/dist/migrations/agentEvals.cjs +0 -45
- package/dist/migrations/agentRegistries.cjs +0 -40
- package/dist/migrations/agents.cjs +0 -54
- package/dist/migrations/aiModels.cjs +0 -49
- package/dist/migrations/apiUsage.cjs +0 -47
- package/dist/migrations/apis.cjs +0 -49
- package/dist/migrations/groupPrivateData.cjs +0 -30
- package/dist/migrations/modelUsage.cjs +0 -60
- package/dist/migrations/oldMigrations/2019/20181030020612-AddActivitiesIndex.js +0 -23
- package/dist/migrations/oldMigrations/2019/20181102210612-AddFirstVideoFeatures.js +0 -360
- package/dist/migrations/oldMigrations/2019/20181212210612-ModerationFeatures.js +0 -29
- package/dist/migrations/oldMigrations/2019/2019010610612-CommunityFolders.js +0 -43
- package/dist/migrations/oldMigrations/2019/20190117020612-AddMissingIndexes.js +0 -24
- package/dist/migrations/oldMigrations/2019/20190117020612-RemoveUnusedIndexes.js +0 -29
- package/dist/migrations/oldMigrations/2019/20190127020612-RemoveUnusedIndexesPartThree.js +0 -22
- package/dist/migrations/oldMigrations/2019/20190127020612-RemoveUnusedIndexesPartTwo.js +0 -23
- package/dist/migrations/oldMigrations/2019/20190223020612-AddPrivateProfileDataToUsers.js +0 -18
- package/dist/migrations/oldMigrations/2019/20190706210612-AddCustomRatings.js +0 -43
- package/dist/migrations/oldMigrations/2019/20190829210612-AddGeneralStore.js +0 -36
- package/dist/migrations/oldMigrations/2019/20192811210612-AddAcClientActivities.js +0 -41
- package/dist/migrations/oldMigrations/2020/20190527020612-WorkOnIndexes.js +0 -88
- package/dist/migrations/oldMigrations/2020/20200409020612-AddBackgroundJob.js +0 -33
- package/dist/migrations/oldMigrations/2020/20200716210612-AddDataToCollections.js +0 -38
- package/dist/migrations/oldMigrations/2022/20220215100612-AddDataToEndorsements.js +0 -19
- package/dist/migrations/oldMigrations/2022/20220220100612-AddDataForFraudDetection.js +0 -19
- package/dist/migrations/oldMigrations/2022/20220903100612-AddPromotionFeatures.js +0 -127
- package/dist/migrations/oldMigrations/2022/onHold/20200527020612-AddCampaigns.js +0 -68
- package/dist/migrations/oldMigrations/2024/20241304175112-AddMediaSupportForHtmlGroups.cjs +0 -63
- package/dist/migrations/oldMigrations/older/20160511172514-AddNotificationFeatures.js +0 -14
- package/dist/migrations/oldMigrations/older/20161030020612-AddBulkStatusUpdate.js +0 -71
- package/dist/migrations/oldMigrations/older/20170514035258-add-metadata-to-invites.js +0 -12
- package/dist/migrations/oldMigrations/older/20180216020612-AddTranslationCaches.js +0 -46
- package/dist/migrations/oldMigrations/older/20180218210612-AddTranslationAndLanguages.js +0 -46
- package/dist/migrations/privateAccessStore.cjs +0 -55
- package/dist/migrations/zzz_associations.cjs +0 -154
- package/dist/migrations/zzzz_createUsersAndAdminsForClasses.cjs +0 -100
- package/dist/migrations/zzzzz_create_agent_runs.cjs +0 -606
- package/dist/migrations/zzzzzz_create_agent_runs_fix.cjs +0 -11
- package/dist/migrations/zzzzzzz_create_trees.cjs +0 -81
- package/dist/models/audio.cjs +0 -430
- package/dist/models/bulk_status_update.cjs +0 -58
- package/dist/models/campaign.cjs +0 -78
- package/dist/models/category.cjs +0 -94
- package/dist/models/community.cjs +0 -337
- package/dist/models/domain.cjs +0 -486
- package/dist/models/endorsement.cjs +0 -39
- package/dist/models/general_data_store.cjs +0 -20
- package/dist/models/group.cjs +0 -728
- package/dist/models/image.cjs +0 -579
- package/dist/models/index.cjs +0 -186
- package/dist/models/invite.cjs +0 -48
- package/dist/models/iso_country.cjs +0 -16
- package/dist/models/organization.cjs +0 -122
- package/dist/models/page.cjs +0 -273
- package/dist/models/point.cjs +0 -622
- package/dist/models/point_quality.cjs +0 -39
- package/dist/models/point_revision.cjs +0 -47
- package/dist/models/post.cjs +0 -680
- package/dist/models/post_revision.cjs +0 -38
- package/dist/models/post_status_change.cjs +0 -35
- package/dist/models/promotion.cjs +0 -34
- package/dist/models/rating.cjs +0 -51
- package/dist/models/relationship.cjs +0 -19
- package/dist/models/request_to_join.cjs +0 -20
- package/dist/models/user.cjs +0 -604
- package/dist/models/user_legacy_password.cjs +0 -13
- package/dist/models/video.cjs +0 -1137
- package/dist/publish.js +0 -40
- package/dist/repack.js +0 -53
- package/dist/scripts/addRatingUsersToGroup.js +0 -51
- package/dist/scripts/addUserToOrganization.js +0 -71
- package/dist/scripts/analyseRatingsForCommunity.js +0 -150
- package/dist/scripts/analyzeAndFixBrokenPointUsers.js +0 -28
- package/dist/scripts/analyzeEndorsementsByCountry.js +0 -70
- package/dist/scripts/analyzePostsForCommunity.js +0 -185
- package/dist/scripts/bulkStatusUpdates/listUpdates.js +0 -14
- package/dist/scripts/bulkStatusUpdates/mergeLatestPostsToUpdate.js +0 -110
- package/dist/scripts/bulkStatusUpdates/performUpdate.js +0 -116
- package/dist/scripts/bulkStatusUpdates/performUpdateForGroup.cjs +0 -124
- package/dist/scripts/bulkStatusUpdates/performUpdateForStatus.js +0 -141
- package/dist/scripts/change/changeVideoAspectTo.js +0 -34
- package/dist/scripts/change/setUseNewVersion.cjs +0 -22
- package/dist/scripts/changeCommunityGroupcount.js +0 -30
- package/dist/scripts/changeCommunityPostCount.js +0 -30
- package/dist/scripts/changeGroupPostCount.js +0 -30
- package/dist/scripts/changeLanguage.js +0 -50
- package/dist/scripts/changeOfficalStatus.js +0 -30
- package/dist/scripts/cleanups/deleteAnonNotifications.cjs +0 -91
- package/dist/scripts/cleanups/deleteLinkGroupsWithDeletedCommunities.js +0 -62
- package/dist/scripts/cleanups/deleteYearOldNotifications.cjs +0 -72
- package/dist/scripts/cleanups/removeAllUsersFromHiddenPublicGroup.js +0 -43
- package/dist/scripts/clearAllEndorsementInGroup.js +0 -50
- package/dist/scripts/cloning/clearUsersForCommunitiesFromUrl.js +0 -129
- package/dist/scripts/cloning/cloneFromUrlScript.js +0 -65
- package/dist/scripts/cloning/cloneWBFromUrlScriptAndCreateLinks.js +0 -140
- package/dist/scripts/cloning/cloneWBFromUrlScriptNoUsersOrPoints.js +0 -140
- package/dist/scripts/cloning/cloneWBSerbianFromUrlScriptAndCreateLinks.js +0 -131
- package/dist/scripts/cloning/copyCommunityConfigAndTranslationsFromURL.js +0 -173
- package/dist/scripts/cloning/copyCommunityOneGroupToDomainNoUsersNoEndorsements.js +0 -18
- package/dist/scripts/cloning/copyCommunityToDomainNoUsersNoEndorsements.js +0 -17
- package/dist/scripts/cloning/copyCommunityToDomainWithEverything.js +0 -17
- package/dist/scripts/cloning/copyCommunityToDomainWithOnlyGroups.js +0 -26
- package/dist/scripts/cloning/copyGroupConfigAndTranslationsFromURL.js +0 -205
- package/dist/scripts/cloning/copyPostToGroupOld.js +0 -397
- package/dist/scripts/cloning/copyPostVideosFromURL.js +0 -236
- package/dist/scripts/cloning/copyPostWithOutAnyVotingOrActivities.js +0 -17
- package/dist/scripts/cloning/deepCloneSerbianWBFromUrlScriptAndCreateLinks.js +0 -131
- package/dist/scripts/cloning/deepCloneWBFromUrlScriptAndCreateLinks.js +0 -139
- package/dist/scripts/cloning/setAdminsFromURL.js +0 -161
- package/dist/scripts/cloning/setExternalIdsFromURL.js +0 -129
- package/dist/scripts/countCommunity.js +0 -291
- package/dist/scripts/countCommunityUsers.js +0 -152
- package/dist/scripts/countDelayedNotifications.js +0 -18
- package/dist/scripts/countGroup.js +0 -246
- package/dist/scripts/countStuff.js +0 -67
- package/dist/scripts/countUniqueVotersInAGroup.js +0 -48
- package/dist/scripts/createInvitesAndShow.js +0 -75
- package/dist/scripts/database/sync_database.js +0 -14
- package/dist/scripts/database/sync_dev_database.js +0 -17
- package/dist/scripts/debugNotifications.js +0 -58
- package/dist/scripts/deleteAllNewsFeeds.js +0 -10
- package/dist/scripts/deleteCategory.js +0 -13
- package/dist/scripts/deleteOldAppActivities.js +0 -40
- package/dist/scripts/deletePostContactDataForCommunity.js +0 -53
- package/dist/scripts/destroy/destroy_all_but_one_domain.js +0 -1026
- package/dist/scripts/displayAuthorForPost.js +0 -16
- package/dist/scripts/endorsementFraudDetection/analyseEndorsementsForCommunity.js +0 -183
- package/dist/scripts/endorsementFraudDetection/bulkDeleteDuplicateEndorsmentsFromUrl.js +0 -208
- package/dist/scripts/exportAllStatusChanges.js +0 -36
- package/dist/scripts/exportClientAcitivity.js +0 -36
- package/dist/scripts/exportEndorsementsForCommunity.js +0 -79
- package/dist/scripts/exportPointQualitiesForCommunity.js +0 -84
- package/dist/scripts/exportPostsAndPointsForCommunity.js +0 -147
- package/dist/scripts/exportPostsDataSetForDomain.js +0 -244
- package/dist/scripts/exportPostsForGroup.js +0 -173
- package/dist/scripts/exportRatingsForPost.js +0 -15
- package/dist/scripts/exportUserEndorsementsWithUserAnalysis.js +0 -123
- package/dist/scripts/exportUsersForCommunity.js +0 -24
- package/dist/scripts/exportUsersForDomain.js +0 -24
- package/dist/scripts/exportUsersForGroup.js +0 -24
- package/dist/scripts/exports/ratingDistribution.js +0 -71
- package/dist/scripts/exports/whoEndorsedWhatByCommunity.js +0 -56
- package/dist/scripts/findUnusedClientImports.js +0 -56
- package/dist/scripts/fixAllPostPointCounts.js +0 -22
- package/dist/scripts/fixAnonNotificationsSettings.js +0 -48
- package/dist/scripts/fixCountKopavogur.js +0 -9
- package/dist/scripts/fixEndorsementsAfterCopyPostToGroup.js +0 -190
- package/dist/scripts/fixExternalUserId.js +0 -24
- package/dist/scripts/fixGroupAccess.js +0 -16
- package/dist/scripts/fixGroupIdeasAndPointsCount.js +0 -49
- package/dist/scripts/fixNotificationSettings.js +0 -39
- package/dist/scripts/fixSurveyRadioBakedInSubCodes.js +0 -64
- package/dist/scripts/fixWrongUserIdForStatusUpdates.js +0 -49
- package/dist/scripts/gallery/exportGalleryData.js +0 -40
- package/dist/scripts/gallery/importGalleryForCommunity.js +0 -168
- package/dist/scripts/gallery/readJsonAndDownloadImagesVersion2.js +0 -55
- package/dist/scripts/gallery/refreshAcApiPostIdsForCommunity.js +0 -58
- package/dist/scripts/genderAnalysis.js +0 -63
- package/dist/scripts/genderAnalysisByStatus.js +0 -62
- package/dist/scripts/importAllLocalesFromLocalFolders.js +0 -55
- package/dist/scripts/importDomain.js +0 -1652
- package/dist/scripts/keys/addOidcToDomain.cjs +0 -61
- package/dist/scripts/landUseGame/export3Ddata.js +0 -162
- package/dist/scripts/listLanguagesForGroup.js +0 -54
- package/dist/scripts/loadTestCreateDummyContentForGroup.js +0 -27
- package/dist/scripts/makeRecursiveMapData.js +0 -103
- package/dist/scripts/mapping/community_map_csv.js +0 -145
- package/dist/scripts/moveCommunityToDomain.js +0 -22
- package/dist/scripts/moveGroupToCommunity.js +0 -23
- package/dist/scripts/movePostToGroup.js +0 -101
- package/dist/scripts/movePostsToGroupsRecountGroupFromUrl.js +0 -297
- package/dist/scripts/oldMovePostToGroup.js +0 -153
- package/dist/scripts/processCsvForPdfUrls.js +0 -37
- package/dist/scripts/processCsvForTranslationAndToxicity.js +0 -125
- package/dist/scripts/recount/recount_recursive_communities.js +0 -125
- package/dist/scripts/recountALLCommunityGroupCounts.js +0 -37
- package/dist/scripts/recountAll.js +0 -97
- package/dist/scripts/recountCommunitesFromUrl.js +0 -58
- package/dist/scripts/recountCommunity.js +0 -19
- package/dist/scripts/recountGroup.js +0 -218
- package/dist/scripts/recountGroupNoUserChange.js +0 -219
- package/dist/scripts/resetAllEndorsementsForGroup.js +0 -57
- package/dist/scripts/resetEnTranslationForGroup.js +0 -45
- package/dist/scripts/setAdminOnAll.cjs +0 -107
- package/dist/scripts/setDomainAdmin.cjs +0 -43
- package/dist/scripts/setDomainLocales.js +0 -33
- package/dist/scripts/setEarlQuestionIdOnGroup.cjs +0 -29
- package/dist/scripts/setLanguageOnGroupCommunitesFromUrl.js +0 -86
- package/dist/scripts/setMemberOfAll.js +0 -101
- package/dist/scripts/setNewUserForContentOfCommunity.js +0 -189
- package/dist/scripts/setOfficialStatusOnAllPostsForCommunity.js +0 -35
- package/dist/scripts/setUserOnAll.js +0 -101
- package/dist/scripts/showCategoryForGroup.js +0 -18
- package/dist/scripts/showOldActivityTypes.js +0 -14
- package/dist/scripts/showPostsMissingCategoryForGroup.js +0 -17
- package/dist/scripts/showStatuses.js +0 -17
- package/dist/scripts/showUniqueVotersInCommunity.js +0 -61
- package/dist/scripts/showUserAgentsAndIpsForEmails.js +0 -66
- package/dist/scripts/simpleExportForGroupsForCommunity.js +0 -46
- package/dist/scripts/simpleExportForPointsForCommunity.js +0 -82
- package/dist/scripts/simpleExportForPostsForCommunity.js +0 -61
- package/dist/scripts/testForEndorsments.js +0 -21
- package/dist/scripts/undeleteGroupAndAllContent.js +0 -151
- package/dist/scripts/undeletePost.js +0 -135
- package/dist/scripts/unlinkSsn.js +0 -23
- package/dist/scripts/updateFromAlthingi.js +0 -303
- package/dist/server.js +0 -3
- package/dist/utils/airbrake.cjs +0 -17
- package/dist/utils/cjsCodeReview.js +0 -99
- package/dist/utils/community_mapping_tools.cjs +0 -124
- package/dist/utils/copy_utils.cjs +0 -1399
- package/dist/utils/docx_utils.cjs +0 -464
- package/dist/utils/export_utils.cjs +0 -491
- package/dist/utils/i18n.cjs +0 -17
- package/dist/utils/is_valid_db_id.cjs +0 -28
- package/dist/utils/logger.cjs +0 -25
- package/dist/utils/loggerTs.js +0 -26
- package/dist/utils/manifest_generator.cjs +0 -104
- package/dist/utils/parse_domain.cjs +0 -16
- package/dist/utils/recount_utils.cjs +0 -415
- package/dist/utils/sharing_parameters.cjs +0 -111
- package/dist/utils/sitemap_generator.cjs +0 -286
- package/dist/utils/to_json.cjs +0 -14
- package/dist/utils/ypLanguages.js +0 -747
- package/dist/webSockets.js +0 -77
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const async = require("async");
|
|
3
|
-
const models = require("../../models/index.cjs");
|
|
4
|
-
const log = require('../utils/logger.cjs');
|
|
5
|
-
const queue = require('./queue.cjs');
|
|
6
|
-
const i18n = require('../utils/i18n.cjs');
|
|
7
|
-
const toJson = require('../utils/to_json.cjs');
|
|
8
|
-
const _ = require('lodash');
|
|
9
|
-
const fs = require('fs');
|
|
10
|
-
const createDocxReport = require('../engine/reports/docx_group_report.cjs').createDocxReport;
|
|
11
|
-
const createXlsReport = require('../engine/reports/xls_group_report.cjs').createXlsReport;
|
|
12
|
-
const createXlsCommunityUsersReport = require('../engine/reports/xls_community_users_report.cjs').createXlsCommunityUsersReport;
|
|
13
|
-
const createFraudAuditReport = require('../engine/moderation/fraud/CreateFraudAuditReport.cjs').createFraudAuditReport;
|
|
14
|
-
let airbrake = null;
|
|
15
|
-
if (process.env.AIRBRAKE_PROJECT_ID) {
|
|
16
|
-
airbrake = require('../utils/airbrake.cjs');
|
|
17
|
-
}
|
|
18
|
-
let ReportsWorker = function () { };
|
|
19
|
-
import("../engine/reports/xlsAllOurIdeasExport.js").then(({ exportChoiceVotes }) => {
|
|
20
|
-
ReportsWorker.prototype.process = (workPackage, callback) => {
|
|
21
|
-
switch (workPackage.type) {
|
|
22
|
-
case 'start-docx-report-generation':
|
|
23
|
-
createDocxReport(workPackage, callback);
|
|
24
|
-
break;
|
|
25
|
-
case 'start-xls-report-generation':
|
|
26
|
-
createXlsReport(workPackage, callback);
|
|
27
|
-
break;
|
|
28
|
-
case 'start-aoi-xls-report-generation':
|
|
29
|
-
exportChoiceVotes(workPackage, callback);
|
|
30
|
-
break;
|
|
31
|
-
case 'start-xls-users-community-report-generation':
|
|
32
|
-
createXlsCommunityUsersReport(workPackage, callback);
|
|
33
|
-
break;
|
|
34
|
-
case 'start-fraud-audit-report-generation':
|
|
35
|
-
createFraudAuditReport(workPackage, callback);
|
|
36
|
-
break;
|
|
37
|
-
default:
|
|
38
|
-
callback("Unknown type for workPackage: " + workPackage.type);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
module.exports = new ReportsWorker();
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const async = require("async");
|
|
3
|
-
const models = require("../../models/index.cjs");
|
|
4
|
-
const log = require('../utils/logger.cjs');
|
|
5
|
-
const queue = require('./queue.cjs');
|
|
6
|
-
const i18n = require('../utils/i18n.cjs');
|
|
7
|
-
const toJson = require('../utils/to_json.cjs');
|
|
8
|
-
const _ = require('lodash');
|
|
9
|
-
const fs = require('fs');
|
|
10
|
-
const updateSimilaritiesCollection = require('../engine/analytics/manager.cjs').updateCollection;
|
|
11
|
-
let SimilaritiesWorker = function () { };
|
|
12
|
-
SimilaritiesWorker.prototype.process = (workPackage, callback) => {
|
|
13
|
-
switch (workPackage.type) {
|
|
14
|
-
case 'update-collection':
|
|
15
|
-
updateSimilaritiesCollection(workPackage, callback);
|
|
16
|
-
break;
|
|
17
|
-
default:
|
|
18
|
-
callback("Unknown type for workPackage: " + workPackage.type);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
module.exports = new SimilaritiesWorker();
|
|
@@ -1,482 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const async = require("async");
|
|
3
|
-
const models = require("../../models/index.cjs");
|
|
4
|
-
const log = require('../utils/logger.cjs');
|
|
5
|
-
const queue = require('./queue.cjs');
|
|
6
|
-
const i18n = require('../utils/i18n.cjs');
|
|
7
|
-
const toJson = require('../utils/to_json.cjs');
|
|
8
|
-
const _ = require('lodash');
|
|
9
|
-
const getAnonymousUser = require('../utils/get_anonymous_system_user.cjs');
|
|
10
|
-
var downloadFile = require('download-file');
|
|
11
|
-
const fs = require('fs');
|
|
12
|
-
let speech, Storage;
|
|
13
|
-
let GOOGLE_APPLICATION_CREDENTIALS;
|
|
14
|
-
if (process.env.GOOGLE_APPLICATION_CREDENTIALS_JSON && process.env.GOOGLE_TRANSCODING_FLAC_BUCKET) {
|
|
15
|
-
const config = {
|
|
16
|
-
projectId: process.env.GOOGLE_TRANSLATE_PROJECT_ID ? process.env.GOOGLE_TRANSLATE_PROJECT_ID : "neon-particle-735",
|
|
17
|
-
credentials: JSON.parse(process.env.GOOGLE_APPLICATION_CREDENTIALS_JSON)
|
|
18
|
-
};
|
|
19
|
-
GOOGLE_APPLICATION_CREDENTIALS = JSON.parse(process.env.GOOGLE_APPLICATION_CREDENTIALS_JSON);
|
|
20
|
-
speech = require('@google-cloud/speech');
|
|
21
|
-
Storage = require('@google-cloud/storage').Storage;
|
|
22
|
-
}
|
|
23
|
-
let airbrake = null;
|
|
24
|
-
if (process.env.AIRBRAKE_PROJECT_ID) {
|
|
25
|
-
airbrake = require('../utils/airbrake.cjs');
|
|
26
|
-
}
|
|
27
|
-
let VoiceToTextWorker = function () { };
|
|
28
|
-
const supportedGoogleLanguges = [
|
|
29
|
-
['af-ZA', true, false],
|
|
30
|
-
['am-ET', true, false],
|
|
31
|
-
['hy-AM', true, false],
|
|
32
|
-
['az-AZ', true, false],
|
|
33
|
-
['id-ID', true, false],
|
|
34
|
-
['ms-MY', true, false],
|
|
35
|
-
['bn-BD', false, true],
|
|
36
|
-
['bn-IN', true, false],
|
|
37
|
-
['ca-ES', true, false],
|
|
38
|
-
['cs-CZ', true, false],
|
|
39
|
-
['da-DK', true, false],
|
|
40
|
-
['de-DE', true, false],
|
|
41
|
-
['en-AU', false, false],
|
|
42
|
-
['en-CA', false, false],
|
|
43
|
-
['en-GH', false, false],
|
|
44
|
-
['en-GB', false, true],
|
|
45
|
-
['en-IN', false, false],
|
|
46
|
-
['en-IE', false, false],
|
|
47
|
-
['en-KE', false, false],
|
|
48
|
-
['en-NZ', false, false],
|
|
49
|
-
['en-NG', false, false],
|
|
50
|
-
['en-PH', false, false],
|
|
51
|
-
['en-ZA', false, false],
|
|
52
|
-
['en-TZ', false, false],
|
|
53
|
-
['en-US', true, false],
|
|
54
|
-
['es-AR', false, false],
|
|
55
|
-
['es-BO', false, false],
|
|
56
|
-
['es-CL', false, false],
|
|
57
|
-
['es-CO', false, false],
|
|
58
|
-
['es-CR', false, false],
|
|
59
|
-
['es-EC', false, false],
|
|
60
|
-
['es-SV', false, false],
|
|
61
|
-
['es-ES', true, false],
|
|
62
|
-
['es-US', true, false],
|
|
63
|
-
['es-GT', false, false],
|
|
64
|
-
['es-HN', false, false],
|
|
65
|
-
['es-MX', false, true],
|
|
66
|
-
['es-NI', false, false],
|
|
67
|
-
['es-PA', false, false],
|
|
68
|
-
['es-PY', false, false],
|
|
69
|
-
['es-PE', false, false],
|
|
70
|
-
['es-PR', false, false],
|
|
71
|
-
['es-DO', false, false],
|
|
72
|
-
['es-UY', false, false],
|
|
73
|
-
['es-VE', false, false],
|
|
74
|
-
['eu-ES', true, false],
|
|
75
|
-
['fil-PH', true, false],
|
|
76
|
-
['fr-CA', false, true],
|
|
77
|
-
['fr-FR', true, false],
|
|
78
|
-
['gl-ES', true, false],
|
|
79
|
-
['ka-GE', true, false],
|
|
80
|
-
['gu-IN', true, false],
|
|
81
|
-
['hr-HR', true, false],
|
|
82
|
-
['zu-ZA', true, false],
|
|
83
|
-
['is-IS', true, false],
|
|
84
|
-
['it-IT', true, false],
|
|
85
|
-
['jv-ID', true, false],
|
|
86
|
-
['kn-IN', true, false],
|
|
87
|
-
['km-KH', true, false],
|
|
88
|
-
['lo-LA', true, false],
|
|
89
|
-
['lv-LV', true, false],
|
|
90
|
-
['lt-LT', true, false],
|
|
91
|
-
['hu-HU', true, false],
|
|
92
|
-
['ml-IN', true, false],
|
|
93
|
-
['mr-IN', true, false],
|
|
94
|
-
['nl-NL', true, false],
|
|
95
|
-
['ne-NP', true, false],
|
|
96
|
-
['nb-NO', true, false],
|
|
97
|
-
['pl-PL', true, false],
|
|
98
|
-
['pt-BR', false, true],
|
|
99
|
-
['pt-PT', true, false],
|
|
100
|
-
['ro-RO', true, false],
|
|
101
|
-
['si-LK', true, false],
|
|
102
|
-
['sk-SK', true, false],
|
|
103
|
-
['sl-SI', true, false],
|
|
104
|
-
['su-ID', true, false],
|
|
105
|
-
['sw-TZ', true, false],
|
|
106
|
-
['sw-KE', true, false],
|
|
107
|
-
['fi-FI', true, false],
|
|
108
|
-
['sv-SE', true, false],
|
|
109
|
-
['ta-IN', true, false],
|
|
110
|
-
['ta-SG', false, false],
|
|
111
|
-
['ta-LK', false, false],
|
|
112
|
-
['ta-MY', false, true],
|
|
113
|
-
['te-IN', true, false],
|
|
114
|
-
['vi-VN', true, false],
|
|
115
|
-
['tr-TR', true, false],
|
|
116
|
-
['ur-PK', true, false],
|
|
117
|
-
['ur-IN', true, false],
|
|
118
|
-
['el-GR', true, false],
|
|
119
|
-
['bg-BG', true, false],
|
|
120
|
-
['ru-RU', true, false],
|
|
121
|
-
['sr-RS', true, false],
|
|
122
|
-
['uk-UA', true, false],
|
|
123
|
-
['he-IL', true, false],
|
|
124
|
-
['ar-IL', false, true],
|
|
125
|
-
['ar-JO', false, false],
|
|
126
|
-
['ar-AE', false, false],
|
|
127
|
-
['ar-BH', false, false],
|
|
128
|
-
['ar-DZ', false, false],
|
|
129
|
-
['ar-SA', false, false],
|
|
130
|
-
['ar-IQ', false, false],
|
|
131
|
-
['ar-KW', false, false],
|
|
132
|
-
['ar-MA', false, false],
|
|
133
|
-
['ar-TN', false, false],
|
|
134
|
-
['ar-OM', false, false],
|
|
135
|
-
['ar-PS', false, false],
|
|
136
|
-
['ar-QA', false, false],
|
|
137
|
-
['ar-LB', false, false],
|
|
138
|
-
['ar-EG', true, false],
|
|
139
|
-
['fa-IR', true, false],
|
|
140
|
-
['hi-IN', true, false],
|
|
141
|
-
['th-TH', true, false],
|
|
142
|
-
['ko-KR', true, false],
|
|
143
|
-
['cmn-Hant-TW', false, true],
|
|
144
|
-
['yue-Hant-HK', true, false],
|
|
145
|
-
['ja-JP', true, false],
|
|
146
|
-
['cmn-Hans-HK', false, false],
|
|
147
|
-
['cmn-Hans-CN', true, false]
|
|
148
|
-
];
|
|
149
|
-
const transformYrpriCode = (code) => {
|
|
150
|
-
return code.replace('_', '-').replace('zh_tw', 'cmn-Hant-TW').replace('no', 'nb-NO').replace('ro-md', 'ro-RO').replace('ro_md', 'ro-RO');
|
|
151
|
-
};
|
|
152
|
-
const exactLanguageMatch = (code) => {
|
|
153
|
-
code = transformYrpriCode(code);
|
|
154
|
-
let match = null;
|
|
155
|
-
_.forEach(supportedGoogleLanguges, (language) => {
|
|
156
|
-
if (language[0] === code)
|
|
157
|
-
match = language[0];
|
|
158
|
-
});
|
|
159
|
-
return match;
|
|
160
|
-
};
|
|
161
|
-
const firstTwoLanguagePrimaryMatch = (code) => {
|
|
162
|
-
code = transformYrpriCode(code);
|
|
163
|
-
let match = null;
|
|
164
|
-
_.forEach(supportedGoogleLanguges, (language) => {
|
|
165
|
-
const enCode = language[0].substring(0, 3);
|
|
166
|
-
const chineseCode = language[0].substring(0, 4);
|
|
167
|
-
if (enCode === code + '-' && language[1] === true)
|
|
168
|
-
match = language[0];
|
|
169
|
-
if (chineseCode === code + '-' && language[1] === true)
|
|
170
|
-
match = language[0];
|
|
171
|
-
});
|
|
172
|
-
return match;
|
|
173
|
-
};
|
|
174
|
-
const firstTwoLanguageSecondaryMatch = (code) => {
|
|
175
|
-
code = transformYrpriCode(code);
|
|
176
|
-
let match = null;
|
|
177
|
-
_.forEach(supportedGoogleLanguges, (language) => {
|
|
178
|
-
if (language[0].substring(0, 3) === code + '-' && language[2] === true)
|
|
179
|
-
match = language[0];
|
|
180
|
-
if (language[0].substring(0, 4) === code + '-' && language[2] === true)
|
|
181
|
-
match = language[0];
|
|
182
|
-
});
|
|
183
|
-
return match;
|
|
184
|
-
};
|
|
185
|
-
const getLanguageArray = (workPackage) => {
|
|
186
|
-
let alternativeLanguageCodes = [];
|
|
187
|
-
let languageCode = null;
|
|
188
|
-
const appLanguage = workPackage.appLanguage;
|
|
189
|
-
const browserLanguage = workPackage.browserLanguage;
|
|
190
|
-
if (appLanguage && appLanguage) {
|
|
191
|
-
let exactAppMatch = exactLanguageMatch(appLanguage);
|
|
192
|
-
let primaryAppMatch = firstTwoLanguagePrimaryMatch(appLanguage);
|
|
193
|
-
let secondaryAppMatch = firstTwoLanguageSecondaryMatch(appLanguage);
|
|
194
|
-
let exactBrowserMatch = exactLanguageMatch(browserLanguage);
|
|
195
|
-
let primaryBrowserMatch = firstTwoLanguagePrimaryMatch(browserLanguage);
|
|
196
|
-
let secondaryBrowserMatch = firstTwoLanguageSecondaryMatch(browserLanguage);
|
|
197
|
-
if (exactAppMatch)
|
|
198
|
-
languageCode = exactAppMatch;
|
|
199
|
-
else if (primaryAppMatch)
|
|
200
|
-
languageCode = primaryAppMatch;
|
|
201
|
-
else if (secondaryAppMatch)
|
|
202
|
-
languageCode = secondaryAppMatch;
|
|
203
|
-
else if (exactBrowserMatch)
|
|
204
|
-
languageCode = exactBrowserMatch;
|
|
205
|
-
else if (primaryBrowserMatch)
|
|
206
|
-
languageCode = primaryBrowserMatch;
|
|
207
|
-
if (!languageCode) {
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
if (exactAppMatch && exactAppMatch !== languageCode)
|
|
212
|
-
alternativeLanguageCodes.push(exactAppMatch);
|
|
213
|
-
if (primaryAppMatch && primaryAppMatch !== languageCode)
|
|
214
|
-
alternativeLanguageCodes.push(primaryAppMatch);
|
|
215
|
-
if (secondaryAppMatch && secondaryAppMatch !== languageCode)
|
|
216
|
-
alternativeLanguageCodes.push(secondaryAppMatch);
|
|
217
|
-
if (exactBrowserMatch && exactBrowserMatch !== languageCode)
|
|
218
|
-
alternativeLanguageCodes.push(exactBrowserMatch);
|
|
219
|
-
if (primaryBrowserMatch && primaryBrowserMatch !== languageCode)
|
|
220
|
-
alternativeLanguageCodes.push(primaryBrowserMatch);
|
|
221
|
-
if (secondaryBrowserMatch)
|
|
222
|
-
alternativeLanguageCodes.push(primaryBrowserMatch);
|
|
223
|
-
}
|
|
224
|
-
alternativeLanguageCodes = _.uniq(alternativeLanguageCodes);
|
|
225
|
-
if (alternativeLanguageCodes.length < 3)
|
|
226
|
-
alternativeLanguageCodes.push("en-US");
|
|
227
|
-
// if (alternativeLanguageCodes.length<3)
|
|
228
|
-
// alternativeLanguageCodes.push("is-IS");
|
|
229
|
-
if (alternativeLanguageCodes.length > 3)
|
|
230
|
-
alternativeLanguageCodes = alternativeLanguageCodes.slice(0, 3);
|
|
231
|
-
const languageSelection = { languageCode, alternativeLanguageCodes };
|
|
232
|
-
log.info("Selected languages for transcript", languageSelection, workPackage);
|
|
233
|
-
return languageSelection;
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
const createTranscriptForFlac = (flackUrl, workPackage, callback) => {
|
|
240
|
-
const languageSelection = getLanguageArray(workPackage);
|
|
241
|
-
if (languageSelection && speech) {
|
|
242
|
-
const client = new speech.SpeechClient({
|
|
243
|
-
credentials: JSON.parse(process.env.GOOGLE_APPLICATION_CREDENTIALS_JSON),
|
|
244
|
-
projectId: process.env.GOOGLE_TRANSLATE_PROJECT_ID ? process.env.GOOGLE_TRANSLATE_PROJECT_ID : undefined,
|
|
245
|
-
});
|
|
246
|
-
const encoding = 'FLAC';
|
|
247
|
-
const sampleRateHertz = 44100;
|
|
248
|
-
const config = {
|
|
249
|
-
encoding: encoding,
|
|
250
|
-
sampleRateHertz: sampleRateHertz,
|
|
251
|
-
languageCode: languageSelection.languageCode,
|
|
252
|
-
// Disabled for now as it does not work well enough for long form content
|
|
253
|
-
//alternativeLanguageCodes: languageSelection.alternativeLanguageCodes,
|
|
254
|
-
enableWordTimeOffsets: true,
|
|
255
|
-
enableAutomaticPunctuation: true,
|
|
256
|
-
enableWordConfidence: true
|
|
257
|
-
};
|
|
258
|
-
const audio = {
|
|
259
|
-
uri: flackUrl,
|
|
260
|
-
};
|
|
261
|
-
const request = {
|
|
262
|
-
config: config,
|
|
263
|
-
audio: audio
|
|
264
|
-
};
|
|
265
|
-
log.info("createTranscriptForFlac: Starting speech to text", { request });
|
|
266
|
-
client
|
|
267
|
-
.longRunningRecognize(request)
|
|
268
|
-
.then(data => {
|
|
269
|
-
log.info("createTranscriptForFlac: Got data from google cloud - step 1", { data });
|
|
270
|
-
let operation = data[0];
|
|
271
|
-
operation.backoffSettings.totalTimeoutMillis = 120000;
|
|
272
|
-
log.info(operation.backoffSettings);
|
|
273
|
-
return operation.promise();
|
|
274
|
-
})
|
|
275
|
-
.then(data => {
|
|
276
|
-
log.info("createTranscriptForFlac: Got data from google cloud - step 2", { data });
|
|
277
|
-
callback(null, data[0]);
|
|
278
|
-
})
|
|
279
|
-
.catch(error => {
|
|
280
|
-
log.error("createTranscriptForFlac: error", { error });
|
|
281
|
-
callback(error);
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
log.warn("Can't find any languages to translate or speech not here", { workPackage, speechNull: speech == null });
|
|
286
|
-
callback("Can't find languages");
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
const uploadFlacToGoogleCloud = (flacUrl, callback) => {
|
|
290
|
-
const splitUrl = flacUrl.split('/');
|
|
291
|
-
const fileName = splitUrl[splitUrl.length - 1];
|
|
292
|
-
const fileNameWithPath = '/tmp/' + fileName;
|
|
293
|
-
const fileUri = 'gs://' + process.env.GOOGLE_TRANSCODING_FLAC_BUCKET + '/' + fileName;
|
|
294
|
-
downloadFile(flacUrl, { filename: fileName, directory: '/tmp/' }, error => {
|
|
295
|
-
if (error) {
|
|
296
|
-
fs.unlink(fileNameWithPath, unlinkError => {
|
|
297
|
-
callback('Could not download file');
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
const storage = new Storage({
|
|
302
|
-
credentials: JSON.parse(process.env.GOOGLE_APPLICATION_CREDENTIALS_JSON),
|
|
303
|
-
projectId: process.env.GOOGLE_TRANSLATE_PROJECT_ID ? process.env.GOOGLE_TRANSLATE_PROJECT_ID : undefined,
|
|
304
|
-
});
|
|
305
|
-
const bucket = storage.bucket(process.env.GOOGLE_TRANSCODING_FLAC_BUCKET);
|
|
306
|
-
if (bucket) {
|
|
307
|
-
bucket.upload(fileNameWithPath, (error, file, apiResponse) => {
|
|
308
|
-
if (error) {
|
|
309
|
-
log.error("Couldnt upload to s3 bucket", { error, apiResponse });
|
|
310
|
-
fs.unlink(fileNameWithPath, unlinkError => {
|
|
311
|
-
callback(error);
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
fs.unlink(fileNameWithPath, error => {
|
|
316
|
-
if (error) {
|
|
317
|
-
callback(error);
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
log.info("uploadFlacToGoogleCloud done", { flacUrl });
|
|
321
|
-
callback(null, fileUri);
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
fs.unlink(fileNameWithPath, unlinkError => {
|
|
329
|
-
callback('Could not find GCloud bucket');
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
};
|
|
335
|
-
const createTranscriptForVideo = (workPackage, callback) => {
|
|
336
|
-
log.info("In createTranscriptForVideo");
|
|
337
|
-
models.Video.findOne({
|
|
338
|
-
where: workPackage.videoId
|
|
339
|
-
}).then((video) => {
|
|
340
|
-
if (video) {
|
|
341
|
-
if (!video.meta.transcript)
|
|
342
|
-
video.set('meta.transcript', {});
|
|
343
|
-
video.set('meta.transcript.inProgressDate', new Date());
|
|
344
|
-
video.save().then(() => {
|
|
345
|
-
const videoUrl = video.formats[0];
|
|
346
|
-
const flacUrl = videoUrl.slice(0, videoUrl.length - 4) + '.flac';
|
|
347
|
-
uploadFlacToGoogleCloud(flacUrl, (error, gsUri) => {
|
|
348
|
-
if (error) {
|
|
349
|
-
log.warn('createTranscriptForVideo', { warn: 'Found no audio file' });
|
|
350
|
-
video.set('meta.transcript.error', 'Found no audio file');
|
|
351
|
-
video.save().then(() => {
|
|
352
|
-
log.info("createTranscriptForVideo: Video with transcript saved with error", { videoId: workPackage.videoId, error });
|
|
353
|
-
callback();
|
|
354
|
-
}).catch((error) => {
|
|
355
|
-
callback(error);
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
else {
|
|
359
|
-
log.info("createTranscriptForVideo: have uploaded to Google Cloud");
|
|
360
|
-
createTranscriptForFlac(gsUri, workPackage, (error, response) => {
|
|
361
|
-
log.info("createTranscriptForVideo: got transcript", { response });
|
|
362
|
-
video.set('meta.transcript.googleSpeechResponse', response);
|
|
363
|
-
if (error) {
|
|
364
|
-
video.set('meta.transcript.error', error);
|
|
365
|
-
log.error('createTranscriptForVideo', { error });
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
if (response.results && response.results && response.results.length > 0 &&
|
|
369
|
-
response.results[0].alternatives && response.results[0].alternatives.length > 0) {
|
|
370
|
-
const transcription = response.results
|
|
371
|
-
.map(result => result.alternatives[0].transcript)
|
|
372
|
-
.join('\n');
|
|
373
|
-
video.set('meta.transcript.text', transcription);
|
|
374
|
-
}
|
|
375
|
-
else {
|
|
376
|
-
video.set('meta.transcript.error', 'Found no text');
|
|
377
|
-
log.error('createTranscriptForVideo', { error: 'Found no text' });
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
video.save().then(() => {
|
|
381
|
-
log.info("createTranscriptForVideo: Video with transcript saved", { videoId: workPackage.videoId, error });
|
|
382
|
-
callback();
|
|
383
|
-
}).catch((error) => {
|
|
384
|
-
callback(error);
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
}).catch(error => {
|
|
390
|
-
callback(error);
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
else {
|
|
394
|
-
callback("Couldn't find video for createTranscriptForVideo", { workPackage });
|
|
395
|
-
}
|
|
396
|
-
}).catch((error) => {
|
|
397
|
-
callback(error);
|
|
398
|
-
});
|
|
399
|
-
};
|
|
400
|
-
const createTranscriptForAudio = (workPackage, callback) => {
|
|
401
|
-
log.info("In createTranscriptForAudio");
|
|
402
|
-
models.Audio.findOne({
|
|
403
|
-
where: workPackage.audioId,
|
|
404
|
-
include: [
|
|
405
|
-
{
|
|
406
|
-
model: models.Point,
|
|
407
|
-
as: 'PointAudios',
|
|
408
|
-
required: false
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
model: models.Post,
|
|
412
|
-
as: 'PostAudios',
|
|
413
|
-
required: false
|
|
414
|
-
}
|
|
415
|
-
]
|
|
416
|
-
}).then((audio) => {
|
|
417
|
-
if (audio) {
|
|
418
|
-
if (!audio.meta.transcript)
|
|
419
|
-
audio.set('meta.transcript', {});
|
|
420
|
-
audio.set('meta.transcript.inProgressDate', new Date());
|
|
421
|
-
audio.save().then(() => {
|
|
422
|
-
const audioUrl = audio.formats[0];
|
|
423
|
-
const flacUrl = audioUrl.slice(0, audioUrl.length - 4) + '.flac';
|
|
424
|
-
uploadFlacToGoogleCloud(flacUrl, (error, gsUri) => {
|
|
425
|
-
if (error) {
|
|
426
|
-
callback(error);
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
log.info("createTranscriptForAudio: have uploaded to Google Cloud");
|
|
430
|
-
createTranscriptForFlac(gsUri, workPackage, (error, response) => {
|
|
431
|
-
log.info("createTranscriptForAudio: got transcript", { response });
|
|
432
|
-
audio.set('meta.transcript.googleSpeechResponse', response);
|
|
433
|
-
if (error) {
|
|
434
|
-
audio.set('meta.transcript.error', error);
|
|
435
|
-
log.error("createTranscriptForAudio", { error });
|
|
436
|
-
}
|
|
437
|
-
else {
|
|
438
|
-
if (response.results && response.results && response.results.length > 0 &&
|
|
439
|
-
response.results[0].alternatives && response.results[0].alternatives.length > 0) {
|
|
440
|
-
const transcription = response.results
|
|
441
|
-
.map(result => result.alternatives[0].transcript)
|
|
442
|
-
.join('\n');
|
|
443
|
-
audio.set('meta.transcript.text', transcription);
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
audio.set('meta.transcript.error', 'Found no text');
|
|
447
|
-
log.error("createTranscriptForAudio", { error: 'Found no text' });
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
audio.save().then(() => {
|
|
451
|
-
log.info("createTranscriptForAudio: Audio with transcript saved", { audioId: workPackage.audioId, error });
|
|
452
|
-
callback();
|
|
453
|
-
}).catch((error) => {
|
|
454
|
-
callback(error);
|
|
455
|
-
});
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
}).catch(error => {
|
|
460
|
-
callback(error);
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
else {
|
|
464
|
-
callback("Couldn't find audio for createTranscriptForAudio", { workPackage });
|
|
465
|
-
}
|
|
466
|
-
}).catch((error) => {
|
|
467
|
-
callback(error);
|
|
468
|
-
});
|
|
469
|
-
};
|
|
470
|
-
VoiceToTextWorker.prototype.process = (workPackage, callback) => {
|
|
471
|
-
switch (workPackage.type) {
|
|
472
|
-
case 'create-video-transcript':
|
|
473
|
-
createTranscriptForVideo(workPackage, callback);
|
|
474
|
-
break;
|
|
475
|
-
case 'create-audio-transcript':
|
|
476
|
-
createTranscriptForAudio(workPackage, callback);
|
|
477
|
-
break;
|
|
478
|
-
default:
|
|
479
|
-
callback("Unknown type for workPackage: " + workPackage.type);
|
|
480
|
-
}
|
|
481
|
-
};
|
|
482
|
-
module.exports = new VoiceToTextWorker();
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// YpAgentAssistant.ts
|
|
2
|
-
import { YpBaseAssistantWithVoice } from "./baseAssistantWithVoice.js";
|
|
3
|
-
import { AgentSelectionMode } from "./modes/agentSelectionMode.js";
|
|
4
|
-
import { DirectConversationMode } from "./modes/agentDirectConnection.js";
|
|
5
|
-
import { SubscriptionManager } from "../managers/subscriptionManager.js";
|
|
6
|
-
export class YpAgentAssistant extends YpBaseAssistantWithVoice {
|
|
7
|
-
constructor(wsClientId, wsClients, redis, voiceEnabled, redisKey, domainId) {
|
|
8
|
-
super(wsClientId, wsClients, redis, voiceEnabled, redisKey, domainId);
|
|
9
|
-
this.availableAgents = [];
|
|
10
|
-
this.runningAgents = [];
|
|
11
|
-
this.agentSelectionMode = new AgentSelectionMode(this);
|
|
12
|
-
this.directConversationMode = new DirectConversationMode(this);
|
|
13
|
-
this.subscriptionManager = new SubscriptionManager();
|
|
14
|
-
this.on("memory-changed", this.handleMemoryChanged.bind(this));
|
|
15
|
-
}
|
|
16
|
-
async defineAvailableModes() {
|
|
17
|
-
return [
|
|
18
|
-
await this.agentSelectionMode.getMode(),
|
|
19
|
-
await this.directConversationMode.getMode(),
|
|
20
|
-
];
|
|
21
|
-
}
|
|
22
|
-
get simplifiedMemory() {
|
|
23
|
-
return {
|
|
24
|
-
currentMode: this.memory.currentMode,
|
|
25
|
-
currentUser: this.memory.currentUser,
|
|
26
|
-
haveShownConfigurationWidget: this.memory.haveShownConfigurationWidget,
|
|
27
|
-
haveShownLoginWidget: this.memory.haveShownLoginWidget,
|
|
28
|
-
currentAgentStatus: this.memory.currentAgentStatus,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
handleMemoryChanged(memory) {
|
|
32
|
-
if (this.DEBUG) {
|
|
33
|
-
console.log(`Sending memory changed to client: ${JSON.stringify(this.simplifiedMemory, null, 2)}`);
|
|
34
|
-
}
|
|
35
|
-
this.sendToClient("system", JSON.stringify(this.simplifiedMemory), "memory-changed");
|
|
36
|
-
}
|
|
37
|
-
get isLoggedIn() {
|
|
38
|
-
return this.memory.currentUser !== undefined;
|
|
39
|
-
}
|
|
40
|
-
get isSubscribedToCurrentAgentProduct() {
|
|
41
|
-
if (this.DEBUG) {
|
|
42
|
-
console.log(`-------------------------------------------> isSubscribedToCurrentAgent: ${JSON.stringify(this.memory.currentAgentStatus, null, 2)}`);
|
|
43
|
-
}
|
|
44
|
-
return this.memory.currentAgentStatus?.subscriptionId != undefined;
|
|
45
|
-
}
|
|
46
|
-
get hasConfiguredcurrentAgentProduct() {
|
|
47
|
-
console.log(`configuration: ${this.redisKey}: ${JSON.stringify(this.memory.currentAgentStatus, null, 2)}`);
|
|
48
|
-
return this.memory.currentAgentStatus?.configurationState === "configured";
|
|
49
|
-
}
|
|
50
|
-
async isCurrentAgentRunning() {
|
|
51
|
-
const agentRun = await this.getCurrentAgentRun();
|
|
52
|
-
return agentRun?.status === "running";
|
|
53
|
-
}
|
|
54
|
-
async isCurrentAgentActive() {
|
|
55
|
-
const agentRun = await this.getCurrentAgentRun();
|
|
56
|
-
return (agentRun?.status === "running" ||
|
|
57
|
-
agentRun?.status === "ready" ||
|
|
58
|
-
agentRun?.status === "stopped" ||
|
|
59
|
-
agentRun?.status === "waiting_on_user");
|
|
60
|
-
}
|
|
61
|
-
get haveShownConfigurationWidget() {
|
|
62
|
-
return this.memory.haveShownConfigurationWidget ?? false;
|
|
63
|
-
}
|
|
64
|
-
get haveShownLoginWidget() {
|
|
65
|
-
return this.memory.haveShownLoginWidget ?? false;
|
|
66
|
-
}
|
|
67
|
-
async getCurrentAgentWorkflow() {
|
|
68
|
-
const agentRun = await this.getCurrentAgentRun();
|
|
69
|
-
return agentRun?.workflow;
|
|
70
|
-
}
|
|
71
|
-
async getCurrentAgentWorkflowCurrentStep() {
|
|
72
|
-
const agentRun = await this.getCurrentAgentRun();
|
|
73
|
-
return agentRun?.workflow?.steps[agentRun?.workflow?.currentStepIndex ?? 0];
|
|
74
|
-
}
|
|
75
|
-
async isCurrentAgentWaitingOnUserInput() {
|
|
76
|
-
const currentStep = await this.getCurrentAgentWorkflowCurrentStep();
|
|
77
|
-
if (!currentStep) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
return (currentStep.type === "engagmentFromInputConnector" ||
|
|
81
|
-
currentStep.type === "engagmentFromOutputConnector");
|
|
82
|
-
}
|
|
83
|
-
triggerResponseIfNeeded(message) {
|
|
84
|
-
if (this.voiceBot && this.voiceEnabled) {
|
|
85
|
-
this.voiceBot.triggerResponse(message);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|