@yrpri/api 9.0.103 → 9.0.105
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 -2
- 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,491 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var models = require('../models/index.cjs');
|
|
3
|
-
var async = require('async');
|
|
4
|
-
var _ = require('lodash');
|
|
5
|
-
const moment = require('moment');
|
|
6
|
-
var hostName;
|
|
7
|
-
var skipEmail = false;
|
|
8
|
-
const getPostUrl = function (post, hostname) {
|
|
9
|
-
if (hostName) {
|
|
10
|
-
return 'https://' + hostName + '/post/' + post.id;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
return "https://yrpri.org/post/" + post.id;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const getUserEmail = function (post) {
|
|
17
|
-
if (skipEmail) {
|
|
18
|
-
return "hidden";
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return post.User.email;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const clean = function (text) {
|
|
25
|
-
//console.log("Before: "+ text);
|
|
26
|
-
var newText = text.replace('"', "'").replace('\n', '').replace('\r', '').replace(/(\r\n|\n|\r)/gm, "").replace(/"/gm, "'").replace(/,/, ';').trim();
|
|
27
|
-
//console.log("After:" + newText);
|
|
28
|
-
return newText.replace(/´/g, '');
|
|
29
|
-
};
|
|
30
|
-
const cleanDescription = function (text) {
|
|
31
|
-
//console.log("Before: "+ text);
|
|
32
|
-
var newText = text.replace('"', "'").replace(/"/gm, "'").replace(/,/, ';').trim();
|
|
33
|
-
//console.log("After:" + newText);
|
|
34
|
-
return newText.replace(/´/g, '');
|
|
35
|
-
};
|
|
36
|
-
const getLocation = function (post) {
|
|
37
|
-
if (post.location && post.location.latitude && post.location.longitude &&
|
|
38
|
-
post.location.latitude != "" && post.location.longitude != "") {
|
|
39
|
-
return post.location.latitude + ',' + post.location.longitude;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
return '"",""';
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const getPoints = function (points) {
|
|
46
|
-
var totalContent = "";
|
|
47
|
-
_.each(points, function (point) {
|
|
48
|
-
var content = clean(point.content) + "\n\n";
|
|
49
|
-
if (content.startsWith(",")) {
|
|
50
|
-
content = content.substr(1);
|
|
51
|
-
}
|
|
52
|
-
//console.log("content: "+content);
|
|
53
|
-
totalContent += content;
|
|
54
|
-
});
|
|
55
|
-
return totalContent;
|
|
56
|
-
};
|
|
57
|
-
const getContactData = function (post) {
|
|
58
|
-
if (post.data && post.data.contact && (post.data.contact.name || post.data.contact.email || post.data.contact.telephone)) {
|
|
59
|
-
return `"${post.data.contact.name}","${post.data.contact.email}","${post.data.contact.telephone}"`;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
return ",,";
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const getAttachmentData = function (post) {
|
|
66
|
-
if (post.data && post.data.attachment && post.data.attachment.url) {
|
|
67
|
-
return `"${post.data.attachment.url}","${post.data.attachment.filename}"`;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return ",";
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const getPointsUpOrDown = function (post, value) {
|
|
74
|
-
var pointsText = '"';
|
|
75
|
-
var points = _.filter(post.Points, function (point) {
|
|
76
|
-
if (value > 0) {
|
|
77
|
-
return point.value > 0;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
return point.value < 0;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
pointsText += getPoints(points) + '"';
|
|
84
|
-
if (pointsText.startsWith(",")) {
|
|
85
|
-
pointsText = pointsText.substr(1);
|
|
86
|
-
}
|
|
87
|
-
//console.log("PointText: "+pointsText);
|
|
88
|
-
return pointsText;
|
|
89
|
-
};
|
|
90
|
-
var getPointsUp = function (post) {
|
|
91
|
-
return getPointsUpOrDown(post, 1);
|
|
92
|
-
};
|
|
93
|
-
var getPointsDown = function (post) {
|
|
94
|
-
return getPointsUpOrDown(post, -1);
|
|
95
|
-
};
|
|
96
|
-
var getNewFromUsers = function (post) {
|
|
97
|
-
return "";
|
|
98
|
-
};
|
|
99
|
-
const getImageFormatUrl = function (image, formatId) {
|
|
100
|
-
var formats = JSON.parse(image.formats);
|
|
101
|
-
if (formats && formats.length > 0)
|
|
102
|
-
return formats[formatId];
|
|
103
|
-
else
|
|
104
|
-
return "";
|
|
105
|
-
};
|
|
106
|
-
const getMediaFormatUrl = function (media, formatId) {
|
|
107
|
-
var formats = media.formats;
|
|
108
|
-
if (formats && formats.length > 0)
|
|
109
|
-
return formats[formatId];
|
|
110
|
-
else
|
|
111
|
-
return "";
|
|
112
|
-
};
|
|
113
|
-
const getMediaURLs = function (post) {
|
|
114
|
-
var mediaURLs = "";
|
|
115
|
-
if (post.Points && post.Points.length > 0) {
|
|
116
|
-
_.forEach(post.Points, function (point) {
|
|
117
|
-
if (point.PointVideos && point.PointVideos.length > 0) {
|
|
118
|
-
mediaURLs += _.map(point.PointVideos, function (media) {
|
|
119
|
-
return "" + getMediaFormatUrl(media, 0) + "\n";
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
if (point.PointAudios && point.PointAudios.length > 0) {
|
|
123
|
-
mediaURLs += _.map(point.PointAudios, function (media) {
|
|
124
|
-
return "" + getMediaFormatUrl(media, 0) + "\n";
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
if (post.PostVideos && post.PostVideos.length > 0) {
|
|
130
|
-
mediaURLs += _.map(post.PostVideos, function (media) {
|
|
131
|
-
return "" + getMediaFormatUrl(media, 0) + "\n";
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
if (post.PostAudios && post.PostAudios.length > 0) {
|
|
135
|
-
mediaURLs += _.map(post.PostAudios, function (media) {
|
|
136
|
-
return "" + getMediaFormatUrl(media, 0) + "\n";
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
return '"' + mediaURLs + '"';
|
|
140
|
-
};
|
|
141
|
-
const getMediaTranscripts = function (post) {
|
|
142
|
-
if (post.public_data && post.public_data.transcript && post.public_data.transcript.text) {
|
|
143
|
-
return '"' + post.public_data.transcript.text + '"';
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
return "";
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
const getImages = function (post) {
|
|
150
|
-
var imagesText = "";
|
|
151
|
-
if (post.PostHeaderImages && post.PostHeaderImages.length > 0) {
|
|
152
|
-
imagesText += _.map(post.PostHeaderImages, function (image) {
|
|
153
|
-
return getImageFormatUrl(image, 0) + "\n";
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
if (post.PostUserImages && post.PostUserImages.length > 0) {
|
|
157
|
-
imagesText += _.map(post.PostUserImages, function (image) {
|
|
158
|
-
return getImageFormatUrl(image, 0) + "\n";
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
return '"' + imagesText.replace(/,/g, "") + '"';
|
|
162
|
-
};
|
|
163
|
-
const getCategory = function (post) {
|
|
164
|
-
if (post.Category) {
|
|
165
|
-
return post.Category.name;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
return "";
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
const getRatingHeaders = (customRatings) => {
|
|
172
|
-
let out = "";
|
|
173
|
-
if (customRatings && customRatings.length > 0) {
|
|
174
|
-
customRatings.forEach((rating) => {
|
|
175
|
-
out += ',"' + rating.name + ' count"';
|
|
176
|
-
out += ',"' + rating.name + ' average"';
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
return out;
|
|
180
|
-
};
|
|
181
|
-
const getPostRatings = (customRatings, postRatings) => {
|
|
182
|
-
let out = "";
|
|
183
|
-
if (customRatings && customRatings.length > 0) {
|
|
184
|
-
customRatings.forEach((rating, index) => {
|
|
185
|
-
out += ',' + (postRatings && postRatings[index] ? postRatings[index].count : '0');
|
|
186
|
-
out += ',' + (postRatings && postRatings[index] && postRatings[index].averageRating ? postRatings[index].averageRating : '0');
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
return out;
|
|
190
|
-
};
|
|
191
|
-
const getDescriptionColumns = (group, post) => {
|
|
192
|
-
if (group && group.configuration && group.configuration.structuredQuestions && group.configuration.structuredQuestions !== "") {
|
|
193
|
-
var structuredAnswers = [];
|
|
194
|
-
var questionComponents = group.configuration.structuredQuestions.split(",");
|
|
195
|
-
for (var i = 0; i < questionComponents.length; i += 2) {
|
|
196
|
-
var question = questionComponents[i];
|
|
197
|
-
var maxLength = questionComponents[i + 1];
|
|
198
|
-
structuredAnswers.push({
|
|
199
|
-
translatedContent: question,
|
|
200
|
-
question: question,
|
|
201
|
-
maxLength: maxLength, value: ""
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
if (post.public_data && post.public_data.structuredAnswers && post.public_data.structuredAnswers !== "") {
|
|
205
|
-
var answers = post.public_data.structuredAnswers.split("%!#x");
|
|
206
|
-
for (i = 0; i < answers.length; i += 1) {
|
|
207
|
-
if (structuredAnswers[i])
|
|
208
|
-
structuredAnswers[i].value = answers[i];
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
structuredAnswers[0].value = post.description;
|
|
213
|
-
}
|
|
214
|
-
let columnsString = '';
|
|
215
|
-
structuredAnswers.forEach((question) => {
|
|
216
|
-
if (question.value) {
|
|
217
|
-
columnsString += '"' + question.value + '",';
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
columnsString += '"",';
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
return columnsString.substring(0, columnsString.length - 1);
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
return '"' + post.description + '"';
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
const getDescriptionHeaders = (group) => {
|
|
230
|
-
if (group && group.configuration.structuredQuestions && group.configuration.structuredQuestions !== "") {
|
|
231
|
-
var structuredQuestions = [];
|
|
232
|
-
var questionComponents = group.configuration.structuredQuestions.split(",");
|
|
233
|
-
for (var i = 0; i < questionComponents.length; i += 2) {
|
|
234
|
-
var question = questionComponents[i];
|
|
235
|
-
var maxLength = questionComponents[i + 1];
|
|
236
|
-
structuredQuestions.push({
|
|
237
|
-
translatedContent: question,
|
|
238
|
-
question: question,
|
|
239
|
-
maxLength: maxLength, value: ""
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
let columnsString = '';
|
|
243
|
-
structuredQuestions.forEach((question) => {
|
|
244
|
-
columnsString += '"' + question.translatedContent + '",';
|
|
245
|
-
});
|
|
246
|
-
return columnsString.substring(0, columnsString.length - 1);
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
return "Description";
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
const getGroupPosts = (group, hostName, callback) => {
|
|
253
|
-
models.Post.unscoped().findAll({
|
|
254
|
-
where: {
|
|
255
|
-
group_id: group.id
|
|
256
|
-
},
|
|
257
|
-
attributes: ['id', 'counter_endorsements_down', 'counter_endorsements_up', 'counter_points', 'public_data', 'name', 'description', 'language', 'location', 'data'],
|
|
258
|
-
order: [
|
|
259
|
-
['created_at', 'asc']
|
|
260
|
-
],
|
|
261
|
-
include: [
|
|
262
|
-
{
|
|
263
|
-
model: models.Category,
|
|
264
|
-
required: false
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
model: models.Group,
|
|
268
|
-
attributes: ['id', 'configuration'],
|
|
269
|
-
required: true
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
model: models.PostRevision,
|
|
273
|
-
required: false
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
model: models.Point,
|
|
277
|
-
attributes: ['id', 'content', 'value', 'language', 'public_data'],
|
|
278
|
-
required: false,
|
|
279
|
-
include: [
|
|
280
|
-
{
|
|
281
|
-
model: models.Audio,
|
|
282
|
-
as: 'PointAudios',
|
|
283
|
-
attributes: ['id', 'public_meta', 'formats'],
|
|
284
|
-
required: false
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
model: models.PointRevision,
|
|
288
|
-
required: true,
|
|
289
|
-
attributes: ['id', 'content']
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
model: models.Video,
|
|
293
|
-
as: 'PointVideos',
|
|
294
|
-
attributes: ['id', 'public_meta', 'formats'],
|
|
295
|
-
required: false
|
|
296
|
-
}
|
|
297
|
-
]
|
|
298
|
-
},
|
|
299
|
-
{ model: models.Image,
|
|
300
|
-
as: 'PostHeaderImages',
|
|
301
|
-
required: false
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
model: models.User,
|
|
305
|
-
required: true
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
model: models.Audio,
|
|
309
|
-
as: 'PostAudios',
|
|
310
|
-
attributes: ['id', 'public_meta', 'formats'],
|
|
311
|
-
required: false
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
model: models.Video,
|
|
315
|
-
as: 'PostVideos',
|
|
316
|
-
attributes: ['id', 'public_meta', 'formats'],
|
|
317
|
-
required: false
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
model: models.Image,
|
|
321
|
-
as: 'PostUserImages',
|
|
322
|
-
required: false,
|
|
323
|
-
where: {
|
|
324
|
-
deleted: false
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
]
|
|
328
|
-
}).then(function (posts) {
|
|
329
|
-
let categories = [];
|
|
330
|
-
posts.forEach((post) => {
|
|
331
|
-
if (post.Category) {
|
|
332
|
-
categories.push(post.Category.name);
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
categories = _.uniq(categories);
|
|
336
|
-
callback(posts, null, categories);
|
|
337
|
-
}).catch(function (error) {
|
|
338
|
-
callback(null, error);
|
|
339
|
-
});
|
|
340
|
-
};
|
|
341
|
-
var getExportFileDataForGroup = function (group, hostName, callback) {
|
|
342
|
-
getGroupPosts(group, hostName, (posts, error) => {
|
|
343
|
-
if (error) {
|
|
344
|
-
callback(error);
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
var outFileContent = "";
|
|
348
|
-
let customRatings;
|
|
349
|
-
if (group.configuration && group.configuration.customRatings) {
|
|
350
|
-
customRatings = group.configuration.customRatings;
|
|
351
|
-
}
|
|
352
|
-
//console.log(posts.length);
|
|
353
|
-
outFileContent += "Nr, Post id,email,User Name,Post Name," + getDescriptionHeaders(group) + ",Url,Category,Latitude,Longitude,Up Votes,Down Votes,Points Count,Points For,Points Against,Images,Contact Name,Contact Email,Contact telephone,Attachment URL,Attachment filename,Media URLs,Post transcript" + getRatingHeaders(customRatings) + "\n";
|
|
354
|
-
let postCounter = 0;
|
|
355
|
-
async.eachSeries(posts, function (post, seriesCallback) {
|
|
356
|
-
postCounter += 1;
|
|
357
|
-
if (!post.deleted) {
|
|
358
|
-
const postRatings = (post.public_data && post.public_data.ratings) ? post.public_data.ratings : null;
|
|
359
|
-
outFileContent += postCounter + ',' + post.id + ',"' + getUserEmail(post) + '","' + post.User.name +
|
|
360
|
-
'","' + clean(post.name) + '",' + getDescriptionColumns(group, post) + ',' +
|
|
361
|
-
'"' + getPostUrl(post) + '",' + '"' + getCategory(post) + '",' +
|
|
362
|
-
getLocation(post) + ',' + post.counter_endorsements_up + ',' + post.counter_endorsements_down +
|
|
363
|
-
',' + post.counter_points + ',' + getPointsUp(post) + ',' + getPointsDown(post) + ',' +
|
|
364
|
-
getImages(post) + ',' +
|
|
365
|
-
getContactData(post) + ',' +
|
|
366
|
-
getAttachmentData(post) + ',' +
|
|
367
|
-
getMediaURLs(post) + ',' +
|
|
368
|
-
getMediaTranscripts(post) +
|
|
369
|
-
getPostRatings(customRatings, postRatings) + '\n';
|
|
370
|
-
}
|
|
371
|
-
else {
|
|
372
|
-
outFileContent += postCounter + ',' + post.id + ',DELETED,,,,,,,,,,,\n';
|
|
373
|
-
}
|
|
374
|
-
seriesCallback();
|
|
375
|
-
}, function (error) {
|
|
376
|
-
if (error) {
|
|
377
|
-
callback(error);
|
|
378
|
-
}
|
|
379
|
-
else {
|
|
380
|
-
callback(null, outFileContent);
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
};
|
|
386
|
-
const getLoginsExportDataForCommunity = (communityId, hostName, callback) => {
|
|
387
|
-
let outFileContent = "Date, User id, Name, Email, Method, Department\n";
|
|
388
|
-
models.AcActivity.findAll({
|
|
389
|
-
where: {
|
|
390
|
-
type: 'activity.user.login',
|
|
391
|
-
community_id: communityId
|
|
392
|
-
},
|
|
393
|
-
order: [['created_at', 'DESC']],
|
|
394
|
-
attributes: ['object', 'created_at'],
|
|
395
|
-
include: [
|
|
396
|
-
{
|
|
397
|
-
model: models.User,
|
|
398
|
-
attributes: ['id', 'email', 'name']
|
|
399
|
-
}
|
|
400
|
-
]
|
|
401
|
-
}).then((activities) => {
|
|
402
|
-
async.eachSeries(activities, (activity, seriesCallback) => {
|
|
403
|
-
const date = moment(activity.created_at).format("DD/MM/YY HH:mm");
|
|
404
|
-
outFileContent += date + "," + activity.User.id + ',"' + activity.User.name + '",' + activity.User.email + "," + activity.object.loginType + "," + activity.object.userDepartment + "\n";
|
|
405
|
-
seriesCallback();
|
|
406
|
-
}, (error) => {
|
|
407
|
-
callback(error, outFileContent);
|
|
408
|
-
});
|
|
409
|
-
}).catch((error) => {
|
|
410
|
-
callback(error);
|
|
411
|
-
});
|
|
412
|
-
};
|
|
413
|
-
const getUsersForCommunity = (communityId, callback) => {
|
|
414
|
-
let outFileContent = "User id, Name, Email, Ssn\n";
|
|
415
|
-
models.Community.findOne({
|
|
416
|
-
where: {
|
|
417
|
-
id: communityId
|
|
418
|
-
},
|
|
419
|
-
attributes: ['id'],
|
|
420
|
-
include: [
|
|
421
|
-
{
|
|
422
|
-
model: models.User,
|
|
423
|
-
attributes: ['id', 'email', 'name', 'ssn'],
|
|
424
|
-
as: "CommunityUsers"
|
|
425
|
-
}
|
|
426
|
-
]
|
|
427
|
-
}).then((community) => {
|
|
428
|
-
async.eachSeries(community.CommunityUsers, (user, seriesCallback) => {
|
|
429
|
-
if (!user.ssn)
|
|
430
|
-
user.ssn = "";
|
|
431
|
-
if (!user.email)
|
|
432
|
-
user.email = "";
|
|
433
|
-
outFileContent += user.id + ',"' + user.name + '",' + user.email + "," + user.ssn + "\n";
|
|
434
|
-
seriesCallback();
|
|
435
|
-
}, (error) => {
|
|
436
|
-
callback(error, outFileContent);
|
|
437
|
-
});
|
|
438
|
-
}).catch((error) => {
|
|
439
|
-
callback(error);
|
|
440
|
-
});
|
|
441
|
-
};
|
|
442
|
-
const getLoginsExportDataForDomain = (domainId, hostName, callback) => {
|
|
443
|
-
let outFileContent = "Date, User id, Name, Email, Method, Department\n";
|
|
444
|
-
models.AcActivity.findAll({
|
|
445
|
-
where: {
|
|
446
|
-
type: 'activity.user.login',
|
|
447
|
-
domain_id: domainId
|
|
448
|
-
},
|
|
449
|
-
order: [['created_at', 'DESC']],
|
|
450
|
-
attributes: ['object', 'created_at'],
|
|
451
|
-
include: [
|
|
452
|
-
{
|
|
453
|
-
model: models.User,
|
|
454
|
-
attributes: ['id', 'email', 'name']
|
|
455
|
-
}
|
|
456
|
-
]
|
|
457
|
-
}).then((activities) => {
|
|
458
|
-
async.eachSeries(activities, (activity, seriesCallback) => {
|
|
459
|
-
const date = moment(activity.created_at).format("DD/MM/YY HH:mm");
|
|
460
|
-
outFileContent += date + "," + activity.User.id + ',"' + activity.User.name + '",' + activity.User.email + "," + activity.object.loginType + "," + activity.object.userDepartment + "\n";
|
|
461
|
-
seriesCallback();
|
|
462
|
-
}, (error) => {
|
|
463
|
-
callback(error, outFileContent);
|
|
464
|
-
});
|
|
465
|
-
}).catch((error) => {
|
|
466
|
-
callback(error);
|
|
467
|
-
});
|
|
468
|
-
};
|
|
469
|
-
module.exports = {
|
|
470
|
-
getExportFileDataForGroup: getExportFileDataForGroup,
|
|
471
|
-
getLoginsExportDataForCommunity: getLoginsExportDataForCommunity,
|
|
472
|
-
getLoginsExportDataForDomain: getLoginsExportDataForDomain,
|
|
473
|
-
getGroupPosts: getGroupPosts,
|
|
474
|
-
getUsersForCommunity,
|
|
475
|
-
getDescriptionHeaders,
|
|
476
|
-
getPostUrl,
|
|
477
|
-
getCategory,
|
|
478
|
-
getImages,
|
|
479
|
-
clean,
|
|
480
|
-
getDescriptionColumns,
|
|
481
|
-
getPointsDown,
|
|
482
|
-
getPointsUp,
|
|
483
|
-
getUserEmail,
|
|
484
|
-
getRatingHeaders,
|
|
485
|
-
getContactData,
|
|
486
|
-
getLocation,
|
|
487
|
-
getAttachmentData,
|
|
488
|
-
getMediaURLs,
|
|
489
|
-
getMediaTranscripts,
|
|
490
|
-
getPostRatings
|
|
491
|
-
};
|
package/dist/utils/i18n.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var i18n = require('i18next');
|
|
3
|
-
var Backend = require('i18next-fs-backend');
|
|
4
|
-
i18n
|
|
5
|
-
.use(Backend)
|
|
6
|
-
.init({
|
|
7
|
-
// this is the defaults
|
|
8
|
-
backend: {
|
|
9
|
-
// path where resources get loaded from
|
|
10
|
-
loadPath: '../locales/{{lng}}/translation.json',
|
|
11
|
-
// path to post missing resources
|
|
12
|
-
addPath: '../locales/{{lng}}/translation.missing.json',
|
|
13
|
-
// jsonIndent to use when storing json files
|
|
14
|
-
jsonIndent: 2
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
module.exports = i18n;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const isValidDbId = (dbId) => {
|
|
3
|
-
if (dbId) {
|
|
4
|
-
try {
|
|
5
|
-
if (typeof dbId === "string" && dbId.indexOf(".") > -1) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
const id = parseInt(dbId);
|
|
10
|
-
if (id) {
|
|
11
|
-
return Number.isInteger(id);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
module.exports = {
|
|
27
|
-
isValidDbId
|
|
28
|
-
};
|
package/dist/utils/logger.cjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var bunyan = require('bunyan');
|
|
3
|
-
var PrettyStream = require('bunyan-prettystream');
|
|
4
|
-
var logger;
|
|
5
|
-
if (process.env.USE_BUNYAN_LOGGER && process.env.NODE_ENV !== 'production') {
|
|
6
|
-
var prettyStdOut = new PrettyStream();
|
|
7
|
-
prettyStdOut.pipe(process.stdout);
|
|
8
|
-
logger = bunyan.createLogger({
|
|
9
|
-
name: 'yrpri',
|
|
10
|
-
streams: [{
|
|
11
|
-
level: 'debug',
|
|
12
|
-
type: 'raw',
|
|
13
|
-
stream: prettyStdOut
|
|
14
|
-
}]
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
if (process.env.USE_BUNYAN_LOGGER) {
|
|
19
|
-
logger = bunyan.createLogger({ name: "your-priorities" });
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
logger = console;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
module.exports = logger;
|
package/dist/utils/loggerTs.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as bunyan from 'bunyan';
|
|
2
|
-
import PrettyStream from 'bunyan-prettystream';
|
|
3
|
-
let logger;
|
|
4
|
-
if (process.env.USE_BUNYAN_LOGGER && process.env.NODE_ENV !== 'production') {
|
|
5
|
-
const prettyStdOut = new PrettyStream();
|
|
6
|
-
prettyStdOut.pipe(process.stdout);
|
|
7
|
-
logger = bunyan.createLogger({
|
|
8
|
-
name: 'yrpri',
|
|
9
|
-
streams: [{
|
|
10
|
-
level: 'debug',
|
|
11
|
-
type: 'raw',
|
|
12
|
-
stream: prettyStdOut
|
|
13
|
-
}]
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
if (process.env.USE_BUNYAN_LOGGER) {
|
|
18
|
-
logger = bunyan.createLogger({ name: "your-priorities" });
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
// If you don't want to use any logger, you can assign 'console' to 'logger'.
|
|
22
|
-
// However, you need to cast it to any as 'console' and 'bunyan' have different types.
|
|
23
|
-
logger = console;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export default logger;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var models = require("../models/index.cjs");
|
|
3
|
-
var _ = require("lodash");
|
|
4
|
-
var async = require('async');
|
|
5
|
-
var setupIconsFromDefault = function (callback) {
|
|
6
|
-
const icons = [
|
|
7
|
-
{
|
|
8
|
-
"src": "/images/manifest_yp/icon-192x192.png",
|
|
9
|
-
"sizes": "192x192",
|
|
10
|
-
"type": "image/png"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"src": "/images/manifest_yp/icon-512x512.png",
|
|
14
|
-
"sizes": "512x512",
|
|
15
|
-
"type": "image/png"
|
|
16
|
-
}
|
|
17
|
-
];
|
|
18
|
-
callback(null, icons);
|
|
19
|
-
};
|
|
20
|
-
var setupIconsFromImage = function (imageId, callback) {
|
|
21
|
-
var icons = [];
|
|
22
|
-
models.Image.findOne({
|
|
23
|
-
where: {
|
|
24
|
-
id: imageId
|
|
25
|
-
}
|
|
26
|
-
}).then(function (image) {
|
|
27
|
-
if (!image) {
|
|
28
|
-
callback("generateManifest: Can't find image from imageId");
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
var formats = JSON.parse(image.formats);
|
|
32
|
-
[512, 384, 256, 192, 180, 152, 144, 96, 48].forEach(function (size, index) {
|
|
33
|
-
var stringSize = size.toString();
|
|
34
|
-
icons.push({
|
|
35
|
-
"src": formats[index],
|
|
36
|
-
"type": "image/png",
|
|
37
|
-
"sizes": stringSize + "x" + stringSize
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
callback(null, icons);
|
|
41
|
-
}
|
|
42
|
-
}).catch(function (error, results) {
|
|
43
|
-
callback(error, results);
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
var generateManifest = function (req, res) {
|
|
47
|
-
var manifest = {
|
|
48
|
-
"display": "standalone",
|
|
49
|
-
"start_url": "/?utm_source=web_app_manifest",
|
|
50
|
-
"theme_color": "#103458",
|
|
51
|
-
"background_color": "#ffffff",
|
|
52
|
-
"orientation": "any"
|
|
53
|
-
};
|
|
54
|
-
var shortName, name;
|
|
55
|
-
async.series([
|
|
56
|
-
function (seriesCallback) {
|
|
57
|
-
if (req.ypCommunity && req.ypCommunity.configuration &&
|
|
58
|
-
req.ypCommunity.configuration.appHomeScreenIconImageId) {
|
|
59
|
-
setupIconsFromImage(req.ypCommunity.configuration.appHomeScreenIconImageId, seriesCallback);
|
|
60
|
-
}
|
|
61
|
-
else if (req.ypDomain && req.ypDomain.configuration &&
|
|
62
|
-
req.ypDomain.configuration.appHomeScreenIconImageId) {
|
|
63
|
-
setupIconsFromImage(req.ypDomain.configuration.appHomeScreenIconImageId, seriesCallback);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
setupIconsFromDefault(seriesCallback);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
], function (error, iconsResults) {
|
|
70
|
-
if (error) {
|
|
71
|
-
log.error("Error from generating manifest data", { err: error });
|
|
72
|
-
res.status(500).end();
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
manifest["icons"] = iconsResults[0];
|
|
76
|
-
if (req.ypCommunity.id && req.ypCommunity.configuration &&
|
|
77
|
-
req.ypCommunity.configuration.appHomeScreenShortName) {
|
|
78
|
-
manifest['short_name'] = req.ypCommunity.configuration.appHomeScreenShortName;
|
|
79
|
-
}
|
|
80
|
-
else if (req.ypDomain && req.ypDomain.configuration &&
|
|
81
|
-
req.ypDomain.configuration.appHomeScreenShortName) {
|
|
82
|
-
manifest['short_name'] = req.ypDomain.configuration.appHomeScreenShortName;
|
|
83
|
-
}
|
|
84
|
-
else if (req.ypCommunity.id) {
|
|
85
|
-
manifest['short_name'] = req.ypCommunity.name;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
manifest['short_name'] = req.ypDomain.name;
|
|
89
|
-
}
|
|
90
|
-
if (req.ypCommunity.id) {
|
|
91
|
-
manifest["name"] = req.ypCommunity.name;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
manifest["name"] = req.ypDomain.name;
|
|
95
|
-
}
|
|
96
|
-
if (manifest['short_name'] && manifest['short_name'].length > 12) {
|
|
97
|
-
manifest['short_name'] = manifest['short_name'].substring(0, 12);
|
|
98
|
-
}
|
|
99
|
-
res.header('Content-Type', 'application/json');
|
|
100
|
-
res.send(manifest);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
module.exports = generateManifest;
|