@yrpri/api 9.0.101 → 9.0.103
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/active-citizen/engine/allOurIdeas/explainAnswersAssistant.js +11 -1
- package/active-citizen/llms/baseChatBot.js +8 -75
- package/active-citizen/llms/imageGeneration/chatGptImageGenerator.js +56 -0
- package/active-citizen/llms/imageGeneration/collectionImageGenerator.js +6 -0
- package/agents/assistants/agentAssistant.js +3 -2
- package/agents/assistants/baseAssistant.js +7 -30
- package/agents/assistants/baseAssistantWithVoice.js +3 -3
- package/agents/assistants/voiceAssistant.js +2 -2
- package/agents/controllers/agentProductController.js +2 -1
- package/agents/controllers/agentSubscriptionController.js +20 -11
- package/agents/controllers/assistantsController.js +171 -127
- package/agents/controllers/policySynthAgents.js +33 -12
- package/agents/managers/newAiModelSetup.js +96 -0
- package/agents/managers/subscriptionManager.js +2 -2
- package/app.js +12 -12
- package/authorization.cjs +4 -0
- package/controllers/allOurIdeas.js +2 -1
- package/controllers/communities.cjs +47 -1
- package/controllers/groups.cjs +67 -4
- package/controllers/index.cjs +7 -7
- package/controllers/nonSpa.cjs +1 -1
- package/dist/active-citizen/controllers/activities.cjs +174 -0
- package/dist/active-citizen/controllers/news_feeds.cjs +96 -0
- package/dist/active-citizen/controllers/notifications.cjs +243 -0
- package/dist/active-citizen/controllers/recommendations.cjs +280 -0
- package/dist/active-citizen/engine/allOurIdeas/aiHelper.js +204 -0
- package/dist/active-citizen/engine/allOurIdeas/explainAnswersAssistant.js +66 -0
- package/dist/active-citizen/engine/allOurIdeas/iconGenerator.js +38 -0
- package/dist/active-citizen/engine/analytics/export_anon_community_activities.js +334 -0
- package/dist/active-citizen/engine/analytics/importer.js +308 -0
- package/dist/active-citizen/engine/analytics/manager.cjs +377 -0
- package/dist/active-citizen/engine/analytics/plausible/manager.cjs +500 -0
- package/dist/active-citizen/engine/analytics/statsCalc.cjs +194 -0
- package/dist/active-citizen/engine/analytics/utils.cjs +369 -0
- package/dist/active-citizen/engine/marketing/campaign.cjs +90 -0
- package/dist/active-citizen/engine/moderation/fraud/CreateFraudAuditReport.cjs +313 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudBase.cjs +239 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudDeleteBase.cjs +211 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudDeleteEndorsements.cjs +120 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudDeletePointQualities.cjs +114 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudDeletePoints.cjs +101 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudDeletePosts.cjs +84 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudDeleteRatings.cjs +15 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudGetBase.cjs +133 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudGetEndorsements.cjs +185 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudGetPointQualities.cjs +184 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudGetPoints.cjs +170 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudGetPosts.cjs +109 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudGetRatings.cjs +140 -0
- package/dist/active-citizen/engine/moderation/fraud/FraudScannerNotifier.cjs +279 -0
- package/dist/active-citizen/engine/moderation/get_moderation_items.cjs +386 -0
- package/dist/active-citizen/engine/moderation/image_labeling/CommunityLabeling.cjs +49 -0
- package/dist/active-citizen/engine/moderation/image_labeling/GroupLabeling.cjs +68 -0
- package/dist/active-citizen/engine/moderation/image_labeling/ImageLabelingBase.cjs +288 -0
- package/dist/active-citizen/engine/moderation/image_labeling/PointLabeling.cjs +33 -0
- package/dist/active-citizen/engine/moderation/image_labeling/PostLabeling.cjs +56 -0
- package/dist/active-citizen/engine/moderation/perspective_api_client.cjs +106 -0
- package/dist/active-citizen/engine/moderation/process_moderation_items.cjs +344 -0
- package/dist/active-citizen/engine/moderation/toxicity_analysis.cjs +810 -0
- package/dist/active-citizen/engine/news_feeds/activity_and_item_index_definitions.cjs +15 -0
- package/dist/active-citizen/engine/news_feeds/generate_dynamically.cjs +362 -0
- package/dist/active-citizen/engine/news_feeds/generate_from_notifications.cjs +268 -0
- package/dist/active-citizen/engine/news_feeds/news_feeds_utils.cjs +439 -0
- package/dist/active-citizen/engine/notifications/emails_utils.cjs +569 -0
- package/dist/active-citizen/engine/notifications/generate_point_notifications.cjs +233 -0
- package/dist/active-citizen/engine/notifications/generate_post_notifications.cjs +118 -0
- package/dist/active-citizen/engine/notifications/generate_post_status_change_notifications.cjs +41 -0
- package/dist/active-citizen/engine/notifications/notifications_utils.cjs +148 -0
- package/dist/active-citizen/engine/notifications/point_delivery.cjs +54 -0
- package/dist/active-citizen/engine/notifications/post_delivery.cjs +31 -0
- package/dist/active-citizen/engine/notifications/process_delayed_notifications.cjs +471 -0
- package/dist/active-citizen/engine/notifications/process_general_notifications.cjs +212 -0
- package/dist/active-citizen/engine/old/exporters/categories_dataset.js +153 -0
- package/dist/active-citizen/engine/old/exporters/dataset_tools.js +80 -0
- package/dist/active-citizen/engine/old/exporters/sentiment_dataset.js +157 -0
- package/dist/active-citizen/engine/recommendations/events_importer.cjs +139 -0
- package/dist/active-citizen/engine/recommendations/events_manager.cjs +212 -0
- package/dist/active-citizen/engine/reports/add_points_to_sheet.cjs +83 -0
- package/dist/active-citizen/engine/reports/commonUtils.js +75 -0
- package/dist/active-citizen/engine/reports/common_utils.cjs +740 -0
- package/dist/active-citizen/engine/reports/docx_group_report.cjs +596 -0
- package/dist/active-citizen/engine/reports/xlsAllOurIdeasExport.js +232 -0
- package/dist/active-citizen/engine/reports/xls_community_users_report.cjs +277 -0
- package/dist/active-citizen/engine/reports/xls_group_report.cjs +718 -0
- package/dist/active-citizen/llms/baseChatBot.js +183 -0
- package/dist/active-citizen/llms/imageGeneration/chatGptImageGenerator.js +56 -0
- package/dist/active-citizen/llms/imageGeneration/collectionImageGenerator.js +109 -0
- package/dist/active-citizen/llms/imageGeneration/dalleImageGenerator.js +84 -0
- package/dist/active-citizen/llms/imageGeneration/fluxImageGenerator.js +49 -0
- package/dist/active-citizen/llms/imageGeneration/imageProcessorService.js +64 -0
- package/dist/active-citizen/llms/imageGeneration/imagenImageGenerator.js +107 -0
- package/dist/active-citizen/llms/imageGeneration/s3Service.js +110 -0
- package/dist/active-citizen/llms/llmTranslation.js +472 -0
- package/dist/active-citizen/models/ac_activity.cjs +216 -0
- package/dist/active-citizen/models/ac_background_job.cjs +109 -0
- package/dist/active-citizen/models/ac_campaign.cjs +97 -0
- package/dist/active-citizen/models/ac_client_activity.cjs +23 -0
- package/dist/active-citizen/models/ac_delayed_notification.cjs +43 -0
- package/dist/active-citizen/models/ac_following.cjs +43 -0
- package/dist/active-citizen/models/ac_list.cjs +68 -0
- package/dist/active-citizen/models/ac_list_users.cjs +19 -0
- package/dist/active-citizen/models/ac_mute.cjs +27 -0
- package/dist/active-citizen/models/ac_news_feed_item.cjs +57 -0
- package/dist/active-citizen/models/ac_news_feed_processed_range.cjs +59 -0
- package/dist/active-citizen/models/ac_notification.cjs +292 -0
- package/dist/active-citizen/models/ac_translation_cache.cjs +750 -0
- package/dist/active-citizen/models/ac_watching.cjs +31 -0
- package/dist/active-citizen/scripts/analytics/setup_all_plausible_goals.cjs +13 -0
- package/dist/active-citizen/scripts/fix_old_delayed_notifications.js +63 -0
- package/dist/active-citizen/scripts/kue_status.js +31 -0
- package/dist/active-citizen/scripts/kue_watch_stuck_jobs.js +24 -0
- package/dist/active-citizen/scripts/translation_clear_language.js +117 -0
- package/dist/active-citizen/scripts/translation_delete.js +27 -0
- package/dist/active-citizen/scripts/translation_replace_text_from_url.js +180 -0
- package/dist/active-citizen/scripts/translation_update.js +28 -0
- package/dist/active-citizen/scripts/translations_list.js +27 -0
- package/{active-citizen/utils/airbrake.js → dist/active-citizen/utils/airbrake.cjs} +1 -1
- package/dist/active-citizen/utils/get_anonymous_system_user.cjs +21 -0
- package/dist/active-citizen/utils/i18n.cjs +3 -0
- package/dist/active-citizen/utils/logger.cjs +25 -0
- package/dist/active-citizen/utils/redisConnection.cjs +29 -0
- package/dist/active-citizen/utils/to_json.cjs +9 -0
- package/dist/active-citizen/utils/translation_cloning.cjs +171 -0
- package/dist/active-citizen/utils/translation_helpers.cjs +534 -0
- package/dist/active-citizen/utils/truncate_text.cjs +21 -0
- package/dist/active-citizen/utils/updateAllLocalesFromEn.js +253 -0
- package/dist/active-citizen/utils/updateLocaleFolders.js +34 -0
- package/dist/active-citizen/workers/activity.cjs +189 -0
- package/dist/active-citizen/workers/anonymizations.cjs +734 -0
- package/dist/active-citizen/workers/bulk_status_update.cjs +458 -0
- package/dist/active-citizen/workers/delayed_jobs.cjs +244 -0
- package/dist/active-citizen/workers/deletions.cjs +1911 -0
- package/dist/active-citizen/workers/email.cjs +9 -0
- package/dist/active-citizen/workers/fraud_management.cjs +109 -0
- package/dist/active-citizen/workers/generativeAi.js +56 -0
- package/dist/active-citizen/workers/main.cjs +89 -0
- package/dist/active-citizen/workers/marketing.cjs +25 -0
- package/dist/active-citizen/workers/moderation.cjs +73 -0
- package/dist/active-citizen/workers/notification_delivery.cjs +368 -0
- package/dist/active-citizen/workers/notification_news_feed.cjs +142 -0
- package/dist/active-citizen/workers/queue.cjs +99 -0
- package/dist/active-citizen/workers/recount.cjs +74 -0
- package/dist/active-citizen/workers/reports.cjs +42 -0
- package/dist/active-citizen/workers/similarities.cjs +21 -0
- package/dist/active-citizen/workers/speech_to_text.cjs +482 -0
- package/dist/agents/assistants/agentAssistant.js +88 -0
- package/dist/agents/assistants/baseAssistant.js +888 -0
- package/dist/agents/assistants/baseAssistantWithVoice.js +150 -0
- package/dist/agents/assistants/modes/agentDirectConnection.js +84 -0
- package/dist/agents/assistants/modes/agentSelectionMode.js +44 -0
- package/dist/agents/assistants/modes/baseAssistantMode.js +54 -0
- package/dist/agents/assistants/modes/tools/agentTools.js +447 -0
- package/dist/agents/assistants/modes/tools/baseTools.js +58 -0
- package/dist/agents/assistants/modes/tools/loginTools.js +156 -0
- package/dist/agents/assistants/modes/tools/models/agents.js +146 -0
- package/dist/agents/assistants/modes/tools/models/subscriptions.js +332 -0
- package/dist/agents/assistants/modes/tools/models/users.js +11 -0
- package/dist/agents/assistants/modes/tools/navigationTools.js +166 -0
- package/{agents/assistants/modes/tools/workflowConversationTools.js → dist/agents/assistants/modes/tools/subscriptionTools.js} +1 -4
- package/{agents/assistants/modes/tools/workflowTools.js → dist/agents/assistants/modes/tools/workflowConverstationTools.js} +1 -1
- package/dist/agents/assistants/voiceAssistant.js +619 -0
- package/dist/agents/controllers/agentProductController.js +103 -0
- package/dist/agents/controllers/agentSubscriptionController.js +261 -0
- package/dist/agents/controllers/assistantsController.js +511 -0
- package/dist/agents/controllers/policySynthAgents.js +395 -0
- package/{agents → dist/agents/managers}/agentProductManager.js +2 -2
- package/dist/agents/managers/emailInvitesManager.js +55 -0
- package/dist/agents/managers/emailTemplateRenderer.js +362 -0
- package/dist/agents/managers/newAiModelSetup.js +650 -0
- package/dist/agents/managers/notificationAgentQueueManager.js +510 -0
- package/dist/agents/managers/subscriptionManager.js +535 -0
- package/dist/agents/managers/workflowConversationManager.js +79 -0
- package/dist/agents/models/agentProduct.js +116 -0
- package/dist/agents/models/agentProductBoosterPurchase.js +58 -0
- package/dist/agents/models/agentProductBundle.js +68 -0
- package/dist/agents/models/agentProductRun.js +52 -0
- package/dist/agents/models/discount.js +88 -0
- package/dist/agents/models/subscription.js +79 -0
- package/dist/agents/models/subscriptionPlan.js +46 -0
- package/dist/agents/models/subscriptionUser.js +27 -0
- package/dist/agents/models/testData/createEvolyAgentProduct.js +477 -0
- package/dist/agents/models/testData/old/updateAgentWorkflowConfiguration.js +230 -0
- package/dist/agents/models/testData/setupEvolyAgentProductConfig.js +233 -0
- package/dist/agents/models/testData/updateAgentWorkflowConfiguration.js +230 -0
- package/{agents/models/workflowConverstation.js → dist/agents/models/workflowConversation.js} +1 -1
- package/{agents/tools/updateTemplateWorkflow.js → dist/agents/tools/setTemplateWorkflowCommunityId.js} +1 -0
- package/dist/app.js +943 -0
- package/dist/authorization.cjs +1860 -0
- package/dist/bot_control.js +1930 -0
- package/dist/config/config.cjs +14 -0
- package/dist/config/config.js +14 -0
- package/dist/controllers/allOurIdeas.js +696 -0
- package/dist/controllers/audios.cjs +100 -0
- package/dist/controllers/bulkStatusUpdates.cjs +202 -0
- package/dist/controllers/categories.cjs +199 -0
- package/dist/controllers/communities.cjs +2996 -0
- package/dist/controllers/domains.cjs +1341 -0
- package/dist/controllers/externalIds.cjs +223 -0
- package/dist/controllers/groups.cjs +4309 -0
- package/dist/controllers/images.cjs +499 -0
- package/dist/controllers/index.cjs +449 -0
- package/dist/controllers/legacyPages.cjs +35 -0
- package/dist/controllers/legacyPosts.cjs +56 -0
- package/dist/controllers/legacyUsers.cjs +36 -0
- package/dist/controllers/nonSpa.cjs +574 -0
- package/dist/controllers/organizations.cjs +250 -0
- package/dist/controllers/points.cjs +1137 -0
- package/dist/controllers/posts.cjs +2036 -0
- package/dist/controllers/ratings.cjs +234 -0
- package/dist/controllers/users.cjs +2255 -0
- package/dist/controllers/videos.cjs +226 -0
- package/dist/deleteUnwantedDeclerations.cjs +55 -0
- package/dist/migrations/agentAuditLogs.cjs +46 -0
- package/dist/migrations/agentClasses.cjs +60 -0
- package/dist/migrations/agentConnectorClasses.cjs +61 -0
- package/dist/migrations/agentConnectors.cjs +50 -0
- package/dist/migrations/agentEvals.cjs +45 -0
- package/dist/migrations/agentRegistries.cjs +40 -0
- package/dist/migrations/agents.cjs +54 -0
- package/dist/migrations/aiModels.cjs +49 -0
- package/dist/migrations/apiUsage.cjs +47 -0
- package/dist/migrations/apis.cjs +49 -0
- package/dist/migrations/groupPrivateData.cjs +30 -0
- package/dist/migrations/modelUsage.cjs +60 -0
- package/dist/migrations/oldMigrations/2019/20181030020612-AddActivitiesIndex.js +23 -0
- package/dist/migrations/oldMigrations/2019/20181102210612-AddFirstVideoFeatures.js +360 -0
- package/dist/migrations/oldMigrations/2019/20181212210612-ModerationFeatures.js +29 -0
- package/dist/migrations/oldMigrations/2019/2019010610612-CommunityFolders.js +43 -0
- package/dist/migrations/oldMigrations/2019/20190117020612-AddMissingIndexes.js +24 -0
- package/dist/migrations/oldMigrations/2019/20190117020612-RemoveUnusedIndexes.js +29 -0
- package/dist/migrations/oldMigrations/2019/20190127020612-RemoveUnusedIndexesPartThree.js +22 -0
- package/dist/migrations/oldMigrations/2019/20190127020612-RemoveUnusedIndexesPartTwo.js +23 -0
- package/{migrations/200824_create_embeddings_and_org_update.cjs → dist/migrations/oldMigrations/2019/20190223020612-AddPrivateProfileDataToUsers.js} +6 -3
- package/dist/migrations/oldMigrations/2019/20190706210612-AddCustomRatings.js +43 -0
- package/dist/migrations/oldMigrations/2019/20190829210612-AddGeneralStore.js +36 -0
- package/dist/migrations/oldMigrations/2019/20192811210612-AddAcClientActivities.js +41 -0
- package/dist/migrations/oldMigrations/2020/20190527020612-WorkOnIndexes.js +88 -0
- package/dist/migrations/oldMigrations/2020/20200409020612-AddBackgroundJob.js +33 -0
- package/dist/migrations/oldMigrations/2020/20200716210612-AddDataToCollections.js +38 -0
- package/dist/migrations/oldMigrations/2022/20220215100612-AddDataToEndorsements.js +19 -0
- package/dist/migrations/oldMigrations/2022/20220220100612-AddDataForFraudDetection.js +19 -0
- package/dist/migrations/oldMigrations/2022/20220903100612-AddPromotionFeatures.js +127 -0
- package/dist/migrations/oldMigrations/2022/onHold/20200527020612-AddCampaigns.js +68 -0
- package/dist/migrations/oldMigrations/2024/20241304175112-AddMediaSupportForHtmlGroups.cjs +63 -0
- package/dist/migrations/oldMigrations/older/20160511172514-AddNotificationFeatures.js +14 -0
- package/dist/migrations/oldMigrations/older/20161030020612-AddBulkStatusUpdate.js +71 -0
- package/dist/migrations/oldMigrations/older/20170514035258-add-metadata-to-invites.js +12 -0
- package/dist/migrations/oldMigrations/older/20180216020612-AddTranslationCaches.js +46 -0
- package/dist/migrations/oldMigrations/older/20180218210612-AddTranslationAndLanguages.js +46 -0
- package/dist/migrations/privateAccessStore.cjs +55 -0
- package/dist/migrations/zzz_associations.cjs +154 -0
- package/dist/migrations/zzzzz_create_agent_runs.cjs +606 -0
- package/dist/migrations/zzzzzz_create_agent_runs_fix.cjs +11 -0
- package/dist/migrations/zzzzzzz_create_trees.cjs +81 -0
- package/dist/models/audio.cjs +430 -0
- package/dist/models/bulk_status_update.cjs +58 -0
- package/dist/models/campaign.cjs +78 -0
- package/dist/models/category.cjs +94 -0
- package/dist/models/community.cjs +337 -0
- package/dist/models/domain.cjs +486 -0
- package/dist/models/endorsement.cjs +39 -0
- package/dist/models/general_data_store.cjs +20 -0
- package/dist/models/group.cjs +728 -0
- package/dist/models/image.cjs +579 -0
- package/dist/models/index.cjs +186 -0
- package/dist/models/invite.cjs +48 -0
- package/dist/models/iso_country.cjs +16 -0
- package/dist/models/organization.cjs +122 -0
- package/dist/models/page.cjs +273 -0
- package/dist/models/point.cjs +622 -0
- package/dist/models/point_quality.cjs +39 -0
- package/dist/models/point_revision.cjs +47 -0
- package/dist/models/post.cjs +680 -0
- package/dist/models/post_revision.cjs +38 -0
- package/dist/models/post_status_change.cjs +35 -0
- package/dist/models/promotion.cjs +34 -0
- package/dist/models/rating.cjs +51 -0
- package/dist/models/relationship.cjs +19 -0
- package/dist/models/request_to_join.cjs +20 -0
- package/dist/models/user.cjs +604 -0
- package/dist/models/user_legacy_password.cjs +13 -0
- package/dist/models/video.cjs +1137 -0
- package/dist/publish.js +40 -0
- package/dist/repack.js +53 -0
- package/dist/scripts/addRatingUsersToGroup.js +51 -0
- package/dist/scripts/addUserToOrganization.js +71 -0
- package/dist/scripts/analyseRatingsForCommunity.js +150 -0
- package/dist/scripts/analyzeAndFixBrokenPointUsers.js +28 -0
- package/dist/scripts/analyzeEndorsementsByCountry.js +70 -0
- package/dist/scripts/analyzePostsForCommunity.js +185 -0
- package/dist/scripts/bulkStatusUpdates/listUpdates.js +14 -0
- package/dist/scripts/bulkStatusUpdates/mergeLatestPostsToUpdate.js +110 -0
- package/dist/scripts/bulkStatusUpdates/performUpdate.js +116 -0
- package/{scripts/bulkStatusUpdates/performUpdateForGroup.js → dist/scripts/bulkStatusUpdates/performUpdateForGroup.cjs} +1 -2
- package/dist/scripts/bulkStatusUpdates/performUpdateForStatus.js +141 -0
- package/dist/scripts/change/changeVideoAspectTo.js +34 -0
- package/dist/scripts/change/setUseNewVersion.cjs +22 -0
- package/dist/scripts/changeCommunityGroupcount.js +30 -0
- package/dist/scripts/changeCommunityPostCount.js +30 -0
- package/dist/scripts/changeGroupPostCount.js +30 -0
- package/dist/scripts/changeLanguage.js +50 -0
- package/dist/scripts/changeOfficalStatus.js +30 -0
- package/{scripts/cleanups/deleteAnonNotifications.js → dist/scripts/cleanups/deleteAnonNotifications.cjs} +1 -1
- package/dist/scripts/cleanups/deleteLinkGroupsWithDeletedCommunities.js +62 -0
- package/dist/scripts/cleanups/deleteYearOldNotifications.cjs +72 -0
- package/dist/scripts/cleanups/removeAllUsersFromHiddenPublicGroup.js +43 -0
- package/dist/scripts/clearAllEndorsementInGroup.js +50 -0
- package/dist/scripts/cloning/clearUsersForCommunitiesFromUrl.js +129 -0
- package/dist/scripts/cloning/cloneFromUrlScript.js +65 -0
- package/dist/scripts/cloning/cloneWBFromUrlScriptAndCreateLinks.js +140 -0
- package/dist/scripts/cloning/cloneWBFromUrlScriptNoUsersOrPoints.js +140 -0
- package/dist/scripts/cloning/cloneWBSerbianFromUrlScriptAndCreateLinks.js +131 -0
- package/dist/scripts/cloning/copyCommunityConfigAndTranslationsFromURL.js +173 -0
- package/dist/scripts/cloning/copyCommunityOneGroupToDomainNoUsersNoEndorsements.js +18 -0
- package/dist/scripts/cloning/copyCommunityToDomainNoUsersNoEndorsements.js +17 -0
- package/dist/scripts/cloning/copyCommunityToDomainWithEverything.js +17 -0
- package/dist/scripts/cloning/copyCommunityToDomainWithOnlyGroups.js +26 -0
- package/dist/scripts/cloning/copyGroupConfigAndTranslationsFromURL.js +205 -0
- package/dist/scripts/cloning/copyPostToGroupOld.js +397 -0
- package/dist/scripts/cloning/copyPostVideosFromURL.js +236 -0
- package/dist/scripts/cloning/copyPostWithOutAnyVotingOrActivities.js +17 -0
- package/dist/scripts/cloning/deepCloneSerbianWBFromUrlScriptAndCreateLinks.js +131 -0
- package/dist/scripts/cloning/deepCloneWBFromUrlScriptAndCreateLinks.js +139 -0
- package/dist/scripts/cloning/setAdminsFromURL.js +161 -0
- package/dist/scripts/cloning/setExternalIdsFromURL.js +129 -0
- package/dist/scripts/countCommunity.js +291 -0
- package/dist/scripts/countCommunityUsers.js +152 -0
- package/dist/scripts/countDelayedNotifications.js +18 -0
- package/dist/scripts/countGroup.js +246 -0
- package/dist/scripts/countStuff.js +67 -0
- package/dist/scripts/countUniqueVotersInAGroup.js +48 -0
- package/dist/scripts/createInvitesAndShow.js +75 -0
- package/dist/scripts/database/sync_database.js +14 -0
- package/dist/scripts/database/sync_dev_database.js +17 -0
- package/dist/scripts/debugNotifications.js +58 -0
- package/dist/scripts/deleteAllNewsFeeds.js +10 -0
- package/dist/scripts/deleteCategory.js +13 -0
- package/dist/scripts/deleteOldAppActivities.js +40 -0
- package/dist/scripts/deletePostContactDataForCommunity.js +53 -0
- package/dist/scripts/destroy/destroy_all_but_one_domain.js +1026 -0
- package/dist/scripts/displayAuthorForPost.js +16 -0
- package/dist/scripts/endorsementFraudDetection/analyseEndorsementsForCommunity.js +183 -0
- package/dist/scripts/endorsementFraudDetection/bulkDeleteDuplicateEndorsmentsFromUrl.js +208 -0
- package/dist/scripts/exportAllStatusChanges.js +36 -0
- package/dist/scripts/exportClientAcitivity.js +36 -0
- package/dist/scripts/exportEndorsementsForCommunity.js +79 -0
- package/dist/scripts/exportPointQualitiesForCommunity.js +84 -0
- package/dist/scripts/exportPostsAndPointsForCommunity.js +147 -0
- package/dist/scripts/exportPostsDataSetForDomain.js +244 -0
- package/dist/scripts/exportPostsForGroup.js +173 -0
- package/dist/scripts/exportRatingsForPost.js +15 -0
- package/dist/scripts/exportUserEndorsementsWithUserAnalysis.js +123 -0
- package/dist/scripts/exportUsersForCommunity.js +24 -0
- package/dist/scripts/exportUsersForDomain.js +24 -0
- package/dist/scripts/exportUsersForGroup.js +24 -0
- package/dist/scripts/exports/ratingDistribution.js +71 -0
- package/dist/scripts/exports/whoEndorsedWhatByCommunity.js +56 -0
- package/dist/scripts/findUnusedClientImports.js +56 -0
- package/dist/scripts/fixAllPostPointCounts.js +22 -0
- package/dist/scripts/fixAnonNotificationsSettings.js +48 -0
- package/dist/scripts/fixCountKopavogur.js +9 -0
- package/dist/scripts/fixEndorsementsAfterCopyPostToGroup.js +190 -0
- package/dist/scripts/fixExternalUserId.js +24 -0
- package/dist/scripts/fixGroupAccess.js +16 -0
- package/dist/scripts/fixGroupIdeasAndPointsCount.js +49 -0
- package/dist/scripts/fixNotificationSettings.js +39 -0
- package/dist/scripts/fixSurveyRadioBakedInSubCodes.js +64 -0
- package/dist/scripts/fixWrongUserIdForStatusUpdates.js +49 -0
- package/dist/scripts/gallery/exportGalleryData.js +40 -0
- package/dist/scripts/gallery/importGalleryForCommunity.js +168 -0
- package/dist/scripts/gallery/readJsonAndDownloadImagesVersion2.js +55 -0
- package/dist/scripts/gallery/refreshAcApiPostIdsForCommunity.js +58 -0
- package/dist/scripts/genderAnalysis.js +63 -0
- package/dist/scripts/genderAnalysisByStatus.js +62 -0
- package/dist/scripts/importAllLocalesFromLocalFolders.js +55 -0
- package/dist/scripts/importDomain.js +1652 -0
- package/dist/scripts/keys/addOidcToDomain.cjs +61 -0
- package/dist/scripts/landUseGame/export3Ddata.js +162 -0
- package/dist/scripts/listLanguagesForGroup.js +54 -0
- package/dist/scripts/loadTestCreateDummyContentForGroup.js +27 -0
- package/dist/scripts/makeRecursiveMapData.js +103 -0
- package/dist/scripts/mapping/community_map_csv.js +145 -0
- package/dist/scripts/moveCommunityToDomain.js +22 -0
- package/dist/scripts/moveGroupToCommunity.js +23 -0
- package/dist/scripts/movePostToGroup.js +101 -0
- package/dist/scripts/movePostsToGroupsRecountGroupFromUrl.js +297 -0
- package/dist/scripts/oldMovePostToGroup.js +153 -0
- package/dist/scripts/processCsvForPdfUrls.js +37 -0
- package/dist/scripts/processCsvForTranslationAndToxicity.js +125 -0
- package/dist/scripts/recount/recount_recursive_communities.js +125 -0
- package/dist/scripts/recountALLCommunityGroupCounts.js +37 -0
- package/dist/scripts/recountAll.js +97 -0
- package/dist/scripts/recountCommunitesFromUrl.js +58 -0
- package/dist/scripts/recountCommunity.js +19 -0
- package/dist/scripts/recountGroup.js +218 -0
- package/dist/scripts/recountGroupNoUserChange.js +219 -0
- package/dist/scripts/resetAllEndorsementsForGroup.js +57 -0
- package/dist/scripts/resetEnTranslationForGroup.js +45 -0
- package/dist/scripts/setAdminOnAll.cjs +107 -0
- package/{scripts/change → dist/scripts}/setDomainAdmin.cjs +0 -2
- package/dist/scripts/setDomainLocales.js +33 -0
- package/dist/scripts/setEarlQuestionIdOnGroup.cjs +29 -0
- package/dist/scripts/setLanguageOnGroupCommunitesFromUrl.js +86 -0
- package/dist/scripts/setMemberOfAll.js +101 -0
- package/dist/scripts/setNewUserForContentOfCommunity.js +189 -0
- package/dist/scripts/setOfficialStatusOnAllPostsForCommunity.js +35 -0
- package/dist/scripts/setUserOnAll.js +101 -0
- package/dist/scripts/showCategoryForGroup.js +18 -0
- package/dist/scripts/showOldActivityTypes.js +14 -0
- package/dist/scripts/showPostsMissingCategoryForGroup.js +17 -0
- package/dist/scripts/showStatuses.js +17 -0
- package/dist/scripts/showUniqueVotersInCommunity.js +61 -0
- package/dist/scripts/showUserAgentsAndIpsForEmails.js +66 -0
- package/dist/scripts/simpleExportForGroupsForCommunity.js +46 -0
- package/dist/scripts/simpleExportForPointsForCommunity.js +82 -0
- package/dist/scripts/simpleExportForPostsForCommunity.js +61 -0
- package/dist/scripts/testForEndorsments.js +21 -0
- package/dist/scripts/undeleteGroupAndAllContent.js +151 -0
- package/dist/scripts/undeletePost.js +135 -0
- package/dist/scripts/unlinkSsn.js +23 -0
- package/dist/scripts/updateFromAlthingi.js +303 -0
- package/dist/server.js +3 -0
- package/dist/utils/airbrake.cjs +17 -0
- package/dist/utils/cjsCodeReview.js +99 -0
- package/dist/utils/community_mapping_tools.cjs +124 -0
- package/dist/utils/copy_utils.cjs +1399 -0
- package/dist/utils/docx_utils.cjs +464 -0
- package/dist/utils/export_utils.cjs +491 -0
- package/dist/utils/i18n.cjs +17 -0
- package/dist/utils/is_valid_db_id.cjs +28 -0
- package/dist/utils/logger.cjs +25 -0
- package/dist/utils/loggerTs.js +26 -0
- package/dist/utils/manifest_generator.cjs +104 -0
- package/dist/utils/parse_domain.cjs +16 -0
- package/dist/utils/recount_utils.cjs +415 -0
- package/dist/utils/sharing_parameters.cjs +111 -0
- package/dist/utils/sitemap_generator.cjs +286 -0
- package/dist/utils/to_json.cjs +14 -0
- package/dist/utils/ypLanguages.js +747 -0
- package/dist/webSockets.js +77 -0
- package/package.json +46 -44
- package/server.d.ts +104 -2
- package/utils/copy_utils.cjs +7 -1
- package/active-citizen/engine/allOurIdeas/aiHelper.d.ts +0 -21
- package/active-citizen/engine/allOurIdeas/aiHelper.d.ts.map +0 -1
- package/active-citizen/engine/allOurIdeas/explainAnswersAssistant.d.ts.map +0 -1
- package/active-citizen/engine/allOurIdeas/iconGenerator.d.ts +0 -12
- package/active-citizen/engine/allOurIdeas/iconGenerator.d.ts.map +0 -1
- package/active-citizen/engine/analytics/export_anon_community_activities.d.ts.map +0 -1
- package/active-citizen/engine/analytics/importer.d.ts.map +0 -1
- package/active-citizen/engine/old/exporters/categories_dataset.d.ts.map +0 -1
- package/active-citizen/engine/old/exporters/dataset_tools.d.ts.map +0 -1
- package/active-citizen/engine/old/exporters/sentiment_dataset.d.ts.map +0 -1
- package/active-citizen/engine/reports/xls_all_our_ideas_export.js +0 -141
- package/active-citizen/llms/baseChatBot.d.ts +0 -51
- package/active-citizen/llms/baseChatBot.d.ts.map +0 -1
- package/active-citizen/llms/collectionImageGenerator.js +0 -357
- package/active-citizen/llms/llmTranslation.d.ts +0 -24
- package/active-citizen/llms/llmTranslation.d.ts.map +0 -1
- package/active-citizen/scripts/fix_old_delayed_notifications.d.ts.map +0 -1
- package/active-citizen/scripts/kue_status.d.ts.map +0 -1
- package/active-citizen/scripts/kue_watch_stuck_jobs.d.ts.map +0 -1
- package/active-citizen/scripts/translation_clear_language.d.ts.map +0 -1
- package/active-citizen/scripts/translation_delete.d.ts.map +0 -1
- package/active-citizen/scripts/translation_replace_text_from_url.d.ts.map +0 -1
- package/active-citizen/scripts/translation_update.d.ts.map +0 -1
- package/active-citizen/scripts/translations_list.d.ts.map +0 -1
- package/active-citizen/utils/airbrake.d.ts.map +0 -1
- package/active-citizen/utils/updateAllLocalesFromEn.d.ts +0 -21
- package/active-citizen/utils/updateAllLocalesFromEn.d.ts.map +0 -1
- package/active-citizen/utils/updateLocaleFolders.d.ts +0 -2
- package/active-citizen/utils/updateLocaleFolders.d.ts.map +0 -1
- package/active-citizen/workers/cloudflare/voiceSession/worker.js +0 -213
- package/active-citizen/workers/generativeAi.d.ts.map +0 -1
- package/agents/assistants/agentAssistantOld.js +0 -863
- package/agents/assistants/modes/agentConfigurationMode.js +0 -63
- package/agents/assistants/modes/agentOperationsMode.js +0 -195
- package/agents/assistants/modes/commonTools.js +0 -58
- package/agents/assistants/modes/directConversationMode.js +0 -14
- package/agents/assistants/modes/toolHandlers/accountHandlers.js +0 -46
- package/agents/assistants/modes/toolHandlers/commonHandlers.js +0 -57
- package/agents/assistants/modes/toolHandlers/commonTools.js +0 -58
- package/agents/assistants/modes/toolHandlers/loginHandlers.js +0 -46
- package/agents/assistants/modes/toolHandlers/subscriptionHandlers.js +0 -469
- package/agents/assistants/modes/tools/agentConnectionTools.js +0 -326
- package/agents/assistants/modes/tools/commonHandlers.js +0 -57
- package/agents/assistants/modes/tools/loginHandlers.js +0 -46
- package/agents/assistants/modes/tools/subscriptionHandlers.js +0 -469
- package/agents/controllers/assistantController.js +0 -243
- package/agents/managers/workflowManager.js +0 -76
- package/agents/models/testData/setupConfig.js +0 -140
- package/agents/models/workflow.js +0 -53
- package/agents/subscriptionManager.js +0 -218
- package/app.d.ts +0 -40
- package/app.d.ts.map +0 -1
- package/bot_control.d.ts.map +0 -1
- package/publish.d.ts.map +0 -1
- package/repack.d.ts.map +0 -1
- package/scripts/addRatingUsersToGroup.d.ts.map +0 -1
- package/scripts/addUserToOrganization.d.ts.map +0 -1
- package/scripts/analyseRatingsForCommunity.d.ts.map +0 -1
- package/scripts/analyzeAndFixBrokenPointUsers.d.ts.map +0 -1
- package/scripts/analyzeEndorsementsByCountry.d.ts.map +0 -1
- package/scripts/analyzePostsForCommunity.d.ts.map +0 -1
- package/scripts/bulkStatusUpdates/listUpdates.d.ts.map +0 -1
- package/scripts/bulkStatusUpdates/mergeLatestPostsToUpdate.d.ts.map +0 -1
- package/scripts/bulkStatusUpdates/performUpdate.d.ts.map +0 -1
- package/scripts/bulkStatusUpdates/performUpdateForGroup.d.ts.map +0 -1
- package/scripts/bulkStatusUpdates/performUpdateForStatus.d.ts.map +0 -1
- package/scripts/change/changeVideoAspectTo.d.ts.map +0 -1
- package/scripts/changeCommunityGroupcount.d.ts.map +0 -1
- package/scripts/changeCommunityPostCount.d.ts.map +0 -1
- package/scripts/changeGroupPostCount.d.ts.map +0 -1
- package/scripts/changeLanguage.d.ts.map +0 -1
- package/scripts/changeOfficalStatus.d.ts.map +0 -1
- package/scripts/cleanups/deleteAnonNotifications.d.ts.map +0 -1
- package/scripts/cleanups/deleteLinkGroupsWithDeletedCommunities.d.ts.map +0 -1
- package/scripts/cleanups/removeAllUsersFromHiddenPublicGroup.d.ts.map +0 -1
- package/scripts/clearAllEndorsementInGroup.d.ts.map +0 -1
- package/scripts/cloning/clearUsersForCommunitiesFromUrl.d.ts.map +0 -1
- package/scripts/cloning/cloneFromUrlScript.d.ts.map +0 -1
- package/scripts/cloning/cloneWBFromUrlScriptAndCreateLinks.d.ts.map +0 -1
- package/scripts/cloning/cloneWBFromUrlScriptNoUsersOrPoints.d.ts.map +0 -1
- package/scripts/cloning/cloneWBSerbianFromUrlScriptAndCreateLinks.d.ts.map +0 -1
- package/scripts/cloning/copyCommunityConfigAndTranslationsFromURL.d.ts.map +0 -1
- package/scripts/cloning/copyCommunityOneGroupToDomainNoUsersNoEndorsements.d.ts.map +0 -1
- package/scripts/cloning/copyCommunityToDomainNoUsersNoEndorsements.d.ts.map +0 -1
- package/scripts/cloning/copyCommunityToDomainWithEverything.d.ts.map +0 -1
- package/scripts/cloning/copyCommunityToDomainWithOnlyGroups.d.ts.map +0 -1
- package/scripts/cloning/copyGroupConfigAndTranslationsFromURL.d.ts.map +0 -1
- package/scripts/cloning/copyPostToGroupOld.d.ts.map +0 -1
- package/scripts/cloning/copyPostVideosFromURL.d.ts.map +0 -1
- package/scripts/cloning/copyPostWithOutAnyVotingOrActivities.d.ts.map +0 -1
- package/scripts/cloning/deepCloneSerbianWBFromUrlScriptAndCreateLinks.d.ts.map +0 -1
- package/scripts/cloning/deepCloneWBFromUrlScriptAndCreateLinks.d.ts.map +0 -1
- package/scripts/cloning/setAdminsFromURL.d.ts.map +0 -1
- package/scripts/cloning/setExternalIdsFromURL.d.ts.map +0 -1
- package/scripts/countCommunity.d.ts.map +0 -1
- package/scripts/countCommunityUsers.d.ts.map +0 -1
- package/scripts/countDelayedNotifications.d.ts.map +0 -1
- package/scripts/countGroup.d.ts.map +0 -1
- package/scripts/countStuff.d.ts.map +0 -1
- package/scripts/countUniqueVotersInAGroup.d.ts.map +0 -1
- package/scripts/createInvitesAndShow.d.ts.map +0 -1
- package/scripts/database/seedTestAiModels.js +0 -64
- package/scripts/database/sync_database.d.ts.map +0 -1
- package/scripts/database/sync_dev_database.d.ts.map +0 -1
- package/scripts/debugNotifications.d.ts.map +0 -1
- package/scripts/deleteAllNewsFeeds.d.ts.map +0 -1
- package/scripts/deleteCategory.d.ts.map +0 -1
- package/scripts/deleteOldAppActivities.d.ts.map +0 -1
- package/scripts/deletePostContactDataForCommunity.d.ts.map +0 -1
- package/scripts/destroy/destroy_all_but_one_domain.d.ts.map +0 -1
- package/scripts/displayAuthorForPost.d.ts.map +0 -1
- package/scripts/endorsementFraudDetection/analyseEndorsementsForCommunity.d.ts.map +0 -1
- package/scripts/endorsementFraudDetection/bulkDeleteDuplicateEndorsmentsFromUrl.d.ts.map +0 -1
- package/scripts/exportAllStatusChanges.d.ts.map +0 -1
- package/scripts/exportClientAcitivity.d.ts.map +0 -1
- package/scripts/exportEndorsementsForCommunity.d.ts.map +0 -1
- package/scripts/exportPointQualitiesForCommunity.d.ts.map +0 -1
- package/scripts/exportPostsAndPointsForCommunity.d.ts.map +0 -1
- package/scripts/exportPostsDataSetForDomain.d.ts.map +0 -1
- package/scripts/exportPostsForGroup.d.ts.map +0 -1
- package/scripts/exportRatingsForPost.d.ts.map +0 -1
- package/scripts/exportUserEndorsementsWithUserAnalysis.d.ts.map +0 -1
- package/scripts/exportUsersForCommunity.d.ts.map +0 -1
- package/scripts/exportUsersForDomain.d.ts.map +0 -1
- package/scripts/exportUsersForGroup.d.ts.map +0 -1
- package/scripts/exports/ratingDistribution.d.ts.map +0 -1
- package/scripts/exports/whoEndorsedWhatByCommunity.d.ts.map +0 -1
- package/scripts/findUnusedClientImports.d.ts.map +0 -1
- package/scripts/fixAllPostPointCounts.d.ts.map +0 -1
- package/scripts/fixAnonNotificationsSettings.d.ts.map +0 -1
- package/scripts/fixCountKopavogur.d.ts.map +0 -1
- package/scripts/fixEndorsementsAfterCopyPostToGroup.d.ts.map +0 -1
- package/scripts/fixExternalUserId.d.ts.map +0 -1
- package/scripts/fixGroupAccess.d.ts.map +0 -1
- package/scripts/fixGroupIdeasAndPointsCount.d.ts.map +0 -1
- package/scripts/fixNotificationSettings.d.ts.map +0 -1
- package/scripts/fixSurveyRadioBakedInSubCodes.d.ts.map +0 -1
- package/scripts/fixWrongUserIdForStatusUpdates.d.ts.map +0 -1
- package/scripts/gallery/exportGalleryData.d.ts.map +0 -1
- package/scripts/gallery/importGalleryForCommunity.d.ts.map +0 -1
- package/scripts/gallery/readJsonAndDownloadImagesVersion2.d.ts.map +0 -1
- package/scripts/gallery/refreshAcApiPostIdsForCommunity.d.ts.map +0 -1
- package/scripts/genderAnalysis.d.ts.map +0 -1
- package/scripts/genderAnalysisByStatus.d.ts.map +0 -1
- package/scripts/importAllLocalesFromLocalFolders.d.ts.map +0 -1
- package/scripts/importDomain.d.ts.map +0 -1
- package/scripts/landUseGame/export3Ddata.d.ts.map +0 -1
- package/scripts/listLanguagesForGroup.d.ts.map +0 -1
- package/scripts/loadTestCreateDummyContentForGroup.d.ts.map +0 -1
- package/scripts/makeRecursiveMapData.d.ts.map +0 -1
- package/scripts/mapping/community_map_csv.d.ts.map +0 -1
- package/scripts/moveCommunityToDomain.d.ts.map +0 -1
- package/scripts/moveGroupToCommunity.d.ts.map +0 -1
- package/scripts/movePostToGroup.d.ts.map +0 -1
- package/scripts/movePostsToGroupsRecountGroupFromUrl.d.ts.map +0 -1
- package/scripts/oldMovePostToGroup.d.ts.map +0 -1
- package/scripts/processCsvForPdfUrls.d.ts.map +0 -1
- package/scripts/processCsvForTranslationAndToxicity.d.ts.map +0 -1
- package/scripts/recount/recount_recursive_communities.d.ts.map +0 -1
- package/scripts/recountALLCommunityGroupCounts.d.ts.map +0 -1
- package/scripts/recountAll.d.ts.map +0 -1
- package/scripts/recountCommunitesFromUrl.d.ts.map +0 -1
- package/scripts/recountCommunity.d.ts.map +0 -1
- package/scripts/recountGroup.d.ts.map +0 -1
- package/scripts/recountGroupNoUserChange.d.ts.map +0 -1
- package/scripts/resetAllEndorsementsForGroup.d.ts.map +0 -1
- package/scripts/resetEnTranslationForGroup.d.ts.map +0 -1
- package/scripts/setDomainLocales.d.ts.map +0 -1
- package/scripts/setLanguageOnGroupCommunitesFromUrl.d.ts.map +0 -1
- package/scripts/setMemberOfAll.d.ts.map +0 -1
- package/scripts/setNewUserForContentOfCommunity.d.ts.map +0 -1
- package/scripts/setOfficialStatusOnAllPostsForCommunity.d.ts.map +0 -1
- package/scripts/setUserOnAll.d.ts.map +0 -1
- package/scripts/showCategoryForGroup.d.ts.map +0 -1
- package/scripts/showOldActivityTypes.d.ts.map +0 -1
- package/scripts/showPostsMissingCategoryForGroup.d.ts.map +0 -1
- package/scripts/showStatuses.d.ts.map +0 -1
- package/scripts/showUniqueVotersInCommunity.d.ts.map +0 -1
- package/scripts/showUserAgentsAndIpsForEmails.d.ts.map +0 -1
- package/scripts/simpleExportForGroupsForCommunity.d.ts.map +0 -1
- package/scripts/simpleExportForPointsForCommunity.d.ts.map +0 -1
- package/scripts/simpleExportForPostsForCommunity.d.ts.map +0 -1
- package/scripts/testForEndorsments.d.ts.map +0 -1
- package/scripts/undeleteGroupAndAllContent.d.ts.map +0 -1
- package/scripts/undeletePost.d.ts.map +0 -1
- package/scripts/unlinkSsn.d.ts.map +0 -1
- package/scripts/updateFromAlthingi.d.ts.map +0 -1
- package/server.d.ts.map +0 -1
- package/utils/copyGroup.js +0 -246
- package/utils/loggerTs.d.ts +0 -4
- package/utils/loggerTs.d.ts.map +0 -1
- package/utils/ypLanguages.d.ts +0 -18
- package/utils/ypLanguages.d.ts.map +0 -1
- /package/{agents/tools/updateCommunityWorkflow.js → dist/active-citizen/llms/imageGeneration/iImageGenerator.js} +0 -0
- /package/{migrations/270724_createUsersAndAdminsForClasses.cjs → dist/migrations/zzzz_createUsersAndAdminsForClasses.cjs} +0 -0
|
@@ -0,0 +1,1026 @@
|
|
|
1
|
+
const models = require('../../models/index.cjs');
|
|
2
|
+
const _ = require('lodash');
|
|
3
|
+
const https = require("https");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const moment = require("moment");
|
|
6
|
+
const domainIdToKeep = 1338; //process.argv[2];
|
|
7
|
+
const minioDataPath = "/home/robert/Scratch/minio_data"; //process.argv[2];
|
|
8
|
+
const minioBaseUrlPath = "https://www.junges.wien";
|
|
9
|
+
let communityIdsToKeep = [];
|
|
10
|
+
let groupIdsToKeep = [];
|
|
11
|
+
let categoryIdsToKeep = [];
|
|
12
|
+
let pageIdsToKeep = [];
|
|
13
|
+
let postIdsToKeep = [];
|
|
14
|
+
let endorsementIdsToKeep = [];
|
|
15
|
+
let pointIdsToKeep = [];
|
|
16
|
+
let pointRevisionIdsToKeep = [];
|
|
17
|
+
let qualityIdsToKeep = [];
|
|
18
|
+
let imageIdsToKeep = [];
|
|
19
|
+
let videoIdsToKeep = [];
|
|
20
|
+
let audioIdsToKeep = [];
|
|
21
|
+
let activityIdsToKeep = [];
|
|
22
|
+
let userIdsToKeep = [];
|
|
23
|
+
const addUsers = (users) => {
|
|
24
|
+
const userIds = users.map(u => u.id);
|
|
25
|
+
userIdsToKeep = userIdsToKeep.concat(userIds);
|
|
26
|
+
userIdsToKeep = _.uniq(userIdsToKeep);
|
|
27
|
+
//console.log(userIdsToKeep.length);
|
|
28
|
+
};
|
|
29
|
+
const addUsersIds = (userIds) => {
|
|
30
|
+
if (userIds.indexOf(56884) > -1) {
|
|
31
|
+
console.log("adding 56884");
|
|
32
|
+
}
|
|
33
|
+
userIdsToKeep = userIdsToKeep.concat(userIds);
|
|
34
|
+
userIdsToKeep = _.uniq(userIdsToKeep);
|
|
35
|
+
//console.log(userIdsToKeep.length);
|
|
36
|
+
};
|
|
37
|
+
const addImages = (images) => {
|
|
38
|
+
const imageIds = images.map(i => i.id);
|
|
39
|
+
imageIdsToKeep = imageIdsToKeep.concat(imageIds);
|
|
40
|
+
imageIdsToKeep = _.uniq(imageIdsToKeep);
|
|
41
|
+
};
|
|
42
|
+
const addVideos = (videos) => {
|
|
43
|
+
const videosIds = videos.map(v => v.id);
|
|
44
|
+
videoIdsToKeep = videoIdsToKeep.concat(videosIds);
|
|
45
|
+
videoIdsToKeep = _.uniq(videoIdsToKeep);
|
|
46
|
+
};
|
|
47
|
+
const addAudios = (audios) => {
|
|
48
|
+
const audiosIds = audios.map(a => a.id);
|
|
49
|
+
audioIdsToKeep = audioIdsToKeep.concat(audiosIds);
|
|
50
|
+
audioIdsToKeep = _.uniq(audioIdsToKeep);
|
|
51
|
+
};
|
|
52
|
+
async function getDomain() {
|
|
53
|
+
return await new Promise(async (resolve, reject) => {
|
|
54
|
+
const domain = await models.Domain.findOne({
|
|
55
|
+
where: {
|
|
56
|
+
id: domainIdToKeep
|
|
57
|
+
},
|
|
58
|
+
attributes: ['id'],
|
|
59
|
+
include: [
|
|
60
|
+
{
|
|
61
|
+
model: models.User,
|
|
62
|
+
as: 'DomainUsers',
|
|
63
|
+
attributes: ['id'],
|
|
64
|
+
required: false
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
model: models.User,
|
|
68
|
+
as: 'DomainAdmins',
|
|
69
|
+
attributes: ['id'],
|
|
70
|
+
required: false
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
model: models.Image,
|
|
74
|
+
as: 'DomainLogoImages',
|
|
75
|
+
attributes: ['id'],
|
|
76
|
+
required: false
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
model: models.Image,
|
|
80
|
+
as: 'DomainHeaderImages',
|
|
81
|
+
attributes: ['id'],
|
|
82
|
+
required: false
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
model: models.Video,
|
|
86
|
+
as: 'DomainLogoVideos',
|
|
87
|
+
attributes: ['id'],
|
|
88
|
+
required: false
|
|
89
|
+
},
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
resolve(domain);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async function getCommunities() {
|
|
96
|
+
return await new Promise(async (resolve, reject) => {
|
|
97
|
+
const communities = await models.Community.findAll({
|
|
98
|
+
where: {
|
|
99
|
+
domain_id: domainIdToKeep
|
|
100
|
+
},
|
|
101
|
+
attributes: ['id', 'user_id'],
|
|
102
|
+
include: [
|
|
103
|
+
{
|
|
104
|
+
model: models.User,
|
|
105
|
+
as: 'CommunityUsers',
|
|
106
|
+
attributes: ['id'],
|
|
107
|
+
required: false
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
model: models.User,
|
|
111
|
+
as: 'CommunityAdmins',
|
|
112
|
+
attributes: ['id'],
|
|
113
|
+
required: false
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
model: models.Image,
|
|
117
|
+
as: 'CommunityLogoImages',
|
|
118
|
+
attributes: ['id'],
|
|
119
|
+
required: false
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
model: models.Image,
|
|
123
|
+
as: 'CommunityHeaderImages',
|
|
124
|
+
attributes: ['id'],
|
|
125
|
+
required: false
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
model: models.Video,
|
|
129
|
+
as: 'CommunityLogoVideos',
|
|
130
|
+
attributes: ['id'],
|
|
131
|
+
required: false
|
|
132
|
+
},
|
|
133
|
+
]
|
|
134
|
+
});
|
|
135
|
+
resolve(communities);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async function getGroups() {
|
|
139
|
+
return await new Promise(async (resolve, reject) => {
|
|
140
|
+
const groups = await models.Group.findAll({
|
|
141
|
+
where: {
|
|
142
|
+
community_id: {
|
|
143
|
+
$in: communityIdsToKeep
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
attributes: ['id'],
|
|
147
|
+
include: [
|
|
148
|
+
{
|
|
149
|
+
model: models.User,
|
|
150
|
+
as: 'GroupUsers',
|
|
151
|
+
attributes: ['id'],
|
|
152
|
+
required: false
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
model: models.User,
|
|
156
|
+
as: 'GroupAdmins',
|
|
157
|
+
attributes: ['id'],
|
|
158
|
+
required: false
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
model: models.Image,
|
|
162
|
+
as: 'GroupLogoImages',
|
|
163
|
+
attributes: ['id'],
|
|
164
|
+
required: false
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
model: models.Image,
|
|
168
|
+
as: 'GroupHeaderImages',
|
|
169
|
+
attributes: ['id'],
|
|
170
|
+
required: false
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
model: models.Video,
|
|
174
|
+
as: 'GroupLogoVideos',
|
|
175
|
+
attributes: ['id'],
|
|
176
|
+
required: false
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
});
|
|
180
|
+
resolve(groups);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
async function getPosts() {
|
|
184
|
+
return await new Promise(async (resolve, reject) => {
|
|
185
|
+
const posts = await models.Post.unscoped().findAll({
|
|
186
|
+
where: {
|
|
187
|
+
group_id: {
|
|
188
|
+
$in: groupIdsToKeep
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
attributes: ['id', 'user_id'],
|
|
192
|
+
include: [
|
|
193
|
+
{
|
|
194
|
+
model: models.Image,
|
|
195
|
+
as: 'PostImages',
|
|
196
|
+
attributes: ['id'],
|
|
197
|
+
required: false
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
model: models.Image,
|
|
201
|
+
as: 'PostHeaderImages',
|
|
202
|
+
attributes: ['id'],
|
|
203
|
+
required: false
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
model: models.Image,
|
|
207
|
+
as: 'PostImages',
|
|
208
|
+
attributes: ['id'],
|
|
209
|
+
required: false
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
model: models.Video,
|
|
213
|
+
as: 'PostVideos',
|
|
214
|
+
attributes: ['id'],
|
|
215
|
+
required: false
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
model: models.Audio,
|
|
219
|
+
as: 'PostAudios',
|
|
220
|
+
attributes: ['id'],
|
|
221
|
+
required: false
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
});
|
|
225
|
+
resolve(posts);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
async function getEndorsements() {
|
|
229
|
+
return await new Promise(async (resolve, reject) => {
|
|
230
|
+
const endorsement = await models.Endorsement.unscoped().findAll({
|
|
231
|
+
where: {
|
|
232
|
+
post_id: {
|
|
233
|
+
$in: postIdsToKeep
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
attributes: ['id', 'user_id']
|
|
237
|
+
});
|
|
238
|
+
resolve(endorsement);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
async function getQualities() {
|
|
242
|
+
return await new Promise(async (resolve, reject) => {
|
|
243
|
+
const qualities = await models.PointQuality.findAll({
|
|
244
|
+
where: {
|
|
245
|
+
point_id: {
|
|
246
|
+
$in: pointIdsToKeep
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
attributes: ['id', 'user_id']
|
|
250
|
+
});
|
|
251
|
+
resolve(qualities);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
async function getPointRevisions() {
|
|
255
|
+
return await new Promise(async (resolve, reject) => {
|
|
256
|
+
const revisions = await models.PointRevision.findAll({
|
|
257
|
+
where: {
|
|
258
|
+
point_id: {
|
|
259
|
+
$in: pointIdsToKeep
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
attributes: ['id', 'user_id']
|
|
263
|
+
});
|
|
264
|
+
resolve(revisions);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
async function getCategories() {
|
|
268
|
+
return await new Promise(async (resolve, reject) => {
|
|
269
|
+
const categories = await models.Category.findAll({
|
|
270
|
+
where: {
|
|
271
|
+
group_id: {
|
|
272
|
+
$in: groupIdsToKeep
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
attributes: ['id']
|
|
276
|
+
});
|
|
277
|
+
resolve(categories);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
async function getPages() {
|
|
281
|
+
return await new Promise(async (resolve, reject) => {
|
|
282
|
+
const pages = await models.Page.findAll({
|
|
283
|
+
where: {
|
|
284
|
+
group_id: {
|
|
285
|
+
$in: groupIdsToKeep
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
attributes: ['id']
|
|
289
|
+
});
|
|
290
|
+
resolve(pages);
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
async function getPoints() {
|
|
294
|
+
return await new Promise(async (resolve, reject) => {
|
|
295
|
+
const points = await models.Point.unscoped().findAll({
|
|
296
|
+
where: {
|
|
297
|
+
post_id: {
|
|
298
|
+
$in: postIdsToKeep
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
attributes: ['id', 'user_id'],
|
|
302
|
+
include: [
|
|
303
|
+
{
|
|
304
|
+
model: models.Video,
|
|
305
|
+
as: 'PointVideos',
|
|
306
|
+
attributes: ['id'],
|
|
307
|
+
required: false
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
model: models.Audio,
|
|
311
|
+
as: 'PointAudios',
|
|
312
|
+
attributes: ['id'],
|
|
313
|
+
required: false
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
});
|
|
317
|
+
resolve(points);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
async function getUsers() {
|
|
321
|
+
return await new Promise(async (resolve, reject) => {
|
|
322
|
+
const users = await models.User.unscoped().findAll({
|
|
323
|
+
where: {
|
|
324
|
+
id: {
|
|
325
|
+
$in: userIdsToKeep
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
attributes: ['id'],
|
|
329
|
+
include: [
|
|
330
|
+
{
|
|
331
|
+
model: models.Image,
|
|
332
|
+
as: 'UserHeaderImages',
|
|
333
|
+
attributes: ['id'],
|
|
334
|
+
required: false
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
model: models.Image,
|
|
338
|
+
as: 'UserProfileImages',
|
|
339
|
+
attributes: ['id'],
|
|
340
|
+
required: false
|
|
341
|
+
}
|
|
342
|
+
]
|
|
343
|
+
});
|
|
344
|
+
resolve(users);
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
async function getVideos() {
|
|
348
|
+
return await new Promise(async (resolve, reject) => {
|
|
349
|
+
const videos = await models.Video.unscoped().findAll({
|
|
350
|
+
where: {
|
|
351
|
+
id: {
|
|
352
|
+
$in: videoIdsToKeep
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
attributes: ['id'],
|
|
356
|
+
include: [
|
|
357
|
+
{
|
|
358
|
+
model: models.Image,
|
|
359
|
+
as: 'VideoImages',
|
|
360
|
+
attributes: ['id'],
|
|
361
|
+
required: false
|
|
362
|
+
}
|
|
363
|
+
]
|
|
364
|
+
});
|
|
365
|
+
resolve(videos);
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
async function getActivities() {
|
|
369
|
+
return await new Promise(async (resolve, reject) => {
|
|
370
|
+
const activities = await models.AcActivity.findAll({
|
|
371
|
+
where: {
|
|
372
|
+
$or: [
|
|
373
|
+
{
|
|
374
|
+
community_id: {
|
|
375
|
+
$in: communityIdsToKeep
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
group_id: {
|
|
380
|
+
$in: groupIdsToKeep
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
domain_id: domainIdToKeep,
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
post_id: {
|
|
388
|
+
$in: postIdsToKeep
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
point_id: {
|
|
393
|
+
$in: pointIdsToKeep
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
user_id: {
|
|
398
|
+
$in: pointIdsToKeep
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
]
|
|
402
|
+
},
|
|
403
|
+
attributes: ['id', 'user_id', 'domain_id', 'community_id', 'group_id', 'post_id', 'point_id'],
|
|
404
|
+
});
|
|
405
|
+
resolve(activities);
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
async function setupIdsToKeep() {
|
|
409
|
+
return await new Promise(async (resolve, reject) => {
|
|
410
|
+
try {
|
|
411
|
+
console.log("Setup domain");
|
|
412
|
+
const domain = await getDomain();
|
|
413
|
+
addUsers(domain.DomainUsers);
|
|
414
|
+
addUsers(domain.DomainAdmins);
|
|
415
|
+
addImages(domain.DomainLogoImages);
|
|
416
|
+
addImages(domain.DomainHeaderImages);
|
|
417
|
+
addVideos(domain.DomainLogoVideos);
|
|
418
|
+
console.log("Setup community");
|
|
419
|
+
const communities = await getCommunities();
|
|
420
|
+
communityIdsToKeep = communities.map(c => c.id);
|
|
421
|
+
for (let i = 0; i < communities.length; i++) {
|
|
422
|
+
//addUsersIds([communities[i].user_id]);
|
|
423
|
+
addUsers(communities[i].CommunityUsers);
|
|
424
|
+
addUsers(communities[i].CommunityAdmins);
|
|
425
|
+
addImages(communities[i].CommunityLogoImages);
|
|
426
|
+
addImages(communities[i].CommunityHeaderImages);
|
|
427
|
+
addVideos(communities[i].CommunityLogoVideos);
|
|
428
|
+
}
|
|
429
|
+
console.log("Setup group");
|
|
430
|
+
const groups = await getGroups();
|
|
431
|
+
groupIdsToKeep = groups.map(c => c.id);
|
|
432
|
+
for (let i = 0; i < groups.length; i++) {
|
|
433
|
+
//addUsersIds([groups[i].user_id]);
|
|
434
|
+
addUsers(groups[i].GroupUsers);
|
|
435
|
+
addUsers(groups[i].GroupAdmins);
|
|
436
|
+
addImages(groups[i].GroupLogoImages);
|
|
437
|
+
addImages(groups[i].GroupHeaderImages);
|
|
438
|
+
addVideos(groups[i].GroupLogoVideos);
|
|
439
|
+
}
|
|
440
|
+
const categories = await getCategories();
|
|
441
|
+
categoryIdsToKeep = categories.map(c => c.id);
|
|
442
|
+
const pages = await getPages();
|
|
443
|
+
pageIdsToKeep = pages.map(p => p.id);
|
|
444
|
+
console.log("Setup posts");
|
|
445
|
+
const posts = await getPosts();
|
|
446
|
+
postIdsToKeep = posts.map(p => p.id);
|
|
447
|
+
for (let i = 0; i < posts.length; i++) {
|
|
448
|
+
if (posts[i].user_id == null) {
|
|
449
|
+
console.error(`User id null for ${posts[i].id}`);
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
addUsersIds([posts[i].user_id]);
|
|
453
|
+
addImages(posts[i].PostImages);
|
|
454
|
+
addImages(posts[i].PostHeaderImages);
|
|
455
|
+
addVideos(posts[i].PostVideos);
|
|
456
|
+
addAudios(posts[i].PostAudios);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
console.log("Setup points");
|
|
460
|
+
const points = await getPoints();
|
|
461
|
+
pointIdsToKeep = points.map(p => p.id);
|
|
462
|
+
for (let i = 0; i < points.length; i++) {
|
|
463
|
+
addUsersIds([points[i].user_id]);
|
|
464
|
+
addVideos(points[i].PointVideos);
|
|
465
|
+
addAudios(points[i].PointAudios);
|
|
466
|
+
}
|
|
467
|
+
const endorsements = await getEndorsements();
|
|
468
|
+
endorsementIdsToKeep = endorsements.map(p => p.id);
|
|
469
|
+
for (let i = 0; i < endorsements.length; i++) {
|
|
470
|
+
addUsersIds([endorsements[i].user_id]);
|
|
471
|
+
}
|
|
472
|
+
const qualities = await getQualities();
|
|
473
|
+
qualityIdsToKeep = qualities.map(p => p.id);
|
|
474
|
+
for (let i = 0; i < qualities.length; i++) {
|
|
475
|
+
addUsersIds([qualities[i].user_id]);
|
|
476
|
+
}
|
|
477
|
+
const pointRevisions = await getPointRevisions();
|
|
478
|
+
pointRevisionIdsToKeep = pointRevisions.map(p => p.id);
|
|
479
|
+
console.log("Setup activities");
|
|
480
|
+
const activities = await getActivities();
|
|
481
|
+
activityIdsToKeep = activities.map(a => a.id);
|
|
482
|
+
for (let i = 0; i < activities.length; i++) {
|
|
483
|
+
if (activities[i].user_id)
|
|
484
|
+
addUsersIds([activities[i].user_id]);
|
|
485
|
+
else
|
|
486
|
+
console.warn(`No user_id for activity ${activities[i].id}`);
|
|
487
|
+
}
|
|
488
|
+
const users = await getUsers();
|
|
489
|
+
for (let i = 0; i < users.length; i++) {
|
|
490
|
+
addImages(users[i].UserProfileImages);
|
|
491
|
+
addImages(users[i].UserHeaderImages);
|
|
492
|
+
}
|
|
493
|
+
const videos = await getVideos();
|
|
494
|
+
for (let i = 0; i < videos.length; i++) {
|
|
495
|
+
addVideos(videos[i].VideoImages);
|
|
496
|
+
}
|
|
497
|
+
resolve();
|
|
498
|
+
}
|
|
499
|
+
catch (error) {
|
|
500
|
+
reject(error);
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
async function deleteVideos() {
|
|
505
|
+
return await new Promise(async (resolve, reject) => {
|
|
506
|
+
console.log("Destroying videos images");
|
|
507
|
+
const videos = await models.Video.unscoped().findAll({
|
|
508
|
+
attributes: ['id'],
|
|
509
|
+
where: {
|
|
510
|
+
id: {
|
|
511
|
+
[models.Sequelize.Op.notIn]: videoIdsToKeep
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
for (let i = 0; i < videos.length; i++) {
|
|
516
|
+
await videos[i].setVideoImages([]);
|
|
517
|
+
}
|
|
518
|
+
console.log("Destroying videos");
|
|
519
|
+
await models.Video.unscoped().destroy({ where: {
|
|
520
|
+
id: {
|
|
521
|
+
[models.Sequelize.Op.notIn]: videoIdsToKeep
|
|
522
|
+
}
|
|
523
|
+
} });
|
|
524
|
+
resolve();
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
async function deletePointAssociations() {
|
|
528
|
+
return await new Promise(async (resolve, reject) => {
|
|
529
|
+
console.log("Destroying PointAssociations ");
|
|
530
|
+
const points = await models.Point.unscoped().findAll({
|
|
531
|
+
attributes: ['id'],
|
|
532
|
+
where: {
|
|
533
|
+
id: {
|
|
534
|
+
[models.Sequelize.Op.notIn]: pointIdsToKeep
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
for (let i = 0; i < points.length; i++) {
|
|
539
|
+
await points[i].setPointVideos([]);
|
|
540
|
+
await points[i].setPointAudios([]);
|
|
541
|
+
}
|
|
542
|
+
resolve();
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
async function deletePostAssociations() {
|
|
546
|
+
return await new Promise(async (resolve, reject) => {
|
|
547
|
+
console.log("Destroying PostAssociations ");
|
|
548
|
+
const posts = await models.Post.unscoped().findAll({
|
|
549
|
+
attributes: ['id'],
|
|
550
|
+
where: {
|
|
551
|
+
id: {
|
|
552
|
+
[models.Sequelize.Op.notIn]: postIdsToKeep
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
for (let i = 0; i < posts.length; i++) {
|
|
557
|
+
await posts[i].setPostVideos([]);
|
|
558
|
+
await posts[i].setPostAudios([]);
|
|
559
|
+
await posts[i].setPostImages([]);
|
|
560
|
+
await posts[i].setPostHeaderImages([]);
|
|
561
|
+
}
|
|
562
|
+
resolve();
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
async function deleteUserAssociations() {
|
|
566
|
+
return await new Promise(async (resolve, reject) => {
|
|
567
|
+
console.log("Destroying UserAssociations ");
|
|
568
|
+
const users = await models.User.unscoped().findAll({
|
|
569
|
+
attributes: ['id'],
|
|
570
|
+
where: {
|
|
571
|
+
id: {
|
|
572
|
+
[models.Sequelize.Op.notIn]: userIdsToKeep
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
for (let i = 0; i < users.length; i++) {
|
|
577
|
+
await users[i].setUserProfileImages([]);
|
|
578
|
+
await users[i].setUserHeaderImages([]);
|
|
579
|
+
await users[i].setGroupUsers([]);
|
|
580
|
+
await users[i].setCommunityUsers([]);
|
|
581
|
+
await users[i].setDomainUsers([]);
|
|
582
|
+
await users[i].setDomainAdmins([]);
|
|
583
|
+
await users[i].setCommunityAdmins([]);
|
|
584
|
+
await users[i].setGroupAdmins([]);
|
|
585
|
+
await users[i].setOrganizationAdmins([]);
|
|
586
|
+
}
|
|
587
|
+
resolve();
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
async function deleteGroupAssociations() {
|
|
591
|
+
return await new Promise(async (resolve, reject) => {
|
|
592
|
+
console.log("Destroying GroupAssociations ");
|
|
593
|
+
const groups = await models.Group.unscoped().findAll({
|
|
594
|
+
attributes: ['id'],
|
|
595
|
+
where: {
|
|
596
|
+
id: {
|
|
597
|
+
[models.Sequelize.Op.notIn]: groupIdsToKeep
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
for (let i = 0; i < groups.length; i++) {
|
|
602
|
+
await groups[i].setGroupLogoVideos([]);
|
|
603
|
+
await groups[i].setGroupLogoImages([]);
|
|
604
|
+
await groups[i].setGroupHeaderImages([]);
|
|
605
|
+
await groups[i].setGroupUsers([]);
|
|
606
|
+
await groups[i].setGroupAdmins([]);
|
|
607
|
+
}
|
|
608
|
+
resolve();
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
async function deleteCommunityAssociations() {
|
|
612
|
+
return await new Promise(async (resolve, reject) => {
|
|
613
|
+
console.log("Destroying CommunityAssociations ");
|
|
614
|
+
const communities = await models.Community.unscoped().findAll({
|
|
615
|
+
attributes: ['id'],
|
|
616
|
+
where: {
|
|
617
|
+
id: {
|
|
618
|
+
[models.Sequelize.Op.notIn]: communityIdsToKeep
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
for (let i = 0; i < communities.length; i++) {
|
|
623
|
+
await communities[i].setCommunityLogoVideos([]);
|
|
624
|
+
await communities[i].setCommunityLogoImages([]);
|
|
625
|
+
await communities[i].setCommunityHeaderImages([]);
|
|
626
|
+
await communities[i].setCommunityUsers([]);
|
|
627
|
+
await communities[i].setCommunityAdmins([]);
|
|
628
|
+
}
|
|
629
|
+
resolve();
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
async function deleteDomainAssociations() {
|
|
633
|
+
return await new Promise(async (resolve, reject) => {
|
|
634
|
+
console.log("Destroying DomainAssociations ");
|
|
635
|
+
const domains = await models.Domain.unscoped().findAll({
|
|
636
|
+
attributes: ['id'],
|
|
637
|
+
where: {
|
|
638
|
+
id: {
|
|
639
|
+
[models.Sequelize.Op.notIn]: [domainIdToKeep]
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
for (let i = 0; i < domains.length; i++) {
|
|
644
|
+
await domains[i].setDomainLogoVideos([]);
|
|
645
|
+
await domains[i].setDomainLogoImages([]);
|
|
646
|
+
await domains[i].setDomainHeaderImages([]);
|
|
647
|
+
await domains[i].setDomainUsers([]);
|
|
648
|
+
await domains[i].setDomainAdmins([]);
|
|
649
|
+
}
|
|
650
|
+
resolve();
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
async function deleteActivityAssociations() {
|
|
654
|
+
return await new Promise(async (resolve, reject) => {
|
|
655
|
+
console.log("Destroying ActivitiesAssociations ");
|
|
656
|
+
const activities = await models.AcActivity.unscoped().findAll({
|
|
657
|
+
attributes: ['id']
|
|
658
|
+
});
|
|
659
|
+
for (let i = activities.length - 1; i > 1000000; i--) {
|
|
660
|
+
await activities[i].setUsers([]);
|
|
661
|
+
await activities[i].setAcActivities([]);
|
|
662
|
+
}
|
|
663
|
+
resolve();
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
async function deleteNotificationAssociations() {
|
|
667
|
+
return await new Promise(async (resolve, reject) => {
|
|
668
|
+
console.log("Destroying NoitficationAssociations ");
|
|
669
|
+
const notifications = await models.AcNotification.unscoped().findAll({
|
|
670
|
+
attributes: ['id'],
|
|
671
|
+
});
|
|
672
|
+
for (let i = 0; i < notifications.length; i++) {
|
|
673
|
+
await notifications[i].setUsers([]);
|
|
674
|
+
await notifications[i].setAcActivities([]);
|
|
675
|
+
await notifications[i].setAcDelayedNotifications([]);
|
|
676
|
+
}
|
|
677
|
+
resolve();
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
async function deleteImageAssociations() {
|
|
681
|
+
return await new Promise(async (resolve, reject) => {
|
|
682
|
+
console.log("Destroying ImageAssociations ");
|
|
683
|
+
const images = await models.Image.unscoped().findAll({
|
|
684
|
+
attributes: ['id'],
|
|
685
|
+
where: {
|
|
686
|
+
id: {
|
|
687
|
+
[models.Sequelize.Op.notIn]: imageIdsToKeep
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
});
|
|
691
|
+
for (let i = 0; i < images.length; i++) {
|
|
692
|
+
await images[i].setVideoImages([]);
|
|
693
|
+
}
|
|
694
|
+
resolve();
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
async function deleteInChunks(model, where) {
|
|
698
|
+
return await new Promise(async (resolve, reject) => {
|
|
699
|
+
try {
|
|
700
|
+
let haveItemsToDelete = true;
|
|
701
|
+
let offset = 0;
|
|
702
|
+
while (haveItemsToDelete) {
|
|
703
|
+
const items = await model.unscoped().findAll({
|
|
704
|
+
where,
|
|
705
|
+
attributes: ['id'],
|
|
706
|
+
order: ['id'],
|
|
707
|
+
offset: offset,
|
|
708
|
+
limit: 2500
|
|
709
|
+
});
|
|
710
|
+
if (items.length > 0) {
|
|
711
|
+
const modelIds = items.map(n => { return n.id; });
|
|
712
|
+
offset += 2500;
|
|
713
|
+
console.log(`offset: ${offset}`);
|
|
714
|
+
const destroyResults = await model.unscoped().destroy({
|
|
715
|
+
where: {
|
|
716
|
+
id: {
|
|
717
|
+
[models.Sequelize.Op.in]: modelIds
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
const a = destroyResults;
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
haveItemsToDelete = false;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
resolve();
|
|
728
|
+
}
|
|
729
|
+
catch (error) {
|
|
730
|
+
reject(error);
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
function sleep(ms) {
|
|
735
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
736
|
+
}
|
|
737
|
+
async function deleteAll() {
|
|
738
|
+
return await new Promise(async (resolve, reject) => {
|
|
739
|
+
try {
|
|
740
|
+
//Only needs to run once
|
|
741
|
+
//await deletePointAssociations();
|
|
742
|
+
//await deletePostAssociations();
|
|
743
|
+
//await deleteUserAssociations();
|
|
744
|
+
//await deleteGroupAssociations();
|
|
745
|
+
//await deleteCommunityAssociations();
|
|
746
|
+
//await deleteDomainAssociations();
|
|
747
|
+
//await deleteActivityAssociations();
|
|
748
|
+
//await deleteNotificationAssociations();
|
|
749
|
+
//await deleteImageAssociations();
|
|
750
|
+
console.log("Destroying points");
|
|
751
|
+
await deleteInChunks(models.Point.unscoped(), {
|
|
752
|
+
id: {
|
|
753
|
+
[models.Sequelize.Op.notIn]: pointIdsToKeep
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
console.log("Destroying point qualities");
|
|
757
|
+
await deleteInChunks(models.PointQuality.unscoped(), {
|
|
758
|
+
id: {
|
|
759
|
+
[models.Sequelize.Op.notIn]: qualityIdsToKeep
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
console.log("Destroying point revision");
|
|
763
|
+
await deleteInChunks(models.PointRevision.unscoped(), {
|
|
764
|
+
id: {
|
|
765
|
+
[models.Sequelize.Op.notIn]: pointRevisionIdsToKeep
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
console.log("Destroying post revision");
|
|
769
|
+
await deleteInChunks(models.PostRevision.unscoped(), {
|
|
770
|
+
post_id: null
|
|
771
|
+
});
|
|
772
|
+
console.log("Destroying temp data and not used 1");
|
|
773
|
+
//await models.AcNewsFeedItem.unscoped().destroy({ truncate: true });
|
|
774
|
+
console.log("Destroying temp data and not used 2");
|
|
775
|
+
//await models.AcNewsFeedProcessedRange.unscoped().destroy({ truncate: true });
|
|
776
|
+
console.log("Destroying temp data and not used 3");
|
|
777
|
+
//await models.AcDelayedNotification.unscoped().destroy({ truncate: true });
|
|
778
|
+
console.log("Destroying temp data and not used 4");
|
|
779
|
+
// You will need to temporarily disable some foreign key constraints
|
|
780
|
+
//await models.AcNotification.unscoped().destroy({ truncate: true });
|
|
781
|
+
console.log("Destroying temp data and not used 5");
|
|
782
|
+
// You will need to temporarily disable some foreign key constraints
|
|
783
|
+
//await models.AcActivity.unscoped().destroy({ truncate: true });
|
|
784
|
+
console.log("Destroying temp data and not used 6");
|
|
785
|
+
//await models.AcBackgroundJob.unscoped().destroy({ truncate: true });
|
|
786
|
+
console.log("Destroying temp data and not used 7");
|
|
787
|
+
//await models.AcClientActivity.unscoped().destroy({ truncate: true });
|
|
788
|
+
console.log("Destroying temp data and not used 8");
|
|
789
|
+
//await models.AcTranslationCache.unscoped().destroy({ truncate: true });
|
|
790
|
+
console.log("Destroying temp data and not used 9");
|
|
791
|
+
//await models.GeneralDataStore.unscoped().destroy({ truncate: true });
|
|
792
|
+
console.log("Destroying temp data and not used 10");
|
|
793
|
+
await deleteInChunks(models.Invite.unscoped(), {});
|
|
794
|
+
console.log("Destroying temp data and not used 11");
|
|
795
|
+
await deleteInChunks(models.PostStatusChange.unscoped(), {});
|
|
796
|
+
await deleteInChunks(models.BulkStatusUpdate.unscoped(), {});
|
|
797
|
+
console.log("Destroying temp data and not used 12");
|
|
798
|
+
//await deleteInChunks(models.PostRevision.unscoped(), {
|
|
799
|
+
//});
|
|
800
|
+
console.log("Destroying temp data and not used 13");
|
|
801
|
+
//await models.Rating.unscoped().destroy({ truncate: true });
|
|
802
|
+
console.log("Destroying temp data and not used 14");
|
|
803
|
+
await models.UserLegacyPassword.unscoped().destroy({ truncate: true });
|
|
804
|
+
console.log("Destroying temp data and not used 15");
|
|
805
|
+
console.log("Destroying posts");
|
|
806
|
+
await deleteInChunks(models.Post.unscoped(), {
|
|
807
|
+
id: {
|
|
808
|
+
[models.Sequelize.Op.notIn]: postIdsToKeep
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
console.log("Destroying endorsements");
|
|
812
|
+
await deleteInChunks(models.Endorsement.unscoped(), {
|
|
813
|
+
id: {
|
|
814
|
+
[models.Sequelize.Op.notIn]: endorsementIdsToKeep
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
console.log("Destroying pages");
|
|
818
|
+
await deleteInChunks(models.Page.unscoped(), {
|
|
819
|
+
id: {
|
|
820
|
+
[models.Sequelize.Op.notIn]: pageIdsToKeep
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
console.log("Destroying categories");
|
|
824
|
+
await deleteInChunks(models.Category.unscoped(), {
|
|
825
|
+
id: {
|
|
826
|
+
[models.Sequelize.Op.notIn]: categoryIdsToKeep
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
console.log("Destroying groups");
|
|
830
|
+
await deleteInChunks(models.Group.unscoped(), {
|
|
831
|
+
id: {
|
|
832
|
+
[models.Sequelize.Op.notIn]: groupIdsToKeep
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
console.log("Destroying communities");
|
|
836
|
+
await deleteInChunks(models.Community.unscoped(), {
|
|
837
|
+
id: {
|
|
838
|
+
[models.Sequelize.Op.notIn]: communityIdsToKeep
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
console.log("Destroying domains");
|
|
842
|
+
await deleteInChunks(models.Domain.unscoped(), {
|
|
843
|
+
id: {
|
|
844
|
+
[models.Sequelize.Op.notIn]: [domainIdToKeep]
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
await deleteVideos();
|
|
848
|
+
console.log("Destroying audios");
|
|
849
|
+
await deleteInChunks(models.Audio.unscoped(), {
|
|
850
|
+
id: {
|
|
851
|
+
[models.Sequelize.Op.notIn]: audioIdsToKeep
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
console.log("Destroying images");
|
|
855
|
+
await deleteInChunks(models.Image.unscoped(), {
|
|
856
|
+
id: {
|
|
857
|
+
[models.Sequelize.Op.notIn]: imageIdsToKeep
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
console.log("Destroying users");
|
|
861
|
+
let haveItemsToDelete = true;
|
|
862
|
+
let offset = 0;
|
|
863
|
+
let deletedItems = 0;
|
|
864
|
+
while (haveItemsToDelete) {
|
|
865
|
+
const allUsers = await models.User.unscoped().findAll({
|
|
866
|
+
attributes: ['id'],
|
|
867
|
+
limit: 2500,
|
|
868
|
+
offset: offset
|
|
869
|
+
});
|
|
870
|
+
const allUserIds = allUsers.map(u => u.id);
|
|
871
|
+
const userIdsToDelete = allUserIds.filter(uid => {
|
|
872
|
+
return userIdsToKeep.indexOf(uid) === -1;
|
|
873
|
+
});
|
|
874
|
+
if (userIdsToDelete.indexOf(56884) > -1) {
|
|
875
|
+
console.log("DELETING 56884");
|
|
876
|
+
}
|
|
877
|
+
if (userIdsToDelete.length > 0) {
|
|
878
|
+
deletedItems += userIdsToDelete.length;
|
|
879
|
+
await models.User.unscoped().destroy({
|
|
880
|
+
where: {
|
|
881
|
+
id: {
|
|
882
|
+
[models.Sequelize.Op.in]: userIdsToDelete
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
offset += 2500;
|
|
887
|
+
console.log(offset);
|
|
888
|
+
}
|
|
889
|
+
else {
|
|
890
|
+
haveItemsToDelete = false;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
resolve();
|
|
894
|
+
}
|
|
895
|
+
catch (error) {
|
|
896
|
+
reject(error);
|
|
897
|
+
}
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
// .minio.sys/buckets/minio.yrpri.production/034dc9ad-1503-455f-9fcc-50549d373212-small.png/fs.json
|
|
901
|
+
// minio.yrpri.production/034dc9ad-1503-455f-9fcc-50549d373212-small.png
|
|
902
|
+
async function copyVideosToMinio() {
|
|
903
|
+
return await new Promise(async (resolve, reject) => {
|
|
904
|
+
try {
|
|
905
|
+
const videos = await models.Video.unscoped().findAll({
|
|
906
|
+
attributes: ['id', 'formats'],
|
|
907
|
+
});
|
|
908
|
+
for (let i = 0; i < videos.length; i++) {
|
|
909
|
+
const formats = videos[i].formats;
|
|
910
|
+
for (let f = 0; f < formats.length; f++) {
|
|
911
|
+
const newUrl = await copyFileFromS3ToMinio("minio-video-public", formats[f]);
|
|
912
|
+
formats[f] = newUrl;
|
|
913
|
+
console.log(newUrl);
|
|
914
|
+
}
|
|
915
|
+
videos[i].formats = formats;
|
|
916
|
+
videos[i].changed('formats', true);
|
|
917
|
+
await videos[i].save();
|
|
918
|
+
}
|
|
919
|
+
resolve();
|
|
920
|
+
}
|
|
921
|
+
catch (error) {
|
|
922
|
+
reject(error);
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
async function copyImagesToMinio() {
|
|
927
|
+
return await new Promise(async (resolve, reject) => {
|
|
928
|
+
try {
|
|
929
|
+
const images = await models.Image.unscoped().findAll({
|
|
930
|
+
attributes: ['id', 'formats'],
|
|
931
|
+
});
|
|
932
|
+
for (let i = 0; i < images.length; i++) {
|
|
933
|
+
const formats = JSON.parse(images[i].formats);
|
|
934
|
+
for (let f = 0; f < formats.length; f++) {
|
|
935
|
+
const newUrl = await copyFileFromS3ToMinio("minio.yrpri.production", formats[f]);
|
|
936
|
+
formats[f] = newUrl;
|
|
937
|
+
}
|
|
938
|
+
images[i].formats = JSON.stringify(formats);
|
|
939
|
+
await images[i].save();
|
|
940
|
+
}
|
|
941
|
+
resolve();
|
|
942
|
+
}
|
|
943
|
+
catch (error) {
|
|
944
|
+
reject(error);
|
|
945
|
+
}
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
async function copyAudiosToMinio() {
|
|
949
|
+
return await new Promise(async (resolve, reject) => {
|
|
950
|
+
try {
|
|
951
|
+
const audios = await models.Audio.unscoped().findAll({
|
|
952
|
+
attributes: ['id', 'formats'],
|
|
953
|
+
});
|
|
954
|
+
for (let i = 0; i < audios.length; i++) {
|
|
955
|
+
const formats = audios[i].formats;
|
|
956
|
+
for (let f = 0; f < formats.length; f++) {
|
|
957
|
+
const newUrl = await copyFileFromS3ToMinio("minio-audio-public", formats[f]);
|
|
958
|
+
formats[f] = newUrl;
|
|
959
|
+
console.log(`New ${newUrl}`);
|
|
960
|
+
}
|
|
961
|
+
audios[i].formats = formats;
|
|
962
|
+
audios[i].changed('formats', true);
|
|
963
|
+
await audios[i].save();
|
|
964
|
+
}
|
|
965
|
+
resolve();
|
|
966
|
+
}
|
|
967
|
+
catch (error) {
|
|
968
|
+
reject(error);
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
async function copyAllToMinio() {
|
|
973
|
+
return await new Promise(async (resolve, reject) => {
|
|
974
|
+
try {
|
|
975
|
+
await copyImagesToMinio();
|
|
976
|
+
await copyVideosToMinio();
|
|
977
|
+
await copyAudiosToMinio();
|
|
978
|
+
resolve();
|
|
979
|
+
}
|
|
980
|
+
catch (error) {
|
|
981
|
+
reject(error);
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
async function copyFileFromS3ToMinio(bucket, url) {
|
|
986
|
+
return await new Promise(async (resolve, reject) => {
|
|
987
|
+
try {
|
|
988
|
+
const filename = url.substring(url.lastIndexOf('/') + 1);
|
|
989
|
+
const filetype = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase();
|
|
990
|
+
const minioFilePath = `${minioDataPath}/${bucket}/${filename}`;
|
|
991
|
+
const minioMetaDataFolderPath = `${minioDataPath}/.minio.sys/buckets/${bucket}/${filename}`;
|
|
992
|
+
const fsContentType = ["png", "jpeg", "jpg"].indexOf(filetype) > -1 ? `image/${filetype}` : `application/octet-stream`;
|
|
993
|
+
const fsFileContent = `{"version":"1.0.2","checksum":{"algorithm":"","blocksize":0,"hashes":null},"meta":{"content-type":"${fsContentType}","etag":"3df11831a2ace04090b85676183f778a"}}`;
|
|
994
|
+
https.get(url, response => {
|
|
995
|
+
if (response.statusCode === 200) {
|
|
996
|
+
const stream = fs.createWriteStream(minioFilePath);
|
|
997
|
+
response.pipe(stream);
|
|
998
|
+
stream.on('finish', function () {
|
|
999
|
+
stream.close(() => {
|
|
1000
|
+
fs.mkdirSync(minioMetaDataFolderPath, { recursive: true });
|
|
1001
|
+
fs.writeFileSync(`${minioMetaDataFolderPath}/fs.json`, fsFileContent);
|
|
1002
|
+
console.log(`Copy completed for ${url}`);
|
|
1003
|
+
const newUrlPath = `${minioBaseUrlPath}/${bucket}/${filename}`;
|
|
1004
|
+
resolve(newUrlPath);
|
|
1005
|
+
});
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
else {
|
|
1009
|
+
reject("Can't find url to download");
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
catch (error) {
|
|
1014
|
+
reject(error);
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
(async () => {
|
|
1019
|
+
console.log("Setup ids to keep");
|
|
1020
|
+
await setupIdsToKeep();
|
|
1021
|
+
//await deleteAll();
|
|
1022
|
+
await copyAllToMinio();
|
|
1023
|
+
console.log(`Destroying all except domain id ${domainIdToKeep} completed`);
|
|
1024
|
+
process.exit();
|
|
1025
|
+
})();
|
|
1026
|
+
export {};
|