@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,334 +0,0 @@
|
|
|
1
|
-
const models = require('../../../models/index.cjs');
|
|
2
|
-
const _ = require('lodash');
|
|
3
|
-
const async = require('async');
|
|
4
|
-
const log = require('../../../utils/logger.cjs');
|
|
5
|
-
const crypto = require('crypto');
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
//const request = require('request');
|
|
8
|
-
const request = {
|
|
9
|
-
post: (data, done) => {
|
|
10
|
-
console.log(JSON.stringify(data, null, 4));
|
|
11
|
-
done();
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const clean = (text) => {
|
|
15
|
-
//console.log("Before: "+ text);
|
|
16
|
-
var newText = text.replace('"', "'").replace('\n', '').replace('\r', '').replace(/(\r\n|\n|\r)/gm, "").replace(/"/gm, "'").replace(/,/, ';').trim();
|
|
17
|
-
//console.log("After:" + newText);
|
|
18
|
-
return newText.replace(/´/g, '');
|
|
19
|
-
};
|
|
20
|
-
const getEncryptedId = (id, key, iv) => {
|
|
21
|
-
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(key), iv);
|
|
22
|
-
let encrypted = cipher.update(id.toString());
|
|
23
|
-
encrypted = Buffer.concat([encrypted, cipher.final()]);
|
|
24
|
-
return encrypted.toString('hex');
|
|
25
|
-
};
|
|
26
|
-
let csvPostsTxt = "Id,Date,Name,NameEn,Description,DescriptionEn,ToxicityScore\n";
|
|
27
|
-
const saveAnonymousPost = (post, accessKey, done) => {
|
|
28
|
-
let expiryDate = new Date();
|
|
29
|
-
expiryDate.setDate(expiryDate.getDate() + 7);
|
|
30
|
-
const properties = {
|
|
31
|
-
id: post.id,
|
|
32
|
-
name: post.name,
|
|
33
|
-
name_en: post.name_en,
|
|
34
|
-
date: post.created_at.toISOString(),
|
|
35
|
-
description: post.description,
|
|
36
|
-
description_en: post.description_en,
|
|
37
|
-
toxicity_score: post.toxicity_score,
|
|
38
|
-
access_key: accessKey,
|
|
39
|
-
access_expires_at: expiryDate.toISOString()
|
|
40
|
-
};
|
|
41
|
-
csvPostsTxt += post.id + ',' + properties.date + ',"' + clean(post.name) + '","' + clean(post.name_en) + '",' + '"' + clean(post.description) + '",' + '"' + clean(post.description_en) + '",' + post.toxicity_score + '\n';
|
|
42
|
-
const options = {
|
|
43
|
-
url: process.env["AC_ANALYTICS_BASE_URL"] + "anonPosts/" + process.env.AC_ANALYTICS_CLUSTER_ID + "/" + `${accessKey}${post.id}`,
|
|
44
|
-
headers: {
|
|
45
|
-
'X-API-KEY': process.env["AC_ANALYTICS_KEY"]
|
|
46
|
-
},
|
|
47
|
-
json: properties
|
|
48
|
-
};
|
|
49
|
-
request.post(options, (error) => {
|
|
50
|
-
done(error);
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
let csvPointsTxt = "Id,Date,Content,ContentEn,Value,ToxicityScore\n";
|
|
54
|
-
const saveAnonymousPoint = (point, accessKey, done) => {
|
|
55
|
-
let expiryDate = new Date();
|
|
56
|
-
expiryDate.setDate(expiryDate.getDate() + 7);
|
|
57
|
-
const properties = {
|
|
58
|
-
id: point.id,
|
|
59
|
-
date: point.created_at.toISOString(),
|
|
60
|
-
content: point.content,
|
|
61
|
-
content_en: point.content_en,
|
|
62
|
-
value: point.value,
|
|
63
|
-
access_key: accessKey,
|
|
64
|
-
toxicity_score: point.toxicity_score,
|
|
65
|
-
access_expires_at: expiryDate.toISOString()
|
|
66
|
-
};
|
|
67
|
-
csvPointsTxt += point.id + ',' + properties.date + ',"' + clean(point.content) + '",' + '"' + clean(point.content_en) + '",' + point.value + ',' + point.toxicity_score + '\n';
|
|
68
|
-
const options = {
|
|
69
|
-
url: process.env["AC_ANALYTICS_BASE_URL"] + "anonPoints/" + process.env.AC_ANALYTICS_CLUSTER_ID + "/" + `${accessKey}${point.id}`,
|
|
70
|
-
headers: {
|
|
71
|
-
'X-API-KEY': process.env["AC_ANALYTICS_KEY"]
|
|
72
|
-
},
|
|
73
|
-
json: properties
|
|
74
|
-
};
|
|
75
|
-
request.post(options, (error) => {
|
|
76
|
-
done(error);
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
let csvActivitiesTxt = "Id,Date,Type,PointId,PostId,UserId\n";
|
|
80
|
-
const saveActivity = (activity, accessKey, done) => {
|
|
81
|
-
let expiryDate = new Date();
|
|
82
|
-
expiryDate.setDate(expiryDate.getDate() + 7);
|
|
83
|
-
const properties = {
|
|
84
|
-
id: activity.id,
|
|
85
|
-
date: activity.created_at.toISOString(),
|
|
86
|
-
type: activity.type,
|
|
87
|
-
point_id: activity.point_id,
|
|
88
|
-
post_id: activity.post_id,
|
|
89
|
-
user_id: activity.user_id,
|
|
90
|
-
access_key: accessKey,
|
|
91
|
-
access_expires_at: expiryDate.toISOString()
|
|
92
|
-
};
|
|
93
|
-
csvActivitiesTxt += activity.id + ',' + properties.date + ',"' + activity.type + '",' + '"' + activity.point_id + '",' + '"' + activity.post_id + '",' + '"' + activity.user_id + '"\n';
|
|
94
|
-
const options = {
|
|
95
|
-
url: process.env["AC_ANALYTICS_BASE_URL"] + "anonActivities/" + process.env.AC_ANALYTICS_CLUSTER_ID + "/" + `${accessKey}${activity.id}`,
|
|
96
|
-
headers: {
|
|
97
|
-
'X-API-KEY': process.env["AC_ANALYTICS_KEY"]
|
|
98
|
-
},
|
|
99
|
-
json: properties
|
|
100
|
-
};
|
|
101
|
-
request.post(options, (error) => {
|
|
102
|
-
done(error);
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
let csvUsersTxt = "Id\n";
|
|
106
|
-
const saveAnonymousUser = (user, accessKey, done) => {
|
|
107
|
-
let expiryDate = new Date();
|
|
108
|
-
expiryDate.setDate(expiryDate.getDate() + 7);
|
|
109
|
-
const properties = {
|
|
110
|
-
id: user.id,
|
|
111
|
-
access_key: accessKey,
|
|
112
|
-
access_expires_at: expiryDate.toISOString()
|
|
113
|
-
};
|
|
114
|
-
csvUsersTxt += user.id + '\n';
|
|
115
|
-
const options = {
|
|
116
|
-
url: process.env["AC_ANALYTICS_BASE_URL"] + "anonUsers/" + process.env.AC_ANALYTICS_CLUSTER_ID + "/" + `${accessKey}${user.id}`,
|
|
117
|
-
headers: {
|
|
118
|
-
'X-API-KEY': process.env["AC_ANALYTICS_KEY"]
|
|
119
|
-
},
|
|
120
|
-
json: properties
|
|
121
|
-
};
|
|
122
|
-
request.post(options, (error) => {
|
|
123
|
-
done(error);
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
const collectAllPostsAndPoints = (activities, collectedPostIds, collectedPointIds) => {
|
|
127
|
-
activities.forEach((item) => {
|
|
128
|
-
if (item.Post) {
|
|
129
|
-
collectedPostIds.push(item.Post.id);
|
|
130
|
-
}
|
|
131
|
-
if (item.Point) {
|
|
132
|
-
collectedPointIds.push(item.Point.id);
|
|
133
|
-
}
|
|
134
|
-
if (!item.Point && !item.Post) {
|
|
135
|
-
log.warn("Can't find post or point id for activity in anonymous export", { item });
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
const sendAllCollectedPostAndPoints = (accessKey, collectedPostIds, collectedPointIds, encryptionKey, encryptionIv, done) => {
|
|
140
|
-
collectedPostIds = _.uniq(collectedPostIds);
|
|
141
|
-
collectedPointIds = _.uniq(collectedPointIds);
|
|
142
|
-
async.series([
|
|
143
|
-
(seriesCallback) => {
|
|
144
|
-
async.forEachSeries(collectedPostIds, (postId, forEachSeriesCallback) => {
|
|
145
|
-
models.Post.findOne({
|
|
146
|
-
where: {
|
|
147
|
-
id: postId
|
|
148
|
-
},
|
|
149
|
-
attributes: ['id', 'name', 'description', 'public_data', 'created_at', 'data']
|
|
150
|
-
}).then((post) => {
|
|
151
|
-
let req = {
|
|
152
|
-
query: {
|
|
153
|
-
textType: 'postContent',
|
|
154
|
-
targetLanguage: 'en'
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
models.AcTranslationCache.getTranslation(req, post, function (error, descriptionEn) {
|
|
158
|
-
req = {
|
|
159
|
-
query: {
|
|
160
|
-
textType: 'postName',
|
|
161
|
-
targetLanguage: 'en'
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
models.AcTranslationCache.getTranslation(req, post, function (error, nameEn) {
|
|
165
|
-
saveAnonymousPost({
|
|
166
|
-
id: getEncryptedId((post.id), encryptionKey, encryptionIv),
|
|
167
|
-
name: post.name,
|
|
168
|
-
name_en: nameEn ? nameEn.content : 'no translation',
|
|
169
|
-
created_at: post.created_at,
|
|
170
|
-
toxicity_score: (post.data && post.data.moderation) ? post.data.moderation.toxicityScore : null,
|
|
171
|
-
description: post.description,
|
|
172
|
-
description_en: descriptionEn ? descriptionEn.content : 'no translation',
|
|
173
|
-
}, accessKey, forEachSeriesCallback);
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
}).catch((error) => {
|
|
177
|
-
forEachSeriesCallback(error);
|
|
178
|
-
});
|
|
179
|
-
}, (error) => {
|
|
180
|
-
seriesCallback(error);
|
|
181
|
-
});
|
|
182
|
-
},
|
|
183
|
-
(seriesCallback) => {
|
|
184
|
-
async.forEachSeries(collectedPointIds, (pointId, forEachSeriesCallback) => {
|
|
185
|
-
models.Point.findOne({
|
|
186
|
-
where: {
|
|
187
|
-
id: pointId
|
|
188
|
-
},
|
|
189
|
-
order: [
|
|
190
|
-
[models.PointRevision, 'created_at', 'asc'],
|
|
191
|
-
],
|
|
192
|
-
attributes: ['id', 'created_at', 'content', 'value', 'data'],
|
|
193
|
-
include: [
|
|
194
|
-
{
|
|
195
|
-
model: models.PointRevision,
|
|
196
|
-
attributes: ['id', 'content']
|
|
197
|
-
}
|
|
198
|
-
]
|
|
199
|
-
}).then((point) => {
|
|
200
|
-
let req = {
|
|
201
|
-
query: {
|
|
202
|
-
textType: 'pointContent',
|
|
203
|
-
targetLanguage: 'en'
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
models.AcTranslationCache.getTranslation(req, point, function (error, contentEn) {
|
|
207
|
-
saveAnonymousPoint({
|
|
208
|
-
id: getEncryptedId((point.id), encryptionKey, encryptionIv),
|
|
209
|
-
content: point.content,
|
|
210
|
-
value: point.value,
|
|
211
|
-
toxicity_score: (point.data && point.data.moderation) ? point.data.moderation.toxicityScore : null,
|
|
212
|
-
created_at: point.created_at,
|
|
213
|
-
content_en: contentEn ? contentEn.content : 'no translation'
|
|
214
|
-
}, accessKey, forEachSeriesCallback);
|
|
215
|
-
});
|
|
216
|
-
}).catch((error) => {
|
|
217
|
-
forEachSeriesCallback(error);
|
|
218
|
-
});
|
|
219
|
-
}, (error) => {
|
|
220
|
-
seriesCallback(error);
|
|
221
|
-
});
|
|
222
|
-
},
|
|
223
|
-
], (error) => {
|
|
224
|
-
done(error);
|
|
225
|
-
});
|
|
226
|
-
};
|
|
227
|
-
const sendAllUserActivitiesWithContent = (userId, communityId, collectedPostIds, collectedPointIds, encryptionKey, encryptionIv, accessKey, done) => {
|
|
228
|
-
models.AcActivity.findAll({
|
|
229
|
-
where: {
|
|
230
|
-
user_id: userId,
|
|
231
|
-
community_id: communityId,
|
|
232
|
-
type: {
|
|
233
|
-
$in: [
|
|
234
|
-
"activity.post.new", "activity.post.opposition.new", "activity.post.endorsement.new",
|
|
235
|
-
"activity.point.new", "activity.point.helpful.new", "activity.point.unhelpful.new"
|
|
236
|
-
]
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
attributes: ['id', 'type', 'created_at', 'user_id', 'post_id', 'point_id'],
|
|
240
|
-
include: [
|
|
241
|
-
{
|
|
242
|
-
model: models.Post,
|
|
243
|
-
required: false,
|
|
244
|
-
attributes: ['id']
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
model: models.Point,
|
|
248
|
-
required: false,
|
|
249
|
-
attributes: ['id']
|
|
250
|
-
}
|
|
251
|
-
]
|
|
252
|
-
}).then((activities) => {
|
|
253
|
-
collectAllPostsAndPoints(activities, collectedPostIds, collectedPointIds);
|
|
254
|
-
async.forEachSeries(activities, (activity, forEachSeriesCallback) => {
|
|
255
|
-
if (activity.Post || activity.Point) {
|
|
256
|
-
saveActivity({
|
|
257
|
-
id: getEncryptedId(activity.id, encryptionKey, encryptionIv),
|
|
258
|
-
type: activity.type,
|
|
259
|
-
created_at: activity.created_at,
|
|
260
|
-
post_id: activity.Post ? getEncryptedId(activity.Post.id, encryptionKey, encryptionIv) : null,
|
|
261
|
-
point_id: activity.Point ? getEncryptedId(activity.Point.id, encryptionKey, encryptionIv) : null,
|
|
262
|
-
user_id: getEncryptedId(activity.user_id, encryptionKey, encryptionIv)
|
|
263
|
-
}, accessKey, forEachSeriesCallback);
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
log.warn("Can't find post or point for activity");
|
|
267
|
-
forEachSeriesCallback();
|
|
268
|
-
}
|
|
269
|
-
}, (error) => {
|
|
270
|
-
done(error);
|
|
271
|
-
});
|
|
272
|
-
}).catch(function (error) {
|
|
273
|
-
done(error);
|
|
274
|
-
});
|
|
275
|
-
};
|
|
276
|
-
const importCommunityUsersAndActivities = (communityId, accessKey, done) => {
|
|
277
|
-
const encryptionKey = crypto.randomBytes(32);
|
|
278
|
-
const encryptionIv = crypto.randomBytes(16);
|
|
279
|
-
let collectedPostIds = [];
|
|
280
|
-
let collectedPointIds = [];
|
|
281
|
-
models.Community.findOne({
|
|
282
|
-
where: {
|
|
283
|
-
id: communityId
|
|
284
|
-
},
|
|
285
|
-
include: [
|
|
286
|
-
{
|
|
287
|
-
model: models.User,
|
|
288
|
-
attributes: ['id'],
|
|
289
|
-
as: 'CommunityUsers',
|
|
290
|
-
required: true,
|
|
291
|
-
}
|
|
292
|
-
]
|
|
293
|
-
}).then(function (community) {
|
|
294
|
-
if (community && community.CommunityUsers) {
|
|
295
|
-
async.forEachSeries(community.CommunityUsers, (user, eachSeriesCallback) => {
|
|
296
|
-
saveAnonymousUser({
|
|
297
|
-
id: getEncryptedId(user.id, encryptionKey, encryptionIv)
|
|
298
|
-
}, accessKey, (error) => {
|
|
299
|
-
if (error) {
|
|
300
|
-
eachSeriesCallback(error);
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
sendAllUserActivitiesWithContent(user.id, communityId, collectedPostIds, collectedPointIds, encryptionKey, encryptionIv, accessKey, eachSeriesCallback);
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
}, (error) => {
|
|
307
|
-
if (error) {
|
|
308
|
-
done(error);
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
sendAllCollectedPostAndPoints(accessKey, collectedPostIds, collectedPointIds, encryptionKey, encryptionIv, (error) => {
|
|
312
|
-
done(error);
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
done("Could not find community");
|
|
319
|
-
}
|
|
320
|
-
}).catch(function (error) {
|
|
321
|
-
done(error);
|
|
322
|
-
});
|
|
323
|
-
};
|
|
324
|
-
importCommunityUsersAndActivities(1017, "12345", () => {
|
|
325
|
-
fs.writeFileSync("/home/robert/Scratch/MMU/users.csv", csvUsersTxt);
|
|
326
|
-
fs.writeFileSync("/home/robert/Scratch/MMU/posts.csv", csvPostsTxt);
|
|
327
|
-
fs.writeFileSync("/home/robert/Scratch/MMU/points.csv", csvPointsTxt);
|
|
328
|
-
fs.writeFileSync("/home/robert/Scratch/MMU/activities.csv", csvActivitiesTxt);
|
|
329
|
-
process.exit();
|
|
330
|
-
});
|
|
331
|
-
module.exports = {
|
|
332
|
-
importCommunityUsersAndActivities
|
|
333
|
-
};
|
|
334
|
-
export {};
|
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
const models = require('../../../models/index.cjs');
|
|
2
|
-
const _ = require('lodash');
|
|
3
|
-
const async = require('async');
|
|
4
|
-
const log = require('../../../utils/logger.cjs');
|
|
5
|
-
const importDomain = require('./utils').importDomain;
|
|
6
|
-
const importCommunity = require('./utils').importCommunity;
|
|
7
|
-
const importGroup = require('./utils').importGroup;
|
|
8
|
-
const importPost = require('./utils').importPost;
|
|
9
|
-
const importPoint = require('./utils').importPoint;
|
|
10
|
-
let updateAsyncLimit = 5;
|
|
11
|
-
let lineCrCounter = 0;
|
|
12
|
-
const processDots = () => {
|
|
13
|
-
if (lineCrCounter > 250) {
|
|
14
|
-
process.stdout.write("\n");
|
|
15
|
-
lineCrCounter = 1;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
process.stdout.write(".");
|
|
19
|
-
lineCrCounter += 1;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const importAllDomains = (done) => {
|
|
23
|
-
log.info('AcSimilarityDomainImport', {});
|
|
24
|
-
models.Domain.unscoped().findAll({
|
|
25
|
-
attributes: ['id', 'name', 'description', 'default_locale', 'created_at', 'updated_at'],
|
|
26
|
-
order: [
|
|
27
|
-
['id', 'asc']
|
|
28
|
-
]
|
|
29
|
-
}).then((domains) => {
|
|
30
|
-
lineCrCounter = 0;
|
|
31
|
-
async.eachOfLimit(domains, updateAsyncLimit, (domain, index, callback) => {
|
|
32
|
-
importDomain(domain, callback);
|
|
33
|
-
}, () => {
|
|
34
|
-
console.log("Finished updating domains");
|
|
35
|
-
done();
|
|
36
|
-
});
|
|
37
|
-
}).catch(function (error) {
|
|
38
|
-
done(error);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
const importAllCommunities = (done) => {
|
|
42
|
-
log.info('AcSimilarityCommunityImport', {});
|
|
43
|
-
models.Community.unscoped().findAll({
|
|
44
|
-
include: [
|
|
45
|
-
{
|
|
46
|
-
model: models.Domain,
|
|
47
|
-
attributes: ['id', 'default_locale', 'created_at', 'updated_at'],
|
|
48
|
-
required: true
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
attributes: ['id', 'name', 'description', 'default_locale', 'created_at', 'updated_at'],
|
|
52
|
-
order: [
|
|
53
|
-
['id', 'asc']
|
|
54
|
-
]
|
|
55
|
-
}).then((communities) => {
|
|
56
|
-
lineCrCounter = 0;
|
|
57
|
-
async.eachOfLimit(communities, updateAsyncLimit, (community, index, callback) => {
|
|
58
|
-
importCommunity(community, callback);
|
|
59
|
-
}, () => {
|
|
60
|
-
console.log("Finished updating communities");
|
|
61
|
-
done();
|
|
62
|
-
});
|
|
63
|
-
}).catch(function (error) {
|
|
64
|
-
done(error);
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
const importAllGroups = (done) => {
|
|
68
|
-
log.info('AcSimilarityGroupImport', {});
|
|
69
|
-
models.Group.unscoped().findAll({
|
|
70
|
-
include: [
|
|
71
|
-
{
|
|
72
|
-
model: models.Community,
|
|
73
|
-
attributes: ['id', 'access', 'status', 'default_locale', 'created_at', 'updated_at'],
|
|
74
|
-
required: true,
|
|
75
|
-
include: [
|
|
76
|
-
{
|
|
77
|
-
model: models.Domain,
|
|
78
|
-
attributes: ['id', 'default_locale', 'created_at', 'updated_at'],
|
|
79
|
-
required: true
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
attributes: ['id', 'name', 'created_at', 'objectives', 'updated_at'],
|
|
85
|
-
order: [
|
|
86
|
-
['id', 'asc']
|
|
87
|
-
]
|
|
88
|
-
}).then((groups) => {
|
|
89
|
-
lineCrCounter = 0;
|
|
90
|
-
async.eachOfLimit(groups, updateAsyncLimit, (group, index, callback) => {
|
|
91
|
-
importGroup(group, callback);
|
|
92
|
-
}, () => {
|
|
93
|
-
console.log("Finished updating communities");
|
|
94
|
-
done();
|
|
95
|
-
});
|
|
96
|
-
}).catch(function (error) {
|
|
97
|
-
done(error);
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
const importAllPosts = (done) => {
|
|
101
|
-
log.info('AcSimilarityImport', {});
|
|
102
|
-
models.Post.unscoped().findAll({
|
|
103
|
-
include: [
|
|
104
|
-
{
|
|
105
|
-
model: models.Point,
|
|
106
|
-
required: false,
|
|
107
|
-
attributes: ['id', 'content'],
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
model: models.Group,
|
|
111
|
-
required: true,
|
|
112
|
-
attributes: ['id', 'access', 'status', 'configuration'],
|
|
113
|
-
include: [
|
|
114
|
-
{
|
|
115
|
-
attributes: ['id', 'formats'],
|
|
116
|
-
model: models.Image, as: 'GroupLogoImages',
|
|
117
|
-
required: false
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
model: models.Community,
|
|
121
|
-
attributes: ['id', 'access', 'status', 'default_locale'],
|
|
122
|
-
required: true,
|
|
123
|
-
include: [
|
|
124
|
-
{
|
|
125
|
-
attributes: ['id', 'formats'],
|
|
126
|
-
model: models.Image, as: 'CommunityLogoImages',
|
|
127
|
-
required: false
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
model: models.Domain,
|
|
131
|
-
attributes: ['id', 'default_locale'],
|
|
132
|
-
required: true
|
|
133
|
-
}
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
model: models.Image,
|
|
140
|
-
required: false,
|
|
141
|
-
as: 'PostHeaderImages',
|
|
142
|
-
attributes: ['id', 'formats']
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
model: models.Video,
|
|
146
|
-
required: false,
|
|
147
|
-
attributes: ['id', 'formats', 'updated_at', 'viewable', 'public_meta'],
|
|
148
|
-
as: 'PostVideos',
|
|
149
|
-
include: [
|
|
150
|
-
{
|
|
151
|
-
model: models.Image,
|
|
152
|
-
as: 'VideoImages',
|
|
153
|
-
attributes: ["formats", 'updated_at'],
|
|
154
|
-
required: false
|
|
155
|
-
},
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
model: models.Audio,
|
|
160
|
-
required: false,
|
|
161
|
-
attributes: ['id', 'formats', 'updated_at', 'listenable'],
|
|
162
|
-
as: 'PostAudios',
|
|
163
|
-
}
|
|
164
|
-
],
|
|
165
|
-
order: [
|
|
166
|
-
['id', 'desc'],
|
|
167
|
-
[{ model: models.Image, as: 'PostHeaderImages' }, 'updated_at', 'asc'],
|
|
168
|
-
[{ model: models.Group }, { model: models.Image, as: 'GroupLogoImages' }, 'created_at', 'desc'],
|
|
169
|
-
[{ model: models.Group }, { model: models.Community }, { model: models.Image, as: 'CommunityLogoImages' }, 'created_at', 'desc']
|
|
170
|
-
],
|
|
171
|
-
attributes: ['id', 'name', 'description', 'group_id', 'category_id', 'status', 'deleted', 'language', 'created_at', 'updated_at',
|
|
172
|
-
'user_id', 'official_status', 'public_data', 'cover_media_type',
|
|
173
|
-
'counter_endorsements_up', 'counter_endorsements_down', 'counter_points', 'counter_flags']
|
|
174
|
-
}).then((posts) => {
|
|
175
|
-
//posts = _.take(posts, 100);
|
|
176
|
-
lineCrCounter = 0;
|
|
177
|
-
async.eachOfLimit(posts, updateAsyncLimit, (post, index, callback) => {
|
|
178
|
-
importPost(post, callback);
|
|
179
|
-
}, () => {
|
|
180
|
-
console.log("Finished updating posts");
|
|
181
|
-
done();
|
|
182
|
-
});
|
|
183
|
-
}).catch(function (error) {
|
|
184
|
-
done(error);
|
|
185
|
-
});
|
|
186
|
-
};
|
|
187
|
-
const importAllPoints = (done) => {
|
|
188
|
-
models.Point.unscoped().findAll({
|
|
189
|
-
attributes: ['id', 'name', 'content', 'user_id', 'post_id', 'value', 'status', 'counter_quality_up', 'counter_quality_down', 'language', 'created_at', 'updated_at'],
|
|
190
|
-
order: [
|
|
191
|
-
['id', 'desc'],
|
|
192
|
-
[models.PointRevision, 'created_at', 'asc'],
|
|
193
|
-
[{ model: models.Video, as: "PointVideos" }, 'updated_at', 'desc'],
|
|
194
|
-
[{ model: models.Audio, as: "PointAudios" }, 'updated_at', 'desc'],
|
|
195
|
-
],
|
|
196
|
-
include: [
|
|
197
|
-
{
|
|
198
|
-
model: models.PointRevision,
|
|
199
|
-
attributes: ['content', 'value', 'created_at'],
|
|
200
|
-
required: false
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
model: models.Video,
|
|
204
|
-
required: false,
|
|
205
|
-
attributes: ['id', 'formats'],
|
|
206
|
-
as: 'PointVideos'
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
model: models.Audio,
|
|
210
|
-
required: false,
|
|
211
|
-
attributes: ['id', 'formats'],
|
|
212
|
-
as: 'PointAudios'
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
model: models.Post,
|
|
216
|
-
attributes: ['id', 'group_id', 'created_at', 'category_id', 'official_status', 'status', 'language'],
|
|
217
|
-
required: true,
|
|
218
|
-
include: [
|
|
219
|
-
{
|
|
220
|
-
model: models.Group,
|
|
221
|
-
attributes: ['id', 'access', 'status', 'configuration'],
|
|
222
|
-
required: true,
|
|
223
|
-
include: [
|
|
224
|
-
{
|
|
225
|
-
model: models.Community,
|
|
226
|
-
attributes: ['id', 'access', 'status', 'default_locale'],
|
|
227
|
-
required: true,
|
|
228
|
-
include: [
|
|
229
|
-
{
|
|
230
|
-
model: models.Domain,
|
|
231
|
-
attributes: ['id', 'default_locale'],
|
|
232
|
-
required: true
|
|
233
|
-
}
|
|
234
|
-
]
|
|
235
|
-
}
|
|
236
|
-
]
|
|
237
|
-
}
|
|
238
|
-
]
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
}).then(function (points) {
|
|
242
|
-
//points = _.take(points, 100);
|
|
243
|
-
lineCrCounter = 0;
|
|
244
|
-
async.eachOfLimit(points, updateAsyncLimit, (point, index, callback) => {
|
|
245
|
-
importPoint(point, callback);
|
|
246
|
-
}, () => {
|
|
247
|
-
console.log("Finished updating posts");
|
|
248
|
-
done();
|
|
249
|
-
});
|
|
250
|
-
}).catch(function (error) {
|
|
251
|
-
done(error);
|
|
252
|
-
});
|
|
253
|
-
};
|
|
254
|
-
const importAll = (done) => {
|
|
255
|
-
async.series([
|
|
256
|
-
(callback) => {
|
|
257
|
-
importAllDomains((error) => {
|
|
258
|
-
callback(error);
|
|
259
|
-
});
|
|
260
|
-
},
|
|
261
|
-
(callback) => {
|
|
262
|
-
importAllCommunities((error) => {
|
|
263
|
-
callback(error);
|
|
264
|
-
});
|
|
265
|
-
},
|
|
266
|
-
(callback) => {
|
|
267
|
-
importAllGroups((error) => {
|
|
268
|
-
callback(error);
|
|
269
|
-
});
|
|
270
|
-
},
|
|
271
|
-
(callback) => {
|
|
272
|
-
importAllPosts((error) => {
|
|
273
|
-
callback(error);
|
|
274
|
-
});
|
|
275
|
-
},
|
|
276
|
-
(callback) => {
|
|
277
|
-
importAllPoints((error) => {
|
|
278
|
-
callback(error);
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
], (error) => {
|
|
282
|
-
console.log("Finished importing all");
|
|
283
|
-
if (error)
|
|
284
|
-
console.error(error);
|
|
285
|
-
done();
|
|
286
|
-
});
|
|
287
|
-
};
|
|
288
|
-
if (process.env["AC_ANALYTICS_KEY"] && process.env["AC_ANALYTICS_BASE_URL"]) {
|
|
289
|
-
log.info('AcSimilarityImportStarting', {});
|
|
290
|
-
if (process.argv[2] && process.argv[2] === "onlyUpdatePosts") {
|
|
291
|
-
updateAsyncLimit = 5;
|
|
292
|
-
importAllPosts(() => {
|
|
293
|
-
console.log("Done updating posts");
|
|
294
|
-
process.exit();
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
importAll(() => {
|
|
299
|
-
console.log("Done importing all");
|
|
300
|
-
process.exit();
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
console.error("NO AC_ANALYTICS_KEY");
|
|
306
|
-
process.exit();
|
|
307
|
-
}
|
|
308
|
-
export {};
|