vidspotai-shared 1.0.82-dev.0 → 1.0.83
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/lib/globals/aiModels/enums.d.ts +11 -1
- package/lib/globals/aiModels/enums.d.ts.map +1 -1
- package/lib/globals/aiModels/enums.js +24 -1
- package/lib/globals/aiModels/index.d.ts.map +1 -1
- package/lib/globals/aiModels/index.js +2 -0
- package/lib/globals/aiModels/providers/anthropic.d.ts +12 -0
- package/lib/globals/aiModels/providers/anthropic.d.ts.map +1 -0
- package/lib/globals/aiModels/providers/anthropic.js +88 -0
- package/lib/globals/aiModels/providers/google.d.ts.map +1 -1
- package/lib/globals/aiModels/providers/google.js +115 -10
- package/lib/globals/aiModels/providers/openai.d.ts.map +1 -1
- package/lib/globals/aiModels/providers/openai.js +63 -4
- package/lib/globals/aiModels/tierHelpers.d.ts +12 -0
- package/lib/globals/aiModels/tierHelpers.d.ts.map +1 -1
- package/lib/globals/aiModels/tierHelpers.js +83 -0
- package/lib/globals/aiModels/types.d.ts +19 -0
- package/lib/globals/aiModels/types.d.ts.map +1 -1
- package/lib/globals/types.d.ts +120 -1
- package/lib/globals/types.d.ts.map +1 -1
- package/lib/globals/types.js +135 -1
- package/lib/models/agent.model.d.ts +41 -1
- package/lib/models/agent.model.d.ts.map +1 -1
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.d.ts.map +1 -1
- package/lib/models/index.js +1 -0
- package/lib/models/social.model.d.ts +180 -0
- package/lib/models/social.model.d.ts.map +1 -0
- package/lib/models/social.model.js +2 -0
- package/lib/models/user.model.d.ts +10 -0
- package/lib/models/user.model.d.ts.map +1 -1
- package/lib/models/video.model.d.ts +6 -0
- package/lib/models/video.model.d.ts.map +1 -1
- package/lib/schemas/brief.schema.d.ts +46 -0
- package/lib/schemas/brief.schema.d.ts.map +1 -1
- package/lib/schemas/brief.schema.js +72 -1
- package/lib/schemas/index.d.ts +1 -0
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +1 -0
- package/lib/schemas/project.schema.d.ts +70 -3
- package/lib/schemas/project.schema.d.ts.map +1 -1
- package/lib/schemas/project.schema.js +12 -0
- package/lib/schemas/social.schema.d.ts +91 -0
- package/lib/schemas/social.schema.d.ts.map +1 -0
- package/lib/schemas/social.schema.js +114 -0
- package/lib/schemas/videoPlan.schema.d.ts +117 -3
- package/lib/schemas/videoPlan.schema.d.ts.map +1 -1
- package/lib/schemas/videoPlan.schema.js +141 -1
- package/lib/services/agent/chatAgent.d.ts +25 -1
- package/lib/services/agent/chatAgent.d.ts.map +1 -1
- package/lib/services/agent/chatAgent.js +145 -9
- package/lib/services/agent/costPreflight.d.ts +11 -1
- package/lib/services/agent/costPreflight.d.ts.map +1 -1
- package/lib/services/agent/costPreflight.js +18 -1
- package/lib/services/agent/covers/coverPlanner.d.ts +41 -0
- package/lib/services/agent/covers/coverPlanner.d.ts.map +1 -0
- package/lib/services/agent/covers/coverPlanner.js +278 -0
- package/lib/services/agent/covers/covers.schema.d.ts +158 -0
- package/lib/services/agent/covers/covers.schema.d.ts.map +1 -0
- package/lib/services/agent/covers/covers.schema.js +166 -0
- package/lib/services/agent/covers/index.d.ts +3 -0
- package/lib/services/agent/covers/index.d.ts.map +1 -0
- package/lib/services/agent/covers/index.js +18 -0
- package/lib/services/agent/critic.d.ts +10 -0
- package/lib/services/agent/critic.d.ts.map +1 -1
- package/lib/services/agent/critic.js +37 -1
- package/lib/services/agent/editClassifier.d.ts +4 -4
- package/lib/services/agent/editClassifier.js +2 -2
- package/lib/services/agent/editExisting/editAssembler.d.ts +78 -0
- package/lib/services/agent/editExisting/editAssembler.d.ts.map +1 -0
- package/lib/services/agent/editExisting/editAssembler.js +172 -0
- package/lib/services/agent/editExisting/editExisting.schema.d.ts +119 -0
- package/lib/services/agent/editExisting/editExisting.schema.d.ts.map +1 -0
- package/lib/services/agent/editExisting/editExisting.schema.js +157 -0
- package/lib/services/agent/editExisting/highlightPicker.d.ts +48 -0
- package/lib/services/agent/editExisting/highlightPicker.d.ts.map +1 -0
- package/lib/services/agent/editExisting/highlightPicker.js +199 -0
- package/lib/services/agent/editExisting/index.d.ts +4 -0
- package/lib/services/agent/editExisting/index.d.ts.map +1 -0
- package/lib/services/agent/editExisting/index.js +19 -0
- package/lib/services/agent/eval/recorder.d.ts +13 -1
- package/lib/services/agent/eval/recorder.d.ts.map +1 -1
- package/lib/services/agent/eval/recorder.js +59 -0
- package/lib/services/agent/eval/seedBriefs.d.ts +4 -3
- package/lib/services/agent/eval/seedBriefs.d.ts.map +1 -1
- package/lib/services/agent/eval/seedBriefs.js +283 -3
- package/lib/services/agent/eval/types.d.ts +10 -0
- package/lib/services/agent/eval/types.d.ts.map +1 -1
- package/lib/services/agent/executor/core.d.ts +70 -0
- package/lib/services/agent/executor/core.d.ts.map +1 -0
- package/lib/services/agent/executor/core.js +250 -0
- package/lib/services/agent/executor/duration.d.ts +20 -0
- package/lib/services/agent/executor/duration.d.ts.map +1 -0
- package/lib/services/agent/executor/duration.js +46 -0
- package/lib/services/agent/executor/index.d.ts +15 -0
- package/lib/services/agent/executor/index.d.ts.map +1 -0
- package/lib/services/agent/executor/index.js +32 -0
- package/lib/services/agent/executor/types.d.ts +183 -0
- package/lib/services/agent/executor/types.d.ts.map +1 -0
- package/lib/services/agent/executor/types.js +29 -0
- package/lib/services/agent/executor/visual.d.ts +32 -0
- package/lib/services/agent/executor/visual.d.ts.map +1 -0
- package/lib/services/agent/executor/visual.js +400 -0
- package/lib/services/agent/executor/voice.d.ts +17 -0
- package/lib/services/agent/executor/voice.d.ts.map +1 -0
- package/lib/services/agent/executor/voice.js +119 -0
- package/lib/services/agent/extendChain.d.ts +101 -0
- package/lib/services/agent/extendChain.d.ts.map +1 -0
- package/lib/services/agent/extendChain.js +177 -0
- package/lib/services/agent/index.d.ts +11 -1
- package/lib/services/agent/index.d.ts.map +1 -1
- package/lib/services/agent/index.js +11 -1
- package/lib/services/agent/llmCaller.d.ts +7 -8
- package/lib/services/agent/llmCaller.d.ts.map +1 -1
- package/lib/services/agent/llmCallerAnthropic.d.ts +44 -31
- package/lib/services/agent/llmCallerAnthropic.d.ts.map +1 -1
- package/lib/services/agent/llmCallerAnthropic.js +135 -60
- package/lib/services/agent/llmCallerFactory.d.ts +34 -0
- package/lib/services/agent/llmCallerFactory.d.ts.map +1 -0
- package/lib/services/agent/llmCallerFactory.js +31 -0
- package/lib/services/agent/llmCallerGemini.d.ts +62 -0
- package/lib/services/agent/llmCallerGemini.d.ts.map +1 -0
- package/lib/services/agent/llmCallerGemini.js +235 -0
- package/lib/services/agent/llmCallerOpenai.d.ts +56 -0
- package/lib/services/agent/llmCallerOpenai.d.ts.map +1 -0
- package/lib/services/agent/llmCallerOpenai.js +230 -0
- package/lib/services/agent/llmCallerRegistry.d.ts.map +1 -1
- package/lib/services/agent/llmCallerRegistry.js +7 -7
- package/lib/services/agent/llmCallerRouting.d.ts +63 -0
- package/lib/services/agent/llmCallerRouting.d.ts.map +1 -0
- package/lib/services/agent/llmCallerRouting.js +124 -0
- package/lib/services/agent/llmModelRegistry.d.ts +59 -0
- package/lib/services/agent/llmModelRegistry.d.ts.map +1 -0
- package/lib/services/agent/llmModelRegistry.js +168 -0
- package/lib/services/agent/llmRetry.d.ts +57 -0
- package/lib/services/agent/llmRetry.d.ts.map +1 -0
- package/lib/services/agent/llmRetry.js +102 -0
- package/lib/services/agent/modelRouter.d.ts +3 -3
- package/lib/services/agent/modelRouter.d.ts.map +1 -1
- package/lib/services/agent/modelRouter.js +27 -13
- package/lib/services/agent/planMutations.d.ts +54 -1
- package/lib/services/agent/planMutations.d.ts.map +1 -1
- package/lib/services/agent/planMutations.js +78 -0
- package/lib/services/agent/planner/Planner.d.ts +0 -17
- package/lib/services/agent/planner/Planner.d.ts.map +1 -1
- package/lib/services/agent/planner/Planner.js +67 -303
- package/lib/services/agent/planner/overlayRegen.d.ts +38 -0
- package/lib/services/agent/planner/overlayRegen.d.ts.map +1 -0
- package/lib/services/agent/planner/overlayRegen.js +145 -0
- package/lib/services/agent/planner/plannerMessages.d.ts +34 -0
- package/lib/services/agent/planner/plannerMessages.d.ts.map +1 -0
- package/lib/services/agent/planner/plannerMessages.js +185 -0
- package/lib/services/agent/planner/promptSections.d.ts +12 -0
- package/lib/services/agent/planner/promptSections.d.ts.map +1 -1
- package/lib/services/agent/planner/promptSections.js +57 -0
- package/lib/services/agent/planner/scriptFirstPlanner.d.ts +35 -0
- package/lib/services/agent/planner/scriptFirstPlanner.d.ts.map +1 -0
- package/lib/services/agent/planner/scriptFirstPlanner.js +140 -0
- package/lib/services/agent/planner/structuralRules.d.ts +10 -0
- package/lib/services/agent/planner/structuralRules.d.ts.map +1 -1
- package/lib/services/agent/planner/structuralRules.js +92 -9
- package/lib/services/agent/planner/validators.d.ts +18 -0
- package/lib/services/agent/planner/validators.d.ts.map +1 -1
- package/lib/services/agent/planner/validators.js +97 -0
- package/lib/services/agent/planner.d.ts +2 -1
- package/lib/services/agent/planner.d.ts.map +1 -1
- package/lib/services/agent/planner.js +5 -1
- package/lib/services/agent/priorProject.d.ts +26 -0
- package/lib/services/agent/priorProject.d.ts.map +1 -0
- package/lib/services/agent/priorProject.js +51 -0
- package/lib/services/agent/providerFallback/chains.d.ts.map +1 -1
- package/lib/services/agent/providerFallback/chains.js +27 -15
- package/lib/services/agent/repurpose/index.d.ts +3 -0
- package/lib/services/agent/repurpose/index.d.ts.map +1 -0
- package/lib/services/agent/repurpose/index.js +18 -0
- package/lib/services/agent/repurpose/repurpose.schema.d.ts +132 -0
- package/lib/services/agent/repurpose/repurpose.schema.d.ts.map +1 -0
- package/lib/services/agent/repurpose/repurpose.schema.js +144 -0
- package/lib/services/agent/repurpose/shortsPicker.d.ts +25 -0
- package/lib/services/agent/repurpose/shortsPicker.d.ts.map +1 -0
- package/lib/services/agent/repurpose/shortsPicker.js +218 -0
- package/lib/services/agent/runHelpers.d.ts +21 -2
- package/lib/services/agent/runHelpers.d.ts.map +1 -1
- package/lib/services/agent/runHelpers.js +71 -2
- package/lib/services/agent/tools/animateImage.tool.d.ts +1 -0
- package/lib/services/agent/tools/animateImage.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/animateImage.tool.js +12 -0
- package/lib/services/agent/tools/chapterOutline.tool.d.ts +42 -0
- package/lib/services/agent/tools/chapterOutline.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/chapterOutline.tool.js +115 -0
- package/lib/services/agent/tools/composeScene.tool.d.ts +65 -2
- package/lib/services/agent/tools/composeScene.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/estimateCost.tool.d.ts +28 -1
- package/lib/services/agent/tools/estimateCost.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/estimateCost.tool.js +55 -7
- package/lib/services/agent/tools/extendVideo.tool.d.ts +26 -0
- package/lib/services/agent/tools/extendVideo.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/extendVideo.tool.js +149 -0
- package/lib/services/agent/tools/generateScript.tool.d.ts +184 -0
- package/lib/services/agent/tools/generateScript.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/generateScript.tool.js +123 -0
- package/lib/services/agent/tools/generateVideo.tool.d.ts +1 -0
- package/lib/services/agent/tools/generateVideo.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/generateVideo.tool.js +20 -1
- package/lib/services/agent/tools/index.d.ts +4 -0
- package/lib/services/agent/tools/index.d.ts.map +1 -1
- package/lib/services/agent/tools/index.js +4 -0
- package/lib/services/agent/tools/matchBrollToScript.tool.d.ts +50 -0
- package/lib/services/agent/tools/matchBrollToScript.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/matchBrollToScript.tool.js +139 -0
- package/lib/services/agent/tools/planVideo.tool.d.ts +57 -1
- package/lib/services/agent/tools/planVideo.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/planVideo.tool.js +3 -3
- package/lib/services/agent/tools/render.tool.d.ts +22 -1
- package/lib/services/agent/tools/render.tool.d.ts.map +1 -1
- package/lib/services/aiGen/aiGenFactory.service.d.ts.map +1 -1
- package/lib/services/aiGen/aiGenFactory.service.js +18 -3
- package/lib/services/aiGen/helpers.d.ts +8 -0
- package/lib/services/aiGen/helpers.d.ts.map +1 -1
- package/lib/services/aiGen/helpers.js +12 -0
- package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts +26 -0
- package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts.map +1 -0
- package/lib/services/aiGen/providers/anthropic/anthropic.service.js +95 -0
- package/lib/services/aiGen/providers/google/google.service.d.ts +25 -1
- package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/google/google.service.js +136 -237
- package/lib/services/aiGen/providers/google/googleApiKeys.d.ts +71 -0
- package/lib/services/aiGen/providers/google/googleApiKeys.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleApiKeys.js +137 -0
- package/lib/services/aiGen/providers/google/googleErrors.d.ts +13 -0
- package/lib/services/aiGen/providers/google/googleErrors.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleErrors.js +102 -0
- package/lib/services/aiGen/providers/google/googleFetch.d.ts +8 -0
- package/lib/services/aiGen/providers/google/googleFetch.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleFetch.js +96 -0
- package/lib/services/aiGen/providers/google/googleKeyPool.d.ts +52 -0
- package/lib/services/aiGen/providers/google/googleKeyPool.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleKeyPool.js +129 -0
- package/lib/services/aiGen/providers/google/googleMusic.d.ts +15 -0
- package/lib/services/aiGen/providers/google/googleMusic.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleMusic.js +77 -0
- package/lib/services/aiGen/providers/kling/kling.service.d.ts +7 -3
- package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/kling/kling.service.js +23 -367
- package/lib/services/aiGen/providers/kling/klingCredits.d.ts +9 -0
- package/lib/services/aiGen/providers/kling/klingCredits.d.ts.map +1 -0
- package/lib/services/aiGen/providers/kling/klingCredits.js +63 -0
- package/lib/services/aiGen/providers/kling/klingRequests.d.ts +32 -0
- package/lib/services/aiGen/providers/kling/klingRequests.d.ts.map +1 -0
- package/lib/services/aiGen/providers/kling/klingRequests.js +194 -0
- package/lib/services/aiGen/providers/kling/klingStatus.d.ts +16 -0
- package/lib/services/aiGen/providers/kling/klingStatus.d.ts.map +1 -0
- package/lib/services/aiGen/providers/kling/klingStatus.js +173 -0
- package/lib/services/aiGen/providers/pixverse/pixverse.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/pixverse/pixverse.service.js +7 -1
- package/lib/services/bullmq.service.d.ts +61 -0
- package/lib/services/bullmq.service.d.ts.map +1 -1
- package/lib/services/bullmq.service.js +124 -2
- package/lib/services/crypto/index.d.ts +2 -0
- package/lib/services/crypto/index.d.ts.map +1 -0
- package/lib/services/crypto/index.js +17 -0
- package/lib/services/crypto/tokenVault.d.ts +47 -0
- package/lib/services/crypto/tokenVault.d.ts.map +1 -0
- package/lib/services/crypto/tokenVault.js +179 -0
- package/lib/services/editor/captionStyleHint.d.ts +3 -0
- package/lib/services/editor/captionStyleHint.d.ts.map +1 -0
- package/lib/services/editor/captionStyleHint.js +112 -0
- package/lib/services/editor/planToProject.d.ts +7 -66
- package/lib/services/editor/planToProject.d.ts.map +1 -1
- package/lib/services/editor/planToProject.helpers.d.ts +40 -0
- package/lib/services/editor/planToProject.helpers.d.ts.map +1 -0
- package/lib/services/editor/planToProject.helpers.js +177 -0
- package/lib/services/editor/planToProject.js +197 -180
- package/lib/services/editor/planToProject.types.d.ts +94 -0
- package/lib/services/editor/planToProject.types.d.ts.map +1 -0
- package/lib/services/editor/planToProject.types.js +2 -0
- package/lib/services/firestore.service.d.ts +5 -0
- package/lib/services/firestore.service.d.ts.map +1 -1
- package/lib/services/firestore.service.js +13 -0
- package/lib/services/index.d.ts +13 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +13 -0
- package/lib/services/promptEnhancer/index.d.ts +18 -0
- package/lib/services/promptEnhancer/index.d.ts.map +1 -0
- package/lib/services/promptEnhancer/index.js +33 -0
- package/lib/services/promptEnhancer/models.d.ts +54 -0
- package/lib/services/promptEnhancer/models.d.ts.map +1 -0
- package/lib/services/promptEnhancer/models.js +37 -0
- package/lib/services/promptEnhancer/profiles/agent.profile.d.ts +14 -0
- package/lib/services/promptEnhancer/profiles/agent.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/agent.profile.js +40 -0
- package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts +13 -0
- package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/avatar.profile.js +40 -0
- package/lib/services/promptEnhancer/profiles/base.d.ts +28 -0
- package/lib/services/promptEnhancer/profiles/base.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/base.js +35 -0
- package/lib/services/promptEnhancer/profiles/image.profile.d.ts +11 -0
- package/lib/services/promptEnhancer/profiles/image.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/image.profile.js +42 -0
- package/lib/services/promptEnhancer/profiles/index.d.ts +12 -0
- package/lib/services/promptEnhancer/profiles/index.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/index.js +33 -0
- package/lib/services/promptEnhancer/profiles/video.profile.d.ts +15 -0
- package/lib/services/promptEnhancer/profiles/video.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/video.profile.js +81 -0
- package/lib/services/promptEnhancer/promptEnhancer.service.d.ts +45 -0
- package/lib/services/promptEnhancer/promptEnhancer.service.d.ts.map +1 -0
- package/lib/services/promptEnhancer/promptEnhancer.service.js +157 -0
- package/lib/services/promptEnhancer/schema.d.ts +19 -0
- package/lib/services/promptEnhancer/schema.d.ts.map +1 -0
- package/lib/services/promptEnhancer/schema.js +43 -0
- package/lib/services/promptEnhancer/types.d.ts +112 -0
- package/lib/services/promptEnhancer/types.d.ts.map +1 -0
- package/lib/services/promptEnhancer/types.js +2 -0
- package/lib/services/rateLimiter/distributedRateLimiter.service.d.ts +60 -5
- package/lib/services/rateLimiter/distributedRateLimiter.service.d.ts.map +1 -1
- package/lib/services/rateLimiter/distributedRateLimiter.service.js +184 -16
- package/lib/services/socialAI/captionGen.d.ts +81 -0
- package/lib/services/socialAI/captionGen.d.ts.map +1 -0
- package/lib/services/socialAI/captionGen.js +206 -0
- package/lib/services/socialAI/hookScore.d.ts +85 -0
- package/lib/services/socialAI/hookScore.d.ts.map +1 -0
- package/lib/services/socialAI/hookScore.js +170 -0
- package/lib/services/socialAI/index.d.ts +3 -0
- package/lib/services/socialAI/index.d.ts.map +1 -0
- package/lib/services/socialAI/index.js +18 -0
- package/lib/services/socialAccounts/index.d.ts +2 -0
- package/lib/services/socialAccounts/index.d.ts.map +1 -0
- package/lib/services/socialAccounts/index.js +17 -0
- package/lib/services/socialAccounts/socialAccountService.d.ts +25 -0
- package/lib/services/socialAccounts/socialAccountService.d.ts.map +1 -0
- package/lib/services/socialAccounts/socialAccountService.js +105 -0
- package/lib/services/socialEngage/factory.d.ts +7 -0
- package/lib/services/socialEngage/factory.d.ts.map +1 -0
- package/lib/services/socialEngage/factory.js +25 -0
- package/lib/services/socialEngage/index.d.ts +6 -0
- package/lib/services/socialEngage/index.d.ts.map +1 -0
- package/lib/services/socialEngage/index.js +21 -0
- package/lib/services/socialEngage/meta.engage.d.ts +17 -0
- package/lib/services/socialEngage/meta.engage.d.ts.map +1 -0
- package/lib/services/socialEngage/meta.engage.js +128 -0
- package/lib/services/socialEngage/metaWebhook.d.ts +50 -0
- package/lib/services/socialEngage/metaWebhook.d.ts.map +1 -0
- package/lib/services/socialEngage/metaWebhook.js +93 -0
- package/lib/services/socialEngage/types.d.ts +72 -0
- package/lib/services/socialEngage/types.d.ts.map +1 -0
- package/lib/services/socialEngage/types.js +10 -0
- package/lib/services/socialEngage/youtube.engage.d.ts +9 -0
- package/lib/services/socialEngage/youtube.engage.d.ts.map +1 -0
- package/lib/services/socialEngage/youtube.engage.js +87 -0
- package/lib/services/socialFormat/aspectGeometry.d.ts +74 -0
- package/lib/services/socialFormat/aspectGeometry.d.ts.map +1 -0
- package/lib/services/socialFormat/aspectGeometry.js +135 -0
- package/lib/services/socialFormat/index.d.ts +2 -0
- package/lib/services/socialFormat/index.d.ts.map +1 -0
- package/lib/services/socialFormat/index.js +19 -0
- package/lib/services/socialInsights/index.d.ts +3 -0
- package/lib/services/socialInsights/index.d.ts.map +1 -0
- package/lib/services/socialInsights/index.js +18 -0
- package/lib/services/socialInsights/recommendations.d.ts +131 -0
- package/lib/services/socialInsights/recommendations.d.ts.map +1 -0
- package/lib/services/socialInsights/recommendations.js +277 -0
- package/lib/services/socialInsights/timeBuckets.d.ts +35 -0
- package/lib/services/socialInsights/timeBuckets.d.ts.map +1 -0
- package/lib/services/socialInsights/timeBuckets.js +78 -0
- package/lib/services/socialMetrics/factory.d.ts +5 -0
- package/lib/services/socialMetrics/factory.d.ts.map +1 -0
- package/lib/services/socialMetrics/factory.js +24 -0
- package/lib/services/socialMetrics/index.d.ts +6 -0
- package/lib/services/socialMetrics/index.d.ts.map +1 -0
- package/lib/services/socialMetrics/index.js +21 -0
- package/lib/services/socialMetrics/meta.metrics.d.ts +22 -0
- package/lib/services/socialMetrics/meta.metrics.d.ts.map +1 -0
- package/lib/services/socialMetrics/meta.metrics.js +137 -0
- package/lib/services/socialMetrics/tiktok.metrics.d.ts +8 -0
- package/lib/services/socialMetrics/tiktok.metrics.d.ts.map +1 -0
- package/lib/services/socialMetrics/tiktok.metrics.js +43 -0
- package/lib/services/socialMetrics/types.d.ts +54 -0
- package/lib/services/socialMetrics/types.d.ts.map +1 -0
- package/lib/services/socialMetrics/types.js +2 -0
- package/lib/services/socialMetrics/youtube.metrics.d.ts +8 -0
- package/lib/services/socialMetrics/youtube.metrics.d.ts.map +1 -0
- package/lib/services/socialMetrics/youtube.metrics.js +43 -0
- package/lib/services/socialOAuth/factory.d.ts +7 -0
- package/lib/services/socialOAuth/factory.d.ts.map +1 -0
- package/lib/services/socialOAuth/factory.js +42 -0
- package/lib/services/socialOAuth/index.d.ts +11 -0
- package/lib/services/socialOAuth/index.d.ts.map +1 -0
- package/lib/services/socialOAuth/index.js +26 -0
- package/lib/services/socialOAuth/linkedin.oauth.d.ts +14 -0
- package/lib/services/socialOAuth/linkedin.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/linkedin.oauth.js +127 -0
- package/lib/services/socialOAuth/meta.oauth.d.ts +31 -0
- package/lib/services/socialOAuth/meta.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/meta.oauth.js +214 -0
- package/lib/services/socialOAuth/oauthState.d.ts +14 -0
- package/lib/services/socialOAuth/oauthState.d.ts.map +1 -0
- package/lib/services/socialOAuth/oauthState.js +66 -0
- package/lib/services/socialOAuth/pinterest.oauth.d.ts +15 -0
- package/lib/services/socialOAuth/pinterest.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/pinterest.oauth.js +126 -0
- package/lib/services/socialOAuth/threads.oauth.d.ts +14 -0
- package/lib/services/socialOAuth/threads.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/threads.oauth.js +129 -0
- package/lib/services/socialOAuth/tiktok.oauth.d.ts +15 -0
- package/lib/services/socialOAuth/tiktok.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/tiktok.oauth.js +151 -0
- package/lib/services/socialOAuth/types.d.ts +67 -0
- package/lib/services/socialOAuth/types.d.ts.map +1 -0
- package/lib/services/socialOAuth/types.js +2 -0
- package/lib/services/socialOAuth/x.oauth.d.ts +17 -0
- package/lib/services/socialOAuth/x.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/x.oauth.js +134 -0
- package/lib/services/socialOAuth/youtube.oauth.d.ts +15 -0
- package/lib/services/socialOAuth/youtube.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/youtube.oauth.js +156 -0
- package/lib/services/socialPublish/factory.d.ts +5 -0
- package/lib/services/socialPublish/factory.d.ts.map +1 -0
- package/lib/services/socialPublish/factory.js +32 -0
- package/lib/services/socialPublish/index.d.ts +10 -0
- package/lib/services/socialPublish/index.d.ts.map +1 -0
- package/lib/services/socialPublish/index.js +25 -0
- package/lib/services/socialPublish/linkedin.publish.d.ts +9 -0
- package/lib/services/socialPublish/linkedin.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/linkedin.publish.js +143 -0
- package/lib/services/socialPublish/meta.publish.d.ts +28 -0
- package/lib/services/socialPublish/meta.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/meta.publish.js +149 -0
- package/lib/services/socialPublish/pinterest.publish.d.ts +13 -0
- package/lib/services/socialPublish/pinterest.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/pinterest.publish.js +130 -0
- package/lib/services/socialPublish/threads.publish.d.ts +12 -0
- package/lib/services/socialPublish/threads.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/threads.publish.js +96 -0
- package/lib/services/socialPublish/tiktok.publish.d.ts +13 -0
- package/lib/services/socialPublish/tiktok.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/tiktok.publish.js +118 -0
- package/lib/services/socialPublish/types.d.ts +47 -0
- package/lib/services/socialPublish/types.d.ts.map +1 -0
- package/lib/services/socialPublish/types.js +2 -0
- package/lib/services/socialPublish/x.publish.d.ts +12 -0
- package/lib/services/socialPublish/x.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/x.publish.js +147 -0
- package/lib/services/socialPublish/youtube.publish.d.ts +9 -0
- package/lib/services/socialPublish/youtube.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/youtube.publish.js +107 -0
- package/lib/services/stock/index.d.ts +2 -0
- package/lib/services/stock/index.d.ts.map +1 -0
- package/lib/services/stock/index.js +17 -0
- package/lib/services/stock/realPersonSafety.d.ts +99 -0
- package/lib/services/stock/realPersonSafety.d.ts.map +1 -0
- package/lib/services/stock/realPersonSafety.js +248 -0
- package/lib/services/translation/index.d.ts +2 -0
- package/lib/services/translation/index.d.ts.map +1 -0
- package/lib/services/translation/index.js +9 -0
- package/lib/services/translation/translation.service.d.ts +50 -0
- package/lib/services/translation/translation.service.d.ts.map +1 -0
- package/lib/services/translation/translation.service.js +211 -0
- package/lib/utils/helpers.d.ts +2 -4
- package/lib/utils/helpers.d.ts.map +1 -1
- package/lib/utils/helpers.js +9 -63
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/renderTier.d.ts +26 -0
- package/lib/utils/renderTier.d.ts.map +1 -0
- package/lib/utils/renderTier.js +34 -0
- package/package.json +1 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FacebookMetricsClient = exports.InstagramMetricsClient = void 0;
|
|
4
|
+
const types_1 = require("../../globals/types");
|
|
5
|
+
/**
|
|
6
|
+
* Meta metrics clients — Phase 3. Meta deprecated `impressions` in 2025, so we
|
|
7
|
+
* key analytics on `views`/`reach` (plan §3). Both clients normalize Graph
|
|
8
|
+
* responses into ISocialMetricSnapshot; missing metrics default to 0 (a fresh
|
|
9
|
+
* post may not have all insights populated for 24–72h).
|
|
10
|
+
*
|
|
11
|
+
* Config (env): META_GRAPH_VERSION (optional, default v21.0).
|
|
12
|
+
*/
|
|
13
|
+
const DEFAULT_GRAPH_VERSION = "v21.0";
|
|
14
|
+
function graph(path) {
|
|
15
|
+
const v = process.env.META_GRAPH_VERSION || DEFAULT_GRAPH_VERSION;
|
|
16
|
+
return `https://graph.facebook.com/${v}${path}`;
|
|
17
|
+
}
|
|
18
|
+
function toNum(v) {
|
|
19
|
+
const n = typeof v === "number" ? v : Number(v);
|
|
20
|
+
return Number.isFinite(n) ? n : 0;
|
|
21
|
+
}
|
|
22
|
+
/** Instagram media insights for a published Reel/media. */
|
|
23
|
+
class InstagramMetricsClient {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.provider = types_1.ESocialProvider.INSTAGRAM;
|
|
26
|
+
}
|
|
27
|
+
async fetchPostMetrics({ accessToken, providerPostId, }) {
|
|
28
|
+
const tokenQs = `access_token=${encodeURIComponent(accessToken)}`;
|
|
29
|
+
// like_count / comments_count come from the media object itself.
|
|
30
|
+
const fieldsResp = await fetch(graph(`/${providerPostId}?fields=like_count,comments_count&${tokenQs}`));
|
|
31
|
+
const fields = (await fieldsResp.json());
|
|
32
|
+
if (!fieldsResp.ok || fields.error) {
|
|
33
|
+
throw new Error(`InstagramMetrics: media fields ${fieldsResp.status} ${fields.error?.message ?? ""}`.trim());
|
|
34
|
+
}
|
|
35
|
+
// reach / saves / shares / plays(views) come from the insights edge.
|
|
36
|
+
const snapshot = {
|
|
37
|
+
likes: toNum(fields.like_count),
|
|
38
|
+
comments: toNum(fields.comments_count),
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
const insightsResp = await fetch(graph(`/${providerPostId}/insights?metric=reach,saved,shares,plays&${tokenQs}`));
|
|
42
|
+
const insights = (await insightsResp.json());
|
|
43
|
+
for (const m of insights.data ?? []) {
|
|
44
|
+
const value = toNum(m.values?.[0]?.value);
|
|
45
|
+
switch (m.name) {
|
|
46
|
+
case "reach":
|
|
47
|
+
snapshot.reach = value;
|
|
48
|
+
break;
|
|
49
|
+
case "saved":
|
|
50
|
+
snapshot.saves = value;
|
|
51
|
+
break;
|
|
52
|
+
case "shares":
|
|
53
|
+
snapshot.shares = value;
|
|
54
|
+
break;
|
|
55
|
+
case "plays":
|
|
56
|
+
snapshot.views = value;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Insights can be unavailable for the first hours — counters still ship.
|
|
63
|
+
}
|
|
64
|
+
return snapshot;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* IG audience demographics via the account-level insights edge. Needs a
|
|
68
|
+
* business/creator account with ≥100 followers; otherwise Graph errors and we
|
|
69
|
+
* let the caller degrade to "not supported". `follower_demographics` returns
|
|
70
|
+
* a breakdown keyed by the requested dimension; `follower_count` (lifetime
|
|
71
|
+
* total) comes from the user node.
|
|
72
|
+
*/
|
|
73
|
+
async fetchAudience({ accessToken, providerAccountId, }) {
|
|
74
|
+
const tokenQs = `access_token=${encodeURIComponent(accessToken)}`;
|
|
75
|
+
const audience = {};
|
|
76
|
+
// Lifetime follower total (cheap, almost always available).
|
|
77
|
+
try {
|
|
78
|
+
const resp = await fetch(graph(`/${providerAccountId}?fields=followers_count&${tokenQs}`));
|
|
79
|
+
const json = (await resp.json());
|
|
80
|
+
if (resp.ok && typeof json.followers_count === "number") {
|
|
81
|
+
audience.followerCount = json.followers_count;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Non-fatal — demographics below are the real payload.
|
|
86
|
+
}
|
|
87
|
+
// One demographic_breakdown call per dimension (Graph requires the
|
|
88
|
+
// breakdown param to match a single dimension at a time).
|
|
89
|
+
const dims = [
|
|
90
|
+
{ key: "age", breakdown: "age" },
|
|
91
|
+
{ key: "gender", breakdown: "gender" },
|
|
92
|
+
{ key: "country", breakdown: "country" },
|
|
93
|
+
{ key: "city", breakdown: "city" },
|
|
94
|
+
];
|
|
95
|
+
for (const { key, breakdown } of dims) {
|
|
96
|
+
try {
|
|
97
|
+
const resp = await fetch(graph(`/${providerAccountId}/insights?metric=follower_demographics&period=lifetime&metric_type=total_value&breakdown=${breakdown}&${tokenQs}`));
|
|
98
|
+
const json = (await resp.json());
|
|
99
|
+
const results = json.data?.[0]?.total_value?.breakdowns?.[0]?.results ?? [];
|
|
100
|
+
const buckets = results
|
|
101
|
+
.map((r) => ({
|
|
102
|
+
label: r.dimension_values?.[0] ?? "",
|
|
103
|
+
value: toNum(r.value),
|
|
104
|
+
}))
|
|
105
|
+
.filter((b) => b.label !== "")
|
|
106
|
+
.sort((a, b) => b.value - a.value);
|
|
107
|
+
if (buckets.length > 0) {
|
|
108
|
+
audience[key] = buckets;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Skip any single dimension that errors; others may still resolve.
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return audience;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.InstagramMetricsClient = InstagramMetricsClient;
|
|
119
|
+
/** Facebook Page video metrics via the video object summaries. */
|
|
120
|
+
class FacebookMetricsClient {
|
|
121
|
+
constructor() {
|
|
122
|
+
this.provider = types_1.ESocialProvider.FACEBOOK;
|
|
123
|
+
}
|
|
124
|
+
async fetchPostMetrics({ accessToken, providerPostId, }) {
|
|
125
|
+
const resp = await fetch(graph(`/${providerPostId}?fields=views,likes.summary(true).limit(0),comments.summary(true).limit(0)&access_token=${encodeURIComponent(accessToken)}`));
|
|
126
|
+
const json = (await resp.json());
|
|
127
|
+
if (!resp.ok || json.error) {
|
|
128
|
+
throw new Error(`FacebookMetrics: video fields ${resp.status} ${json.error?.message ?? ""}`.trim());
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
views: toNum(json.views),
|
|
132
|
+
likes: toNum(json.likes?.summary?.total_count),
|
|
133
|
+
comments: toNum(json.comments?.summary?.total_count),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.FacebookMetricsClient = FacebookMetricsClient;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ESocialProvider } from "../../globals/types";
|
|
2
|
+
import { ISocialMetricSnapshot } from "../../models/social.model";
|
|
3
|
+
import { ISocialMetricsClient, MetricsInput } from "./types";
|
|
4
|
+
export declare class TikTokMetricsClient implements ISocialMetricsClient {
|
|
5
|
+
readonly provider = ESocialProvider.TIKTOK;
|
|
6
|
+
fetchPostMetrics(input: MetricsInput): Promise<ISocialMetricSnapshot>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=tiktok.metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiktok.metrics.d.ts","sourceRoot":"","sources":["../../../src/services/socialMetrics/tiktok.metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA8B7D,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D,QAAQ,CAAC,QAAQ,0BAA0B;IAErC,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAuB5E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TikTokMetricsClient = void 0;
|
|
4
|
+
const types_1 = require("../../globals/types");
|
|
5
|
+
/**
|
|
6
|
+
* TikTok metrics client — Phase 6. Queries the Display/Video API for a single
|
|
7
|
+
* video's lifetime counts and normalizes into ISocialMetricSnapshot.
|
|
8
|
+
*
|
|
9
|
+
* POST /v2/video/query/?fields=id,like_count,comment_count,share_count,view_count
|
|
10
|
+
* body: { filters: { video_ids: [providerPostId] } }
|
|
11
|
+
*
|
|
12
|
+
* Requires the `video.list` scope (granted only with business scopes). When the
|
|
13
|
+
* scope is absent the call 403s and the metrics worker logs + reschedules
|
|
14
|
+
* (non-fatal), so this stays best-effort like the other clients.
|
|
15
|
+
*/
|
|
16
|
+
const QUERY_ENDPOINT = "https://open.tiktokapis.com/v2/video/query/?fields=id,like_count,comment_count,share_count,view_count";
|
|
17
|
+
class TikTokMetricsClient {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.provider = types_1.ESocialProvider.TIKTOK;
|
|
20
|
+
}
|
|
21
|
+
async fetchPostMetrics(input) {
|
|
22
|
+
const resp = await fetch(QUERY_ENDPOINT, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: `Bearer ${input.accessToken}`,
|
|
26
|
+
"Content-Type": "application/json; charset=UTF-8",
|
|
27
|
+
},
|
|
28
|
+
body: JSON.stringify({ filters: { video_ids: [input.providerPostId] } }),
|
|
29
|
+
});
|
|
30
|
+
const json = (await resp.json());
|
|
31
|
+
if (!resp.ok || json.error?.code) {
|
|
32
|
+
throw new Error(`TikTokMetrics: video query ${resp.status} ${json.error?.message ?? ""}`.trim());
|
|
33
|
+
}
|
|
34
|
+
const v = json.data?.videos?.[0];
|
|
35
|
+
return {
|
|
36
|
+
views: v?.view_count ?? 0,
|
|
37
|
+
likes: v?.like_count ?? 0,
|
|
38
|
+
comments: v?.comment_count ?? 0,
|
|
39
|
+
shares: v?.share_count ?? 0,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.TikTokMetricsClient = TikTokMetricsClient;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ESocialProvider } from "../../globals/types";
|
|
2
|
+
import { ISocialMetricSnapshot } from "../../models/social.model";
|
|
3
|
+
/**
|
|
4
|
+
* X8 Social Suite — analytics client abstraction. No platform pushes analytics
|
|
5
|
+
* and data lags 24–72h, so the metrics worker polls each published post on a
|
|
6
|
+
* schedule and snapshots into the `socialAnalytics` time-series. One
|
|
7
|
+
* implementation per platform normalizes provider metrics into
|
|
8
|
+
* `ISocialMetricSnapshot` (views-centric — impressions are deprecated on Meta).
|
|
9
|
+
* See notes/SOCIAL_SUITE_PLAN.md §3/§4.
|
|
10
|
+
*/
|
|
11
|
+
export interface MetricsInput {
|
|
12
|
+
/** Cleartext access token for the owning account (already refreshed). */
|
|
13
|
+
accessToken: string;
|
|
14
|
+
/** Provider's post/video id to fetch metrics for. */
|
|
15
|
+
providerPostId: string;
|
|
16
|
+
}
|
|
17
|
+
export interface AudienceInput {
|
|
18
|
+
/** Cleartext access token for the owning account (already refreshed). */
|
|
19
|
+
accessToken: string;
|
|
20
|
+
/** Provider's account id (IG user id / channel id / Page id). */
|
|
21
|
+
providerAccountId: string;
|
|
22
|
+
}
|
|
23
|
+
/** One bucket of an audience breakdown, e.g. { label: "25-34", value: 0.32 }. */
|
|
24
|
+
export interface IAudienceBucket {
|
|
25
|
+
label: string;
|
|
26
|
+
/** Share 0..1 (preferred) or an absolute count where shares aren't given. */
|
|
27
|
+
value: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Normalized audience demographics (C7 / G3). Owner-account only and gated to
|
|
31
|
+
* business-tier accounts on Meta (≥100 followers). Any dimension the provider
|
|
32
|
+
* doesn't expose is simply omitted.
|
|
33
|
+
*/
|
|
34
|
+
export interface ISocialAudience {
|
|
35
|
+
followerCount?: number;
|
|
36
|
+
age?: IAudienceBucket[];
|
|
37
|
+
gender?: IAudienceBucket[];
|
|
38
|
+
country?: IAudienceBucket[];
|
|
39
|
+
city?: IAudienceBucket[];
|
|
40
|
+
/** Active hours 0..23 (engaged-follower online time) where available. */
|
|
41
|
+
activeHours?: IAudienceBucket[];
|
|
42
|
+
}
|
|
43
|
+
export interface ISocialMetricsClient {
|
|
44
|
+
readonly provider: ESocialProvider;
|
|
45
|
+
/** Fetch the current lifetime metrics for one post. */
|
|
46
|
+
fetchPostMetrics(input: MetricsInput): Promise<ISocialMetricSnapshot>;
|
|
47
|
+
/**
|
|
48
|
+
* Fetch audience demographics for the account (owner-only, business-tier).
|
|
49
|
+
* Optional: providers/accounts without the capability omit it, and callers
|
|
50
|
+
* degrade gracefully to "not supported". See plan §C7/§2B-G3.
|
|
51
|
+
*/
|
|
52
|
+
fetchAudience?(input: AudienceInput): Promise<ISocialAudience>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/socialMetrics/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC3B,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,eAAe,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,IAAI,CAAC,EAAE,eAAe,EAAE,CAAC;IACzB,yEAAyE;IACzE,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,uDAAuD;IACvD,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACtE;;;;OAIG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAChE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ESocialProvider } from "../../globals/types";
|
|
2
|
+
import { ISocialMetricSnapshot } from "../../models/social.model";
|
|
3
|
+
import { ISocialMetricsClient, MetricsInput } from "./types";
|
|
4
|
+
export declare class YouTubeMetricsClient implements ISocialMetricsClient {
|
|
5
|
+
readonly provider = ESocialProvider.YOUTUBE;
|
|
6
|
+
fetchPostMetrics({ accessToken, providerPostId, }: MetricsInput): Promise<ISocialMetricSnapshot>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=youtube.metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"youtube.metrics.d.ts","sourceRoot":"","sources":["../../../src/services/socialMetrics/youtube.metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAuB7D,qBAAa,oBAAqB,YAAW,oBAAoB;IAC/D,QAAQ,CAAC,QAAQ,2BAA2B;IAEtC,gBAAgB,CAAC,EACrB,WAAW,EACX,cAAc,GACf,EAAE,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAmBjD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.YouTubeMetricsClient = void 0;
|
|
4
|
+
const types_1 = require("../../globals/types");
|
|
5
|
+
/**
|
|
6
|
+
* YouTube metrics client. Uses the Data API `videos.list?part=statistics` for
|
|
7
|
+
* lifetime counters (views/likes/comments) — cheap (1 quota unit) and available
|
|
8
|
+
* to any channel. Watch-time / CTR / impressions live in the YouTube Analytics
|
|
9
|
+
* API and lag ~48–72h; we add those in Phase 4 (plan §3). Phase 1 ships the
|
|
10
|
+
* core counters so the analytics card has real data.
|
|
11
|
+
*/
|
|
12
|
+
const STATS_ENDPOINT = "https://www.googleapis.com/youtube/v3/videos?part=statistics";
|
|
13
|
+
class YouTubeMetricsClient {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.provider = types_1.ESocialProvider.YOUTUBE;
|
|
16
|
+
}
|
|
17
|
+
async fetchPostMetrics({ accessToken, providerPostId, }) {
|
|
18
|
+
const url = `${STATS_ENDPOINT}&id=${encodeURIComponent(providerPostId)}`;
|
|
19
|
+
const resp = await fetch(url, {
|
|
20
|
+
headers: { Authorization: `Bearer ${accessToken}` },
|
|
21
|
+
});
|
|
22
|
+
if (!resp.ok) {
|
|
23
|
+
throw new Error(`YouTubeMetrics: videos.list ${resp.status}`);
|
|
24
|
+
}
|
|
25
|
+
const json = (await resp.json());
|
|
26
|
+
const stats = json.items?.[0]?.statistics;
|
|
27
|
+
if (!stats) {
|
|
28
|
+
throw new Error(`YouTubeMetrics: no stats for video ${providerPostId}`);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
views: toNum(stats.viewCount),
|
|
32
|
+
likes: toNum(stats.likeCount),
|
|
33
|
+
comments: toNum(stats.commentCount),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.YouTubeMetricsClient = YouTubeMetricsClient;
|
|
38
|
+
function toNum(v) {
|
|
39
|
+
if (v === undefined)
|
|
40
|
+
return 0;
|
|
41
|
+
const n = Number(v);
|
|
42
|
+
return Number.isFinite(n) ? n : 0;
|
|
43
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ESocialProvider } from "../../globals/types";
|
|
2
|
+
import { ISocialOAuthProvider } from "./types";
|
|
3
|
+
/** Returns the OAuth provider for a platform, or throws if not yet supported. */
|
|
4
|
+
export declare function getSocialOAuthProvider(provider: ESocialProvider): ISocialOAuthProvider;
|
|
5
|
+
/** True when a platform's OAuth is wired up (used to gate the connect UI). */
|
|
6
|
+
export declare function isSocialOAuthSupported(provider: ESocialProvider): boolean;
|
|
7
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/services/socialOAuth/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAMtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAyB/C,iFAAiF;AACjF,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,GACxB,oBAAoB,CAMtB;AAED,8EAA8E;AAC9E,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAEzE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSocialOAuthProvider = getSocialOAuthProvider;
|
|
4
|
+
exports.isSocialOAuthSupported = isSocialOAuthSupported;
|
|
5
|
+
const types_1 = require("../../globals/types");
|
|
6
|
+
const linkedin_oauth_1 = require("./linkedin.oauth");
|
|
7
|
+
const meta_oauth_1 = require("./meta.oauth");
|
|
8
|
+
const pinterest_oauth_1 = require("./pinterest.oauth");
|
|
9
|
+
const threads_oauth_1 = require("./threads.oauth");
|
|
10
|
+
const tiktok_oauth_1 = require("./tiktok.oauth");
|
|
11
|
+
const x_oauth_1 = require("./x.oauth");
|
|
12
|
+
const youtube_oauth_1 = require("./youtube.oauth");
|
|
13
|
+
/**
|
|
14
|
+
* OAuth provider factory. Mirrors the aiGenFactory pattern: map a provider enum
|
|
15
|
+
* to its implementation. Add TikTok/LinkedIn here as their phases land.
|
|
16
|
+
*
|
|
17
|
+
* Meta backs both FACEBOOK and INSTAGRAM: one Facebook Login grant resolves the
|
|
18
|
+
* user's Pages (FACEBOOK) or their linked IG Business accounts (INSTAGRAM); the
|
|
19
|
+
* `target` ctor arg selects which the callback persists.
|
|
20
|
+
*/
|
|
21
|
+
const registry = {
|
|
22
|
+
[types_1.ESocialProvider.YOUTUBE]: () => new youtube_oauth_1.YouTubeOAuthProvider(),
|
|
23
|
+
[types_1.ESocialProvider.FACEBOOK]: () => new meta_oauth_1.MetaOAuthProvider(types_1.ESocialProvider.FACEBOOK),
|
|
24
|
+
[types_1.ESocialProvider.INSTAGRAM]: () => new meta_oauth_1.MetaOAuthProvider(types_1.ESocialProvider.INSTAGRAM),
|
|
25
|
+
[types_1.ESocialProvider.TIKTOK]: () => new tiktok_oauth_1.TikTokOAuthProvider(),
|
|
26
|
+
[types_1.ESocialProvider.THREADS]: () => new threads_oauth_1.ThreadsOAuthProvider(),
|
|
27
|
+
[types_1.ESocialProvider.LINKEDIN]: () => new linkedin_oauth_1.LinkedInOAuthProvider(),
|
|
28
|
+
[types_1.ESocialProvider.X]: () => new x_oauth_1.XOAuthProvider(),
|
|
29
|
+
[types_1.ESocialProvider.PINTEREST]: () => new pinterest_oauth_1.PinterestOAuthProvider(),
|
|
30
|
+
};
|
|
31
|
+
/** Returns the OAuth provider for a platform, or throws if not yet supported. */
|
|
32
|
+
function getSocialOAuthProvider(provider) {
|
|
33
|
+
const make = registry[provider];
|
|
34
|
+
if (!make) {
|
|
35
|
+
throw new Error(`Social OAuth not implemented for provider '${provider}'`);
|
|
36
|
+
}
|
|
37
|
+
return make();
|
|
38
|
+
}
|
|
39
|
+
/** True when a platform's OAuth is wired up (used to gate the connect UI). */
|
|
40
|
+
function isSocialOAuthSupported(provider) {
|
|
41
|
+
return Boolean(registry[provider]);
|
|
42
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./youtube.oauth";
|
|
3
|
+
export * from "./meta.oauth";
|
|
4
|
+
export * from "./tiktok.oauth";
|
|
5
|
+
export * from "./threads.oauth";
|
|
6
|
+
export * from "./linkedin.oauth";
|
|
7
|
+
export * from "./x.oauth";
|
|
8
|
+
export * from "./pinterest.oauth";
|
|
9
|
+
export * from "./oauthState";
|
|
10
|
+
export * from "./factory";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/socialOAuth/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./youtube.oauth"), exports);
|
|
19
|
+
__exportStar(require("./meta.oauth"), exports);
|
|
20
|
+
__exportStar(require("./tiktok.oauth"), exports);
|
|
21
|
+
__exportStar(require("./threads.oauth"), exports);
|
|
22
|
+
__exportStar(require("./linkedin.oauth"), exports);
|
|
23
|
+
__exportStar(require("./x.oauth"), exports);
|
|
24
|
+
__exportStar(require("./pinterest.oauth"), exports);
|
|
25
|
+
__exportStar(require("./oauthState"), exports);
|
|
26
|
+
__exportStar(require("./factory"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ESocialProvider } from "../../globals/types";
|
|
2
|
+
import { AuthUrlParams, ConnectResult, ExchangeCodeParams, ISocialOAuthProvider, OAuthTokens } from "./types";
|
|
3
|
+
export declare class LinkedInOAuthProvider implements ISocialOAuthProvider {
|
|
4
|
+
readonly provider = ESocialProvider.LINKEDIN;
|
|
5
|
+
private clientId;
|
|
6
|
+
private clientSecret;
|
|
7
|
+
getAuthUrl({ state, redirectUri, requestBusinessScopes, }: AuthUrlParams): string;
|
|
8
|
+
exchangeCode({ code, redirectUri, }: ExchangeCodeParams): Promise<ConnectResult>;
|
|
9
|
+
refresh(refreshToken: string): Promise<OAuthTokens>;
|
|
10
|
+
private postToken;
|
|
11
|
+
private toTokens;
|
|
12
|
+
private resolveAccount;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=linkedin.oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkedin.oauth.d.ts","sourceRoot":"","sources":["../../../src/services/socialOAuth/linkedin.oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE1E,OAAO,EACL,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACZ,MAAM,SAAS,CAAC;AAyCjB,qBAAa,qBAAsB,YAAW,oBAAoB;IAChE,QAAQ,CAAC,QAAQ,4BAA4B;IAE7C,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,YAAY;IAMpB,UAAU,CAAC,EACT,KAAK,EACL,WAAW,EACX,qBAAqB,GACtB,EAAE,aAAa,GAAG,MAAM;IAcnB,YAAY,CAAC,EACjB,IAAI,EACJ,WAAW,GACZ,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;IAkBxC,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;YAiB3C,SAAS;IAmBvB,OAAO,CAAC,QAAQ;YAaF,cAAc;CAiB7B"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LinkedInOAuthProvider = void 0;
|
|
4
|
+
const types_1 = require("../../globals/types");
|
|
5
|
+
const logger_1 = require("../../utils/logger");
|
|
6
|
+
/**
|
|
7
|
+
* LinkedIn OAuth provider. Phase 6 — fast-follow adapter.
|
|
8
|
+
*
|
|
9
|
+
* Config (env):
|
|
10
|
+
* LINKEDIN_CLIENT_ID
|
|
11
|
+
* LINKEDIN_CLIENT_SECRET
|
|
12
|
+
*
|
|
13
|
+
* Notes / gates (plan §G15-17):
|
|
14
|
+
* - Member posting uses `w_member_social` + OpenID (`openid profile`). Company-
|
|
15
|
+
* page posting + analytics is the Community Management API — vetted via a
|
|
16
|
+
* screencast review (business-tier G-features), requested via business scopes.
|
|
17
|
+
* - Refresh tokens are only issued to approved Marketing Developer Platform
|
|
18
|
+
* apps; standard apps get a 60-day access token and must re-consent. `refresh`
|
|
19
|
+
* still tries the refresh grant for approved apps.
|
|
20
|
+
*/
|
|
21
|
+
const AUTH_ENDPOINT = "https://www.linkedin.com/oauth/v2/authorization";
|
|
22
|
+
const TOKEN_ENDPOINT = "https://www.linkedin.com/oauth/v2/accessToken";
|
|
23
|
+
const USERINFO_ENDPOINT = "https://api.linkedin.com/v2/userinfo";
|
|
24
|
+
const BASE_SCOPES = ["openid", "profile", "w_member_social"];
|
|
25
|
+
const BUSINESS_SCOPES = ["r_organization_social", "w_organization_social"];
|
|
26
|
+
class LinkedInOAuthProvider {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.provider = types_1.ESocialProvider.LINKEDIN;
|
|
29
|
+
}
|
|
30
|
+
clientId() {
|
|
31
|
+
const v = process.env.LINKEDIN_CLIENT_ID;
|
|
32
|
+
if (!v)
|
|
33
|
+
throw new Error("LinkedInOAuth: LINKEDIN_CLIENT_ID not set");
|
|
34
|
+
return v;
|
|
35
|
+
}
|
|
36
|
+
clientSecret() {
|
|
37
|
+
const v = process.env.LINKEDIN_CLIENT_SECRET;
|
|
38
|
+
if (!v)
|
|
39
|
+
throw new Error("LinkedInOAuth: LINKEDIN_CLIENT_SECRET not set");
|
|
40
|
+
return v;
|
|
41
|
+
}
|
|
42
|
+
getAuthUrl({ state, redirectUri, requestBusinessScopes, }) {
|
|
43
|
+
const scopes = requestBusinessScopes
|
|
44
|
+
? [...BASE_SCOPES, ...BUSINESS_SCOPES]
|
|
45
|
+
: BASE_SCOPES;
|
|
46
|
+
const params = new URLSearchParams({
|
|
47
|
+
response_type: "code",
|
|
48
|
+
client_id: this.clientId(),
|
|
49
|
+
redirect_uri: redirectUri,
|
|
50
|
+
state,
|
|
51
|
+
scope: scopes.join(" "),
|
|
52
|
+
});
|
|
53
|
+
return `${AUTH_ENDPOINT}?${params.toString()}`;
|
|
54
|
+
}
|
|
55
|
+
async exchangeCode({ code, redirectUri, }) {
|
|
56
|
+
const token = await this.postToken(new URLSearchParams({
|
|
57
|
+
grant_type: "authorization_code",
|
|
58
|
+
code,
|
|
59
|
+
redirect_uri: redirectUri,
|
|
60
|
+
client_id: this.clientId(),
|
|
61
|
+
client_secret: this.clientSecret(),
|
|
62
|
+
}));
|
|
63
|
+
if (!token.access_token) {
|
|
64
|
+
throw new Error("LinkedInOAuth: token exchange returned no access_token");
|
|
65
|
+
}
|
|
66
|
+
const tokens = this.toTokens(token);
|
|
67
|
+
const account = await this.resolveAccount(token.access_token);
|
|
68
|
+
return { account, tokens };
|
|
69
|
+
}
|
|
70
|
+
async refresh(refreshToken) {
|
|
71
|
+
const token = await this.postToken(new URLSearchParams({
|
|
72
|
+
grant_type: "refresh_token",
|
|
73
|
+
refresh_token: refreshToken,
|
|
74
|
+
client_id: this.clientId(),
|
|
75
|
+
client_secret: this.clientSecret(),
|
|
76
|
+
}));
|
|
77
|
+
if (!token.access_token) {
|
|
78
|
+
throw new Error("LinkedInOAuth: refresh returned no access_token");
|
|
79
|
+
}
|
|
80
|
+
const tokens = this.toTokens(token);
|
|
81
|
+
if (!tokens.refreshToken)
|
|
82
|
+
tokens.refreshToken = refreshToken;
|
|
83
|
+
return tokens;
|
|
84
|
+
}
|
|
85
|
+
async postToken(body) {
|
|
86
|
+
const resp = await fetch(TOKEN_ENDPOINT, {
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
89
|
+
body: body.toString(),
|
|
90
|
+
});
|
|
91
|
+
const json = (await resp.json());
|
|
92
|
+
if (!resp.ok || json.error) {
|
|
93
|
+
throw new Error(`LinkedInOAuth: token endpoint ${resp.status} ${json.error ?? ""} ${json.error_description ?? ""}`.trim());
|
|
94
|
+
}
|
|
95
|
+
return json;
|
|
96
|
+
}
|
|
97
|
+
toTokens(token) {
|
|
98
|
+
const now = Date.now();
|
|
99
|
+
return {
|
|
100
|
+
accessToken: token.access_token,
|
|
101
|
+
refreshToken: token.refresh_token,
|
|
102
|
+
expiresAt: now + (token.expires_in ?? 60 * 24 * 3600) * 1000,
|
|
103
|
+
refreshExpiresAt: token.refresh_token_expires_in
|
|
104
|
+
? now + token.refresh_token_expires_in * 1000
|
|
105
|
+
: undefined,
|
|
106
|
+
scopes: token.scope ? token.scope.split(" ").filter(Boolean) : [],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
async resolveAccount(accessToken) {
|
|
110
|
+
const resp = await fetch(USERINFO_ENDPOINT, {
|
|
111
|
+
headers: { Authorization: `Bearer ${accessToken}` },
|
|
112
|
+
});
|
|
113
|
+
const json = (await resp.json());
|
|
114
|
+
if (!resp.ok || !json.sub) {
|
|
115
|
+
throw new Error(`LinkedInOAuth: userinfo ${resp.status}`);
|
|
116
|
+
}
|
|
117
|
+
logger_1.logger.info("LinkedInOAuth: connected", { sub: json.sub });
|
|
118
|
+
return {
|
|
119
|
+
// Store the bare member id; the publisher builds urn:li:person:{id}.
|
|
120
|
+
providerAccountId: json.sub,
|
|
121
|
+
displayName: json.name ?? "LinkedIn member",
|
|
122
|
+
avatarUrl: json.picture,
|
|
123
|
+
kind: types_1.ESocialAccountKind.PERSONAL,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.LinkedInOAuthProvider = LinkedInOAuthProvider;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ESocialProvider } from "../../globals/types";
|
|
2
|
+
import { AuthUrlParams, ConnectResult, ExchangeCodeParams, ISocialOAuthProvider, OAuthTokens } from "./types";
|
|
3
|
+
export declare class MetaOAuthProvider implements ISocialOAuthProvider {
|
|
4
|
+
readonly provider: ESocialProvider;
|
|
5
|
+
/** Which surface this instance resolves: FACEBOOK (Pages) or INSTAGRAM. */
|
|
6
|
+
private readonly target;
|
|
7
|
+
constructor(target: ESocialProvider);
|
|
8
|
+
private graphVersion;
|
|
9
|
+
private graph;
|
|
10
|
+
private appId;
|
|
11
|
+
private appSecret;
|
|
12
|
+
getAuthUrl({ state, redirectUri, requestBusinessScopes, }: AuthUrlParams): string;
|
|
13
|
+
/**
|
|
14
|
+
* Single-account path is unused for Meta (one grant → many accounts), but the
|
|
15
|
+
* interface requires it. We return the first resolved account so any caller
|
|
16
|
+
* that ignores `exchangeCodeMulti` still gets something sensible.
|
|
17
|
+
*/
|
|
18
|
+
exchangeCode(params: ExchangeCodeParams): Promise<ConnectResult>;
|
|
19
|
+
exchangeCodeMulti(params: ExchangeCodeParams): Promise<ConnectResult[]>;
|
|
20
|
+
private resolveFacebookPages;
|
|
21
|
+
private resolveInstagramAccounts;
|
|
22
|
+
private pageTokens;
|
|
23
|
+
/**
|
|
24
|
+
* Meta Page tokens don't expire, so refresh should never be called by the
|
|
25
|
+
* daemon (far-future expiry). If it is, surface a reconnect rather than
|
|
26
|
+
* silently returning a possibly-revoked token.
|
|
27
|
+
*/
|
|
28
|
+
refresh(): Promise<OAuthTokens>;
|
|
29
|
+
private getJson;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=meta.oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.oauth.d.ts","sourceRoot":"","sources":["../../../src/services/socialOAuth/meta.oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE1E,OAAO,EACL,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACZ,MAAM,SAAS,CAAC;AAiFjB,qBAAa,iBAAkB,YAAW,oBAAoB;IAC5D,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEnC,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;gBAE7B,MAAM,EAAE,eAAe;IAWnC,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,SAAS;IAMjB,UAAU,CAAC,EACT,KAAK,EACL,WAAW,EACX,qBAAqB,GACtB,EAAE,aAAa,GAAG,MAAM;IAczB;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;IAahE,iBAAiB,CACrB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,aAAa,EAAE,CAAC;YAgDb,oBAAoB;YA8BpB,wBAAwB;IAgCtC,OAAO,CAAC,UAAU;IASlB;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;YAMvB,OAAO;CAYtB"}
|